הגדרה של פלאגין OpenTelemetry בסיסי ב-gRPC Go

1. מבוא

ב-codelab הזה תשתמשו ב-gRPC כדי ליצור לקוח ושרת שיהוו את הבסיס לאפליקציית מיפוי מסלולים שנכתבה ב-Go.

בסוף המדריך תהיה לכם אפליקציית gRPC HelloWorld פשוטה עם מכשור באמצעות הפלאגין gRPC OpenTelemetry, ותוכלו לראות את מדדי יכולת הצפייה המיוצאים ב-Prometheus.

מה תלמדו

  • איך מגדירים את OpenTelemetry Plugin באפליקציית gRPC Go קיימת
  • הפעלת מופע מקומי של Prometheus
  • ייצוא מדדים ל-Prometheus
  • הצגת מדדים ממרכז הבקרה של Prometheus

‫2. לפני שמתחילים

הדרישות

  • git
  • curl
  • Go כל אחת משתי הגרסאות העיקריות האחרונות של Go.
  • protoc v3

מתקינים את הדרישות המוקדמות:

sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get install -y git curl
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest

קבל את הקוד

כדי לייעל את הלמידה, ב-Codelab הזה מוצעת מסגרת מוכנה מראש של קוד מקור שתעזור לכם להתחיל. השלבים הבאים יעזרו לכם להטמיע את הפלאגין gRPC OpenTelemetry באפליקציה.

grpc-codelabs

קוד המקור של ה-scaffold ל-codelab הזה זמין בספרייה הזו ב-GitHub. אם אתם מעדיפים לא להטמיע את הקוד בעצמכם, קוד המקור המלא זמין בספרייה completed.

קודם כל, משכפלים את מאגר ה-codelab של grpc ועוברים לתיקייה grpc-go-opentelemetry:

git clone https://github.com/grpc-ecosystem/grpc-codelabs.git
cd grpc-codelabs/codelabs/grpc-go-opentelemetry/

אפשרות אחרת היא להוריד את קובץ ה-‎ .zip שמכיל רק את ספריית ה-codelab ולבטל את הדחיסה שלו באופן ידני.

3. רישום הפלאגין OpenTelemetry

כדי להוסיף את הפלאגין gRPC OpenTelemetry, צריך אפליקציית gRPC. ב-codelab הזה נשתמש בלקוח ובשרת פשוטים של gRPC HelloWorld, שבהם נשתמש בפלאגין gRPC OpenTelemetry.

הגדרת מכשור בלקוח

השלב הראשון הוא לרשום את OpenTelemetry Plugin שהוגדר עם Prometheus exporter בלקוח. פותחים את codelabs/grpc-go-opentelemetry/start_here/client/main.go בעורך המועדף, ומשנים את main()כדי להוסיף קוד להגדרת הפלאגין gRPC Go Otel.

יצירת כלי חדש לייצוא נתונים בפורמט Prometheus

קטעי הקוד הבאים יוצרים prometheus Exporter חדש

exporter, err := prometheus.New()
if err != nil {
        log.Fatalf("Failed to start prometheus exporter: %v", err)
}

הפעלת כלי הייצוא של Prometheus

מפעילים goroutine חדש שמשתמש ב-net/http כדי להאזין ולשרת בכתובת שמועברת באמצעות הדגל prometheus_endpoint

go http.ListenAndServe(*prometheusEndpoint, promhttp.Handler())

יצירת DialOption באמצעות פלאגין OpenTelemetry

באמצעות שיטת DialOption של gRPC Otel, מגדירים את DialOption באמצעות Prometheus Meter Provider

provider := metric.NewMeterProvider(metric.WithReader(exporter))
do := opentelemetry.DialOption(opentelemetry.Options{MetricsOptions: opentelemetry.MetricsOptions{MeterProvider: provider}})

העברת DialOption כשמתחברים לשרת

מעבירים את do אל gRPC.NewClient

ה-MeterProvider הזה מסופק לפלאגין OpenTelemetry של gRPC כהגדרה. אחרי שרושמים את הפלאגין OpenTelemetry באופן גלובלי, כל הלקוחות והשרתים של gRPC יצוידו ב-OpenTelemetry.

הגדרת מכשור בשרת

באופן דומה, נוסיף את הפלאגין OpenTelemetry גם לשרת. פתיחה של codelabs/grpc-go-opentelemetry/start_here/server/main.go וקוד להגדרת הפלאגין gRPC Go Otel

