Skip to content

Commit 842a52e

Browse files
authored
[connector/elasticapm]Use exponential histogram from txn metrics (#630)
1 parent e487f84 commit 842a52e

File tree

4 files changed

+106
-319
lines changed

4 files changed

+106
-319
lines changed

connector/elasticapmconnector/config.go

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,7 @@ func (cfg Config) signaltometricsConfig() *signaltometricsconfig.Config {
166166
{Key: "metricset.name", DefaultValue: "service_destination"},
167167
}
168168

169-
// TODO switch to exponential histogram once we have optimised
170-
// exponential histogram merging.
171-
transactionDurationHistogram := &signaltometricsconfig.Histogram{
172-
Buckets: []float64{
173-
5000, 10000, 25000, 50000, 75000, 100000, 250000, 500000,
174-
750000, 1000000, 2500000, 5000000, 7500000, 10000000,
175-
},
169+
transactionDurationHistogram := &signaltometricsconfig.ExponentialHistogram{
176170
Count: "Int(AdjustedCount())",
177171
Value: "Microseconds(end_time - start_time)",
178172
}
@@ -213,8 +207,8 @@ func (cfg Config) signaltometricsConfig() *signaltometricsconfig.Config {
213207
Key: "elasticsearch.mapping.hints",
214208
DefaultValue: []any{"_doc_count"},
215209
}),
216-
Unit: "us",
217-
Histogram: transactionDurationHistogram,
210+
Unit: "us",
211+
ExponentialHistogram: transactionDurationHistogram,
218212
}, {
219213
Name: "transaction.duration.summary",
220214
Description: "APM service transaction aggregated metrics as summary",
@@ -233,8 +227,8 @@ func (cfg Config) signaltometricsConfig() *signaltometricsconfig.Config {
233227
Key: "elasticsearch.mapping.hints",
234228
DefaultValue: []any{"_doc_count"},
235229
}),
236-
Unit: "us",
237-
Histogram: transactionDurationHistogram,
230+
Unit: "us",
231+
ExponentialHistogram: transactionDurationHistogram,
238232
}, {
239233
Name: "transaction.duration.summary",
240234
Description: "APM transaction aggregated metrics as summary",
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,73 @@
11
resourceMetrics:
22
- resource:
33
attributes:
4-
- key: service.name
4+
- key: agent.name
55
value:
6-
stringValue: foo
6+
stringValue: unknown
77
- key: deployment.environment
88
value:
99
stringValue: qa
10+
- key: service.name
11+
value:
12+
stringValue: foo
1013
- key: telemetry.sdk.language
1114
value:
1215
stringValue: go
13-
- key: agent.name
14-
value:
15-
stringValue: unknown
1616
scopeMetrics:
17-
- scope:
18-
name: github.com/open-telemetry/opentelemetry-collector-contrib/connector/signaltometricsconnector
19-
metrics:
17+
- metrics:
2018
- name: service_summary
2119
sum:
2220
aggregationTemporality: 1
2321
dataPoints:
24-
- asInt: 1
22+
- asInt: "1"
2523
attributes:
2624
- key: data_stream.dataset
2725
value:
2826
stringValue: service_summary.1m
27+
- key: metricset.interval
28+
value:
29+
stringValue: 1m
2930
- key: metricset.name
3031
value:
3132
stringValue: service_summary
32-
- key: metricset.interval
33-
value:
34-
stringValue: "1m"
3533
- key: processor.event
3634
value:
3735
stringValue: metric
3836
- name: service_summary
3937
sum:
4038
aggregationTemporality: 1
4139
dataPoints:
42-
- asInt: 1
40+
- asInt: "1"
4341
attributes:
4442
- key: data_stream.dataset
4543
value:
4644
stringValue: service_summary.10m
45+
- key: metricset.interval
46+
value:
47+
stringValue: 10m
4748
- key: metricset.name
4849
value:
4950
stringValue: service_summary
50-
- key: metricset.interval
51-
value:
52-
stringValue: "10m"
5351
- key: processor.event
5452
value:
5553
stringValue: metric
5654
- name: service_summary
5755
sum:
5856
aggregationTemporality: 1
5957
dataPoints:
60-
- asInt: 1
58+
- asInt: "1"
6159
attributes:
6260
- key: data_stream.dataset
6361
value:
6462
stringValue: service_summary.60m
63+
- key: metricset.interval
64+
value:
65+
stringValue: 60m
6566
- key: metricset.name
6667
value:
6768
stringValue: service_summary
68-
- key: metricset.interval
69-
value:
70-
stringValue: "60m"
7169
- key: processor.event
7270
value:
7371
stringValue: metric
72+
scope:
73+
name: github.com/open-telemetry/opentelemetry-collector-contrib/connector/signaltometricsconnector

connector/elasticapmconnector/testdata/metrics/service_summary/aggregated_metrics.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
resourceMetrics:
22
- resource:
33
attributes:
4+
- key: agent.name
5+
value:
6+
stringValue: unknown
47
- key: deployment.environment
58
value:
69
stringValue: qa
@@ -10,9 +13,6 @@ resourceMetrics:
1013
- key: telemetry.sdk.language
1114
value:
1215
stringValue: go
13-
- key: agent.name
14-
value:
15-
stringValue: unknown
1616
scopeMetrics:
1717
- metrics:
1818
- name: service_summary

0 commit comments

Comments
 (0)