Skip to content

Commit 0a895bc

Browse files
examples/opentelemetry: use experimental metrics in example (#8441)
1 parent 8b61e8f commit 0a895bc

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

examples/features/opentelemetry/client/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import (
4343
)
4444

4545
var (
46-
addr = flag.String("addr", ":50051", "the server address to connect to")
46+
addr = flag.String("addr", "localhost:50051", "the server address to connect to")
4747
prometheusEndpoint = flag.String("prometheus_endpoint", ":9465", "the Prometheus exporter endpoint for metrics")
4848
)
4949

@@ -70,8 +70,8 @@ func main() {
7070
// up-to-date list of metrics, see:
7171
// https://grpc.io/docs/guides/opentelemetry-metrics/#instruments
7272
Metrics: opentelemetry.DefaultMetrics().Add(
73-
"grpc.client.attempt.started",
74-
"grpc.client.attempt.duration",
73+
"grpc.lb.pick_first.connection_attempts_succeeded",
74+
"grpc.lb.pick_first.connection_attempts_failed",
7575
),
7676
},
7777
TraceOptions: oteltracing.TraceOptions{TracerProvider: traceProvider, TextMapPropagator: textMapPropagator},

examples/features/opentelemetry/server/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import (
4242
)
4343

4444
var (
45-
addr = flag.String("addr", ":50051", "the server address to connect to")
45+
addr = flag.String("addr", "localhost:50051", "the server address to connect to")
4646
prometheusEndpoint = flag.String("prometheus_endpoint", ":9464", "the Prometheus exporter endpoint for metrics")
4747
)
4848

@@ -78,8 +78,8 @@ func main() {
7878
// up-to-date list of metrics, see:
7979
// https://grpc.io/docs/guides/opentelemetry-metrics/#instruments
8080
Metrics: opentelemetry.DefaultMetrics().Add(
81-
"grpc.server.call.started",
82-
"grpc.server.call.duration",
81+
"grpc.lb.pick_first.connection_attempts_succeeded",
82+
"grpc.lb.pick_first.connection_attempts_failed",
8383
),
8484
},
8585
TraceOptions: oteltracing.TraceOptions{TracerProvider: traceProvider, TextMapPropagator: textMapPropagator}})

stats/opentelemetry/example_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ func ExampleOptions_addExperimentalMetrics() {
137137
// up-to-date list of metrics, see:
138138
// https://grpc.io/docs/guides/opentelemetry-metrics/#instruments
139139
Metrics: opentelemetry.DefaultMetrics().Add(
140-
"grpc.client.attempt.started",
141-
"grpc.client.attempt.duration",
140+
"grpc.lb.pick_first.connection_attempts_succeeded",
141+
"grpc.lb.pick_first.connection_attempts_failed",
142142
),
143143
},
144144
}

0 commit comments

Comments
 (0)