]> git.feebdaed.xyz Git - 0xmirror/grpc-go.git/commitdiff
examples/opentelemetry: use experimental metrics in example (#8441)
authorvinothkumarr227 <vinothkumarr@google.com>
Wed, 30 Jul 2025 05:52:50 +0000 (11:22 +0530)
committerGitHub <noreply@github.com>
Wed, 30 Jul 2025 05:52:50 +0000 (11:22 +0530)
examples/features/opentelemetry/client/main.go
examples/features/opentelemetry/server/main.go
stats/opentelemetry/example_test.go

index 4f9eea5390892c866d3e28ab31ae22335821036b..8b926f53bf9a09907ac6d13d37caae917bfe39cd 100644 (file)
@@ -43,7 +43,7 @@ import (
 )
 
 var (
-       addr               = flag.String("addr", ":50051", "the server address to connect to")
+       addr               = flag.String("addr", "localhost:50051", "the server address to connect to")
        prometheusEndpoint = flag.String("prometheus_endpoint", ":9465", "the Prometheus exporter endpoint for metrics")
 )
 
@@ -70,8 +70,8 @@ func main() {
                        // up-to-date list of metrics, see:
                        // https://grpc.io/docs/guides/opentelemetry-metrics/#instruments
                        Metrics: opentelemetry.DefaultMetrics().Add(
-                               "grpc.client.attempt.started",
-                               "grpc.client.attempt.duration",
+                               "grpc.lb.pick_first.connection_attempts_succeeded",
+                               "grpc.lb.pick_first.connection_attempts_failed",
                        ),
                },
                TraceOptions: oteltracing.TraceOptions{TracerProvider: traceProvider, TextMapPropagator: textMapPropagator},
index 5288fe981f6c788d5eaa44fce59a059f678b24a8..31dd0c2450650a5b1ba0a9ffbcda35cc509bc2a0 100644 (file)
@@ -42,7 +42,7 @@ import (
 )
 
 var (
-       addr               = flag.String("addr", ":50051", "the server address to connect to")
+       addr               = flag.String("addr", "localhost:50051", "the server address to connect to")
        prometheusEndpoint = flag.String("prometheus_endpoint", ":9464", "the Prometheus exporter endpoint for metrics")
 )
 
@@ -78,8 +78,8 @@ func main() {
                        // up-to-date list of metrics, see:
                        // https://grpc.io/docs/guides/opentelemetry-metrics/#instruments
                        Metrics: opentelemetry.DefaultMetrics().Add(
-                               "grpc.server.call.started",
-                               "grpc.server.call.duration",
+                               "grpc.lb.pick_first.connection_attempts_succeeded",
+                               "grpc.lb.pick_first.connection_attempts_failed",
                        ),
                },
                TraceOptions: oteltracing.TraceOptions{TracerProvider: traceProvider, TextMapPropagator: textMapPropagator}})
index 3e58151bf7b69627c56a9b6c7481dfc9bd096165..0524bfc21252ff9317cd0a14cbdee30c283e0e81 100644 (file)
@@ -137,8 +137,8 @@ func ExampleOptions_addExperimentalMetrics() {
                        // up-to-date list of metrics, see:
                        // https://grpc.io/docs/guides/opentelemetry-metrics/#instruments
                        Metrics: opentelemetry.DefaultMetrics().Add(
-                               "grpc.client.attempt.started",
-                               "grpc.client.attempt.duration",
+                               "grpc.lb.pick_first.connection_attempts_succeeded",
+                               "grpc.lb.pick_first.connection_attempts_failed",
                        ),
                },
        }