יצירת כלי חדש לייצוא נתונים בפורמט Prometheus

exporter, err := prometheus.New()
if err != nil {
        log.Fatalf("Failed to start prometheus exporter: %v", err)
}

יצירת ספק חדש של מדדים באמצעות כלי הייצוא של Prometheus

provider := metric.NewMeterProvider(metric.WithReader(exporter))
go http.ListenAndServe(*prometheusEndpoint, promhttp.Handler())

so := opentelemetry.ServerOption(opentelemetry.Options{MetricsOptions: opentelemetry.MetricsOptions{MeterProvider: provider}})

מעבירים את אפשרות השרת הזו אל gRPC.NewServer

4. הרצת הדוגמה והצגת המדדים

כדי להריץ את השרת, מריצים את הפקודה –

cd server
go mod tidy
go run .

אם ההגדרה הושלמה בהצלחה, הפלט של השרת ייראה כך:

Serving on :50051

בזמן שהשרת פועל, במסוף אחר, מריצים את הלקוח –

cd client
go mod tidy
go run .

הרצה מוצלחת תיראה כך:

message:"this is examples/opentelemetry (from :50051)"
message:"this is examples/opentelemetry (from :50051)"
message:"this is examples/opentelemetry (from :50051)"

הגדרנו את הפלאגין gRPC OpenTelemetry לייצוא מדדים באמצעות Prometheus. המדדים האלה יהיו זמינים בכתובת localhost:9464 לשרת ובכתובת localhost:9465 ללקוח.

כדי לראות את מדדי הלקוח –

curl localhost:9465/metrics

התוצאה תהיה מהצורה –

