Robert Wu
|
60f9f39d78
|
feat(prometheus): Add observability for prometheus exporter (#7345)
fix #7013
References:
- [Follow
guidelines](a5dcd68ebb/CONTRIBUTING.md (encapsulation)).
- PR: #7307
Implement following self-observability metrics from
https://github.com/open-telemetry/semantic-conventions/blob/v1.36.0/docs/otel/sdk-metrics.md
for https://pkg.go.dev/go.opentelemetry.io/otel/exporters/prometheus:
- otel.sdk.exporter.metric_data_point.inflight
- otel.sdk.exporter.metric_data_point.exported
- otel.sdk.exporter.operation.duration
- otel.sdk.metric_reader.collection.duration
### Benchmarks
```console
➜ benchstat /tmp/bench_disabled.txt /tmp/bench_enabled.txt
goos: darwin
goarch: arm64
pkg: go.opentelemetry.io/otel/exporters/prometheus/internal/observ
cpu: Apple M1 Max
│ /tmp/bench_disabled.txt │ /tmp/bench_enabled.txt │
│ sec/op │ sec/op vs base │
InstrumentationExportMetrics-10 177.5n ± 0% 177.8n ± 0% +0.14% (p=0.039 n=20)
InstrumentationRecordOperationDuration-10 246.6n ± 0% 246.7n ± 0% ~ (p=0.606 n=20)
InstrumentationRecordCollectionDuration-10 246.8n ± 1% 247.2n ± 0% ~ (p=0.456 n=20)
geomean 221.1n 221.3n +0.09%
│ /tmp/bench_disabled.txt │ /tmp/bench_enabled.txt │
│ B/op │ B/op vs base │
InstrumentationExportMetrics-10 256.0 ± 0% 256.0 ± 0% ~ (p=1.000 n=20) ¹
InstrumentationRecordOperationDuration-10 272.0 ± 0% 272.0 ± 0% ~ (p=1.000 n=20) ¹
InstrumentationRecordCollectionDuration-10 272.0 ± 0% 272.0 ± 0% ~ (p=1.000 n=20) ¹
geomean 266.6 266.6 +0.00%
¹ all samples are equal
│ /tmp/bench_disabled.txt │ /tmp/bench_enabled.txt │
│ allocs/op │ allocs/op vs base │
InstrumentationExportMetrics-10 3.000 ± 0% 3.000 ± 0% ~ (p=1.000 n=20) ¹
InstrumentationRecordOperationDuration-10 3.000 ± 0% 3.000 ± 0% ~ (p=1.000 n=20) ¹
InstrumentationRecordCollectionDuration-10 3.000 ± 0% 3.000 ± 0% ~ (p=1.000 n=20) ¹
geomean 3.000 3.000 +0.00%
¹ all samples are equal
```
---------
Co-authored-by: Flc゛ <four_leaf_clover@foxmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
|
2025-09-18 07:52:54 -07:00 |
|