Commit ec6c212
Add histogram to telemetrygen (open-telemetry#36322)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Generates simple histograms using telemetrygen
<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes
<!--Describe what testing was performed and which tests were added.-->
#### Testing
Test with a local otel collector with debug output
```
bin/telemetrygen metrics --metrics 5 --otlp-http --otlp-endpoint "localhost:4318" --metric-type Histogram --otlp-insecure
```
Output from debug Exporter:
```
Resource SchemaURL: https://opentelemetry.io/schemas/1.13.0
ScopeMetrics #0
ScopeMetrics SchemaURL:
InstrumentationScope
Metric #0
Descriptor:
-> Name: gen
-> Description:
-> Unit:
-> DataType: Histogram
-> AggregationTemporality: Cumulative
HistogramDataPoints #0
StartTimestamp: 2024-11-13 16:22:50.633365 +0000 UTC
Timestamp: 2024-11-13 16:22:51.633367 +0000 UTC
Count: 0
Sum: 0.000000
ExplicitBounds #0: 0.000000
ExplicitBounds open-telemetry#1: 1.000000
ExplicitBounds open-telemetry#2: 2.000000
ExplicitBounds open-telemetry#3: 3.000000
ExplicitBounds open-telemetry#4: 4.000000
Buckets #0, Count: 0
Buckets open-telemetry#1, Count: 0
Buckets open-telemetry#2, Count: 0
Buckets open-telemetry#3, Count: 0
Buckets open-telemetry#4, Count: 0
ResourceMetrics open-telemetry#1
Resource SchemaURL: https://opentelemetry.io/schemas/1.13.0
ScopeMetrics #0
ScopeMetrics SchemaURL:
InstrumentationScope
Metric #0
Descriptor:
-> Name: gen
-> Description:
-> Unit:
-> DataType: Histogram
-> AggregationTemporality: Cumulative
HistogramDataPoints #0
StartTimestamp: 2024-11-13 16:22:50.639942 +0000 UTC
Timestamp: 2024-11-13 16:22:51.639942 +0000 UTC
Count: 1
Sum: 1.000000
ExplicitBounds #0: 0.000000
ExplicitBounds open-telemetry#1: 1.000000
ExplicitBounds open-telemetry#2: 2.000000
ExplicitBounds open-telemetry#3: 3.000000
ExplicitBounds open-telemetry#4: 4.000000
Buckets #0, Count: 0
Buckets open-telemetry#1, Count: 1
Buckets open-telemetry#2, Count: 0
Buckets open-telemetry#3, Count: 0
Buckets open-telemetry#4, Count: 0
ResourceMetrics open-telemetry#2
Resource SchemaURL: https://opentelemetry.io/schemas/1.13.0
ScopeMetrics #0
ScopeMetrics SchemaURL:
InstrumentationScope
Metric #0
Descriptor:
-> Name: gen
-> Description:
-> Unit:
-> DataType: Histogram
-> AggregationTemporality: Cumulative
HistogramDataPoints #0
StartTimestamp: 2024-11-13 16:22:50.6404 +0000 UTC
Timestamp: 2024-11-13 16:22:51.640401 +0000 UTC
Count: 2
Sum: 4.000000
ExplicitBounds #0: 0.000000
ExplicitBounds open-telemetry#1: 1.000000
ExplicitBounds open-telemetry#2: 2.000000
ExplicitBounds open-telemetry#3: 3.000000
ExplicitBounds open-telemetry#4: 4.000000
Buckets #0, Count: 0
Buckets open-telemetry#1, Count: 1
Buckets open-telemetry#2, Count: 0
Buckets open-telemetry#3, Count: 1
Buckets open-telemetry#4, Count: 0
ResourceMetrics open-telemetry#3
Resource SchemaURL: https://opentelemetry.io/schemas/1.13.0
ScopeMetrics #0
ScopeMetrics SchemaURL:
InstrumentationScope
Metric #0
Descriptor:
-> Name: gen
-> Description:
-> Unit:
-> DataType: Histogram
-> AggregationTemporality: Cumulative
HistogramDataPoints #0
StartTimestamp: 2024-11-13 16:22:50.640729 +0000 UTC
Timestamp: 2024-11-13 16:22:51.640729 +0000 UTC
Count: 3
Sum: 3.000000
ExplicitBounds #0: 0.000000
ExplicitBounds open-telemetry#1: 1.000000
ExplicitBounds open-telemetry#2: 2.000000
ExplicitBounds open-telemetry#3: 3.000000
ExplicitBounds open-telemetry#4: 4.000000
Buckets #0, Count: 1
Buckets open-telemetry#1, Count: 1
Buckets open-telemetry#2, Count: 1
Buckets open-telemetry#3, Count: 0
Buckets open-telemetry#4, Count: 0
ResourceMetrics open-telemetry#4
Resource SchemaURL: https://opentelemetry.io/schemas/1.13.0
ScopeMetrics #0
ScopeMetrics SchemaURL:
InstrumentationScope
Metric #0
Descriptor:
-> Name: gen
-> Description:
-> Unit:
-> DataType: Histogram
-> AggregationTemporality: Cumulative
HistogramDataPoints #0
StartTimestamp: 2024-11-13 16:22:50.641073 +0000 UTC
Timestamp: 2024-11-13 16:22:51.641073 +0000 UTC
Count: 4
Sum: 12.000000
ExplicitBounds #0: 0.000000
ExplicitBounds open-telemetry#1: 1.000000
ExplicitBounds open-telemetry#2: 2.000000
ExplicitBounds open-telemetry#3: 3.000000
ExplicitBounds open-telemetry#4: 4.000000
Buckets #0, Count: 0
Buckets open-telemetry#1, Count: 0
Buckets open-telemetry#2, Count: 1
Buckets open-telemetry#3, Count: 2
Buckets open-telemetry#4, Count: 1
{"kind": "exporter", "data_type": "metrics", "name": "debug"}
```
<!--Describe the documentation added.-->
#### Documentation
<!--Please delete paragraphs that you did not use before submitting.-->
---------
Co-authored-by: Pablo Baeyens <[email protected]>1 parent b785e53 commit ec6c212
File tree
3 files changed
+101
-4
lines changed- .chloggen
- cmd/telemetrygen/internal/metrics
3 files changed
+101
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | | - | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | | - | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
33 | 79 | | |
34 | 80 | | |
35 | 81 | | |
| |||
82 | 128 | | |
83 | 129 | | |
84 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
85 | 154 | | |
86 | 155 | | |
87 | 156 | | |
| |||
0 commit comments