# HELP go_gc_duration_seconds A summary of the wall-time pause (stop-the-world) duration in garbage collection cycles.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 0
go_gc_duration_seconds{quantile="0.25"} 0
go_gc_duration_seconds{quantile="0.5"} 0
go_gc_duration_seconds{quantile="0.75"} 0
go_gc_duration_seconds{quantile="1"} 0
go_gc_duration_seconds_sum 0
go_gc_duration_seconds_count 0
# HELP go_gc_gogc_percent Heap size target percentage configured by the user, otherwise 100. This value is set by the GOGC environment variable, and the runtime/debug.SetGCPercent function. Sourced from /gc/gogc:percent
# TYPE go_gc_gogc_percent gauge
go_gc_gogc_percent 100
# HELP go_gc_gomemlimit_bytes Go runtime memory limit configured by the user, otherwise math.MaxInt64. This value is set by the GOMEMLIMIT environment variable, and the runtime/debug.SetMemoryLimit function. Sourced from /gc/gomemlimit:bytes
# TYPE go_gc_gomemlimit_bytes gauge
go_gc_gomemlimit_bytes 9.223372036854776e+18
# HELP go_goroutines Number of goroutines that currently exist.
# TYPE go_goroutines gauge
go_goroutines 14
# HELP go_info Information about the Go environment.
# TYPE go_info gauge
go_info{version="go1.22.1"} 1
# HELP go_memstats_alloc_bytes Number of bytes allocated in heap and currently in use. Equals to /memory/classes/heap/objects:bytes.
# TYPE go_memstats_alloc_bytes gauge
go_memstats_alloc_bytes 662176
# HELP go_memstats_alloc_bytes_total Total number of bytes allocated in heap until now, even if released already. Equals to /gc/heap/allocs:bytes.
# TYPE go_memstats_alloc_bytes_total counter
go_memstats_alloc_bytes_total 662176
# HELP go_memstats_buck_hash_sys_bytes Number of bytes used by the profiling bucket hash table. Equals to /memory/classes/profiling/buckets:bytes.
# TYPE go_memstats_buck_hash_sys_bytes gauge
go_memstats_buck_hash_sys_bytes 8739
# HELP go_memstats_frees_total Total number of heap objects frees. Equals to /gc/heap/frees:objects + /gc/heap/tiny/allocs:objects.
# TYPE go_memstats_frees_total counter
go_memstats_frees_total 0
# HELP go_memstats_gc_sys_bytes Number of bytes used for garbage collection system metadata. Equals to /memory/classes/metadata/other:bytes.
# TYPE go_memstats_gc_sys_bytes gauge
go_memstats_gc_sys_bytes 1.554232e+06
# HELP go_memstats_heap_alloc_bytes Number of heap bytes allocated and currently in use, same as go_memstats_alloc_bytes. Equals to /memory/classes/heap/objects:bytes.
# TYPE go_memstats_heap_alloc_bytes gauge
go_memstats_heap_alloc_bytes 662176
# HELP go_memstats_heap_idle_bytes Number of heap bytes waiting to be used. Equals to /memory/classes/heap/released:bytes + /memory/classes/heap/free:bytes.
# TYPE go_memstats_heap_idle_bytes gauge
go_memstats_heap_idle_bytes 4.75136e+06
# HELP go_memstats_heap_inuse_bytes Number of heap bytes that are in use. Equals to /memory/classes/heap/objects:bytes + /memory/classes/heap/unused:bytes
# TYPE go_memstats_heap_inuse_bytes gauge
go_memstats_heap_inuse_bytes 2.981888e+06
# HELP go_memstats_heap_objects Number of currently allocated objects. Equals to /gc/heap/objects:objects.
# TYPE go_memstats_heap_objects gauge
go_memstats_heap_objects 4022
# HELP go_memstats_heap_released_bytes Number of heap bytes released to OS. Equals to /memory/classes/heap/released:bytes.
# TYPE go_memstats_heap_released_bytes gauge
go_memstats_heap_released_bytes 4.75136e+06
# HELP go_memstats_heap_sys_bytes Number of heap bytes obtained from system. Equals to /memory/classes/heap/objects:bytes + /memory/classes/heap/unused:bytes + /memory/classes/heap/released:bytes + /memory/classes/heap/free:bytes.
# TYPE go_memstats_heap_sys_bytes gauge
go_memstats_heap_sys_bytes 7.733248e+06
# HELP go_memstats_last_gc_time_seconds Number of seconds since 1970 of last garbage collection.
# TYPE go_memstats_last_gc_time_seconds gauge
go_memstats_last_gc_time_seconds 0
# HELP go_memstats_mallocs_total Total number of heap objects allocated, both live and gc-ed. Semantically a counter version for go_memstats_heap_objects gauge. Equals to /gc/heap/allocs:objects + /gc/heap/tiny/allocs:objects.
# TYPE go_memstats_mallocs_total counter
go_memstats_mallocs_total 4022
# HELP go_memstats_mcache_inuse_bytes Number of bytes in use by mcache structures. Equals to /memory/classes/metadata/mcache/inuse:bytes.
# TYPE go_memstats_mcache_inuse_bytes gauge
go_memstats_mcache_inuse_bytes 9600
# HELP go_memstats_mcache_sys_bytes Number of bytes used for mcache structures obtained from system. Equals to /memory/classes/metadata/mcache/inuse:bytes + /memory/classes/metadata/mcache/free:bytes.
# TYPE go_memstats_mcache_sys_bytes gauge
go_memstats_mcache_sys_bytes 15600
# HELP go_memstats_mspan_inuse_bytes Number of bytes in use by mspan structures. Equals to /memory/classes/metadata/mspan/inuse:bytes.
# TYPE go_memstats_mspan_inuse_bytes gauge
go_memstats_mspan_inuse_bytes 65440
# HELP go_memstats_mspan_sys_bytes Number of bytes used for mspan structures obtained from system. Equals to /memory/classes/metadata/mspan/inuse:bytes + /memory/classes/metadata/mspan/free:bytes.
# TYPE go_memstats_mspan_sys_bytes gauge
go_memstats_mspan_sys_bytes 81600
# HELP go_memstats_next_gc_bytes Number of heap bytes when next garbage collection will take place. Equals to /gc/heap/goal:bytes.
# TYPE go_memstats_next_gc_bytes gauge
go_memstats_next_gc_bytes 4.194304e+06
# HELP go_memstats_other_sys_bytes Number of bytes used for other system allocations. Equals to /memory/classes/other:bytes.
# TYPE go_memstats_other_sys_bytes gauge
go_memstats_other_sys_bytes 1.111813e+06
# HELP go_memstats_stack_inuse_bytes Number of bytes obtained from system for stack allocator in non-CGO environments. Equals to /memory/classes/heap/stacks:bytes.
# TYPE go_memstats_stack_inuse_bytes gauge
go_memstats_stack_inuse_bytes 655360
# HELP go_memstats_stack_sys_bytes Number of bytes obtained from system for stack allocator. Equals to /memory/classes/heap/stacks:bytes + /memory/classes/os-stacks:bytes.
# TYPE go_memstats_stack_sys_bytes gauge
go_memstats_stack_sys_bytes 655360
# HELP go_memstats_sys_bytes Number of bytes obtained from system. Equals to /memory/classes/total:byte.
# TYPE go_memstats_sys_bytes gauge
go_memstats_sys_bytes 1.1160592e+07
# HELP go_sched_gomaxprocs_threads The current runtime.GOMAXPROCS setting, or the number of operating system threads that can execute user-level Go code simultaneously. Sourced from /sched/gomaxprocs:threads
# TYPE go_sched_gomaxprocs_threads gauge
go_sched_gomaxprocs_threads 8
# HELP go_threads Number of OS threads created.
# TYPE go_threads gauge
go_threads 8
# HELP grpc_client_attempt_duration_seconds End-to-end time taken to complete a client call attempt.
# TYPE grpc_client_attempt_duration_seconds histogram
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="1e-05"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="5e-05"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.0001"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.0003"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.0006"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.0008"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.001"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.002"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.003"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.004"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.005"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.006"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.008"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.01"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.013"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.016"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.02"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.025"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.03"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.04"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.05"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.065"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.08"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.1"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.13"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.16"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.2"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.25"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.3"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.4"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.5"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.65"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.8"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="1"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="2"} 0
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="5"} 26
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="10"} 26
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="20"} 26
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="50"} 26
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="100"} 26
grpc_client_attempt_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="+Inf"} 26
grpc_client_attempt_duration_seconds_sum{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev"} 52.09275054499999
grpc_client_attempt_duration_seconds_count{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev"} 26
# HELP grpc_client_attempt_rcvd_total_compressed_message_size_bytes Compressed message bytes received per call attempt.
# TYPE grpc_client_attempt_rcvd_total_compressed_message_size_bytes histogram
grpc_client_attempt_rcvd_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0"} 0
grpc_client_attempt_rcvd_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="1024"} 26
grpc_client_attempt_rcvd_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="2048"} 26
grpc_client_attempt_rcvd_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="4096"} 26
grpc_client_attempt_rcvd_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="16384"} 26
grpc_client_attempt_rcvd_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="65536"} 26
grpc_client_attempt_rcvd_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="262144"} 26
grpc_client_attempt_rcvd_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="1.048576e+06"} 26
grpc_client_attempt_rcvd_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="4.194304e+06"} 26
grpc_client_attempt_rcvd_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="1.6777216e+07"} 26
grpc_client_attempt_rcvd_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="6.7108864e+07"} 26
grpc_client_attempt_rcvd_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="2.68435456e+08"} 26
grpc_client_attempt_rcvd_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="1.073741824e+09"} 26
grpc_client_attempt_rcvd_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="4.294967296e+09"} 26
grpc_client_attempt_rcvd_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="+Inf"} 26
grpc_client_attempt_rcvd_total_compressed_message_size_bytes_sum{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev"} 1196
grpc_client_attempt_rcvd_total_compressed_message_size_bytes_count{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev"} 26
# HELP grpc_client_attempt_sent_total_compressed_message_size_bytes Compressed message bytes sent per client call attempt.
# TYPE grpc_client_attempt_sent_total_compressed_message_size_bytes histogram
grpc_client_attempt_sent_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0"} 0
grpc_client_attempt_sent_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="1024"} 26
grpc_client_attempt_sent_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="2048"} 26
grpc_client_attempt_sent_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="4096"} 26
grpc_client_attempt_sent_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="16384"} 26
grpc_client_attempt_sent_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="65536"} 26
grpc_client_attempt_sent_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="262144"} 26
grpc_client_attempt_sent_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="1.048576e+06"} 26
grpc_client_attempt_sent_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="4.194304e+06"} 26
grpc_client_attempt_sent_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="1.6777216e+07"} 26
grpc_client_attempt_sent_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="6.7108864e+07"} 26
grpc_client_attempt_sent_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="2.68435456e+08"} 26
grpc_client_attempt_sent_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="1.073741824e+09"} 26
grpc_client_attempt_sent_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="4.294967296e+09"} 26
grpc_client_attempt_sent_total_compressed_message_size_bytes_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="+Inf"} 26
grpc_client_attempt_sent_total_compressed_message_size_bytes_sum{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev"} 832
grpc_client_attempt_sent_total_compressed_message_size_bytes_count{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev"} 26
# HELP grpc_client_attempt_started_total Number of client call attempts started.
# TYPE grpc_client_attempt_started_total counter
grpc_client_attempt_started_total{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev"} 27
# HELP grpc_client_call_duration_seconds Time taken by gRPC to complete an RPC from application's perspective.
# TYPE grpc_client_call_duration_seconds histogram
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="1e-05"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="5e-05"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.0001"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.0003"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.0006"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.0008"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.001"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.002"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.003"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.004"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.005"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.006"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.008"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.01"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.013"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.016"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.02"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.025"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.03"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.04"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.05"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.065"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.08"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.1"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.13"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.16"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.2"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.25"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.3"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.4"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.5"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.65"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="0.8"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="1"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="2"} 0
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="5"} 26
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="10"} 26
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="20"} 26
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="50"} 26
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="100"} 26
grpc_client_call_duration_seconds_bucket{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev",le="+Inf"} 26
grpc_client_call_duration_seconds_sum{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev"} 52.35282954500001
grpc_client_call_duration_seconds_count{grpc_method="grpc.examples.echo.Echo/UnaryEcho",grpc_status="OK",grpc_target="dns:///:50051",otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev"} 26
# HELP otel_scope_info Instrumentation Scope metadata
# TYPE otel_scope_info gauge
otel_scope_info{otel_scope_name="grpc-go",otel_scope_version="1.67.0-dev"} 1
# HELP promhttp_metric_handler_requests_in_flight Current number of scrapes being served.
# TYPE promhttp_metric_handler_requests_in_flight gauge
promhttp_metric_handler_requests_in_flight 1
# HELP promhttp_metric_handler_requests_total Total number of scrapes by HTTP status code.
# TYPE promhttp_metric_handler_requests_total counter
promhttp_metric_handler_requests_total{code="200"} 1
promhttp_metric_handler_requests_total{code="500"} 0
promhttp_metric_handler_requests_total{code="503"} 0
# HELP target_info Target metadata
# TYPE target_info gauge
target_info{service_name="unknown_service:client",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="1.28.0"} 1

באופן דומה, לגבי המדדים בצד השרת –

curl localhost:9464/metrics

5. הצגת מדדים ב-Prometheus

במאמר הזה נגדיר מופע של Prometheus שיבצע scraping של הלקוח והשרת לדוגמה של gRPC שמייצאים מדדים באמצעות Prometheus.

מורידים את הגרסה האחרונה של Prometheus לפלטפורמה שלכם, מחלצים אותה ומריצים אותה:

tar xvfz prometheus-*.tar.gz
cd prometheus-*

יוצרים קובץ תצורה של Prometheus עם הפרטים הבאים:

cat > grpc_otel_go_prometheus.yml <<EOF
scrape_configs:
  - job_name: "prometheus"
    scrape_interval: 5s
    static_configs:
      - targets: ["localhost:9090"]
  - job_name: "grpc-otel-go"
    scrape_interval: 5s
    static_configs:
      - targets: ["localhost:9464", "localhost:9465"]
EOF

מפעילים את Prometheus עם ההגדרה החדשה –

./prometheus --config.file=grpc_otel_go_prometheus.yml

הפעולה הזו תגדיר את המדדים מתהליכי ה-codelab של הלקוח והשרת כך שהם ייגרדו כל 5 שניות.

כדי לראות את המדדים, עוברים אל http://localhost:9090/graph. לדוגמה, השאילתה –

histogram_quantile(0.5, rate(grpc_client_attempt_duration_seconds_bucket[1m]))

יוצג תרשים עם חביון הניסיון הממוצע, כשדקה אחת מוגדרת כחלון הזמן לחישוב הכמותי.

שיעור השאילתות –

increase(grpc_client_attempt_duration_seconds_bucket[1m])

6. (אופציונלי) תרגיל למשתמש

במרכזי הבקרה של Prometheus, תראו שערך השאילתות לשנייה נמוך. בודקים אם אפשר לזהות בקוד לדוגמה קוד חשוד שמגביל את מספר השאילתות לשנייה.

למי שרוצה להעמיק, קוד הלקוח מוגבל כך שיכולה להיות רק קריאת RPC אחת בהמתנה בכל רגע נתון. אפשר לשנות את ההגדרה כך שהלקוח ישלח עוד בקשות RPC בלי לחכות להשלמת הבקשות הקודמות. (הפתרון לבעיה הזו לא סופק).