1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2026-06-03 18:35:08 +02:00

Generating histogram boundaries from weaver.yaml (#8015)

Adding support for histogram boundaries to be generated from weaver 

fixes #8002

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
This commit is contained in:
Saharsh Tibrewala
2026-05-21 00:12:55 +05:30
committed by GitHub
parent 97447f5c54
commit f12c29f68a
5 changed files with 14 additions and 0 deletions
+1
View File
@@ -41,6 +41,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Add `go.opentelemetry.io/otel/semconv/v1.41.0` package.
The package contains semantic conventions from the `v1.41.0` version of the OpenTelemetry Semantic Conventions.
See the [migration documentation](./semconv/v1.41.0/MIGRATION.md) for information on how to upgrade from `go.opentelemetry.io/otel/semconv/v1.40.0`. (#8324)
- Generate explicit histogram bucket boundaries from weaver configuration for HTTP and RPC duration instruments in `go.opentelemetry.io/otel/semconv/v1.41.0`. (#8002)
### Changed
@@ -53,6 +53,7 @@ var (
{%- for metric in ctx.metrics %}
{%- set metric_name = h.to_go_name(metric.metric_name, ctx.root_namespace) %}
{%- set metric_inst = metric.metric_name | map_text("instrument", i.instrument_default(metric)) %}
{%- set metric_bucket_boundaries = metric.metric_name | map_text("custom_bucket_boundaries", "") %}
{{ h.metric_typedoc(metric, ctx.root_namespace) | comment | trim }}
type {{ metric_name }} struct {
@@ -62,6 +63,9 @@ type {{ metric_name }} struct {
var new{{ metric_name }}Opts = []metric.{{ metric_inst }}Option{
metric.WithDescription("{{ i.desc(metric) }}"),
metric.WithUnit("{{metric.unit}}"),
{%- if metric.instrument == "histogram" and metric_bucket_boundaries != "" %}
metric.WithExplicitBucketBoundaries({{ metric_bucket_boundaries }}...),
{%- endif %}
}
{{ ["New" ~ metric_name ~ " returns a new " ~ metric_name ~ " instrument."] | comment }}
@@ -86,6 +86,11 @@ text_maps:
system.memory.usage: Int64ObservableUpDownCounter
system.memory.utilization: Float64ObservableGauge
system.network.io: Int64ObservableCounter
custom_bucket_boundaries:
http.client.request.duration: "[]float64{0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10}"
http.server.request.duration: "[]float64{0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10}"
rpc.client.call.duration: "[]float64{0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10}"
rpc.server.call.duration: "[]float64{0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10}"
acronyms:
- ACL
- AI
+2
View File
@@ -739,6 +739,7 @@ type ClientRequestDuration struct {
var newClientRequestDurationOpts = []metric.Float64HistogramOption{
metric.WithDescription("Duration of HTTP client requests."),
metric.WithUnit("s"),
metric.WithExplicitBucketBoundaries([]float64{0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10}...),
}
// NewClientRequestDuration returns a new ClientRequestDuration instrument.
@@ -1450,6 +1451,7 @@ type ServerRequestDuration struct {
var newServerRequestDurationOpts = []metric.Float64HistogramOption{
metric.WithDescription("Duration of HTTP server requests."),
metric.WithUnit("s"),
metric.WithExplicitBucketBoundaries([]float64{0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10}...),
}
// NewServerRequestDuration returns a new ServerRequestDuration instrument.
+2
View File
@@ -65,6 +65,7 @@ type ClientCallDuration struct {
var newClientCallDurationOpts = []metric.Float64HistogramOption{
metric.WithDescription("Measures the duration of an outgoing Remote Procedure Call (RPC)."),
metric.WithUnit("s"),
metric.WithExplicitBucketBoundaries([]float64{0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10}...),
}
// NewClientCallDuration returns a new ClientCallDuration instrument.
@@ -223,6 +224,7 @@ type ServerCallDuration struct {
var newServerCallDurationOpts = []metric.Float64HistogramOption{
metric.WithDescription("Measures the duration of an incoming Remote Procedure Call (RPC)."),
metric.WithUnit("s"),
metric.WithExplicitBucketBoundaries([]float64{0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10}...),
}
// NewServerCallDuration returns a new ServerCallDuration instrument.