Skip to content

Commit 4590a88

Browse files
authored
feat: add exporterhelper profiles telemetry metrics (#14423)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description This adds obs metrics to the profiles exporters using `exporterhelper` package. This will be used by the profiles xexporterhelper initialization: https://github.com/open-telemetry/opentelemetry-collector/blob/main/exporter/exporterhelper/xexporterhelper/profiles.go#L189 Follow-up PR of #14226
1 parent fc5681a commit 4590a88

File tree

15 files changed

+347
-20
lines changed

15 files changed

+347
-20
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: enhancement
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. receiver/otlp)
7+
component: pkg/exporterhelper
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Add support for profile samples metrics
11+
12+
# One or more tracking issues or pull requests related to the change
13+
issues: [14423]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# Optional: The change log or logs in which this entry should be included.
21+
# e.g. '[user]' or '[user, api]'
22+
# Include 'user' if the change is relevant to end users.
23+
# Include 'api' if there is a change to a library API.
24+
# Default: '[user]'
25+
change_logs: [api]

exporter/exporterhelper/documentation.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ Number of metric points failed to be added to the sending queue. [Alpha]
2222
| ---- | ----------- | ---------- | --------- | --------- |
2323
| {datapoints} | Sum | Int | true | Alpha |
2424

25+
### otelcol_exporter_enqueue_failed_profile_samples
26+
27+
Number of profile samples failed to be added to the sending queue. [Development]
28+
29+
| Unit | Metric Type | Value Type | Monotonic | Stability |
30+
| ---- | ----------- | ---------- | --------- | --------- |
31+
| {samples} | Sum | Int | true | Development |
32+
2533
### otelcol_exporter_enqueue_failed_spans
2634

2735
Number of spans failed to be added to the sending queue. [Alpha]
@@ -78,6 +86,14 @@ Number of metric points in failed attempts to send to destination. [Alpha]
7886
| ---- | ----------- | ---------- | --------- | --------- |
7987
| {datapoints} | Sum | Int | true | Alpha |
8088

89+
### otelcol_exporter_send_failed_profile_samples
90+
91+
Number of profile samples in failed attempts to send to destination. [Development]
92+
93+
| Unit | Metric Type | Value Type | Monotonic | Stability |
94+
| ---- | ----------- | ---------- | --------- | --------- |
95+
| {samples} | Sum | Int | true | Development |
96+
8197
### otelcol_exporter_send_failed_spans
8298

8399
Number of spans in failed attempts to send to destination. [Alpha]
@@ -102,6 +118,14 @@ Number of metric points successfully sent to destination. [Alpha]
102118
| ---- | ----------- | ---------- | --------- | --------- |
103119
| {datapoints} | Sum | Int | true | Alpha |
104120

121+
### otelcol_exporter_sent_profile_samples
122+
123+
Number of profile samples successfully sent to destination. [Development]
124+
125+
| Unit | Metric Type | Value Type | Monotonic | Stability |
126+
| ---- | ----------- | ---------- | --------- | --------- |
127+
| {samples} | Sum | Int | true | Development |
128+
105129
### otelcol_exporter_sent_spans
106130

107131
Number of spans successfully sent to destination. [Alpha]

exporter/exporterhelper/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ require (
2626
go.opentelemetry.io/collector/pdata/testdata v0.143.0
2727
go.opentelemetry.io/collector/pdata/xpdata v0.143.0
2828
go.opentelemetry.io/collector/pipeline v1.49.0
29+
go.opentelemetry.io/collector/pipeline/xpipeline v0.143.0
2930
go.opentelemetry.io/otel v1.39.0
3031
go.opentelemetry.io/otel/metric v1.39.0
3132
go.opentelemetry.io/otel/sdk v1.39.0
@@ -125,3 +126,5 @@ replace go.opentelemetry.io/collector/confmap/xconfmap => ../../confmap/xconfmap
125126
replace go.opentelemetry.io/collector/internal/testutil => ../../internal/testutil
126127

127128
replace go.opentelemetry.io/collector/internal/componentalias => ../../internal/componentalias
129+
130+
replace go.opentelemetry.io/collector/pipeline/xpipeline => ../../pipeline/xpipeline

exporter/exporterhelper/internal/metadata/generated_telemetry.go

Lines changed: 37 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

exporter/exporterhelper/internal/metadatatest/generated_telemetrytest.go

Lines changed: 48 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

exporter/exporterhelper/internal/metadatatest/generated_telemetrytest_test.go

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

exporter/exporterhelper/internal/obs_report_sender.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"go.opentelemetry.io/collector/exporter/exporterhelper/internal/request"
1919
"go.opentelemetry.io/collector/exporter/exporterhelper/internal/sender"
2020
"go.opentelemetry.io/collector/pipeline"
21+
"go.opentelemetry.io/collector/pipeline/xpipeline"
2122
)
2223

2324
const (
@@ -78,6 +79,9 @@ func newObsReportSender[K request.Request](set exporter.Settings, signal pipelin
7879
case pipeline.SignalLogs:
7980
or.itemsSentInst = telemetryBuilder.ExporterSentLogRecords
8081
or.itemsFailedInst = telemetryBuilder.ExporterSendFailedLogRecords
82+
case xpipeline.SignalProfiles:
83+
or.itemsSentInst = telemetryBuilder.ExporterSentProfileSamples
84+
or.itemsFailedInst = telemetryBuilder.ExporterSendFailedProfileSamples
8185
}
8286

8387
return or, nil
@@ -105,14 +109,13 @@ func (ors *obsReportSender[K]) startOp(ctx context.Context) context.Context {
105109
}
106110

107111
// EndOp completes the export operation that was started with StartOp.
108-
func (ors *obsReportSender[K]) endOp(ctx context.Context, numLogRecords int, err error) {
109-
numSent, numFailedToSend := toNumItems(numLogRecords, err)
112+
func (ors *obsReportSender[K]) endOp(ctx context.Context, numRecords int, err error) {
113+
numSent, numFailedToSend := toNumItems(numRecords, err)
110114

111-
// No metrics recorded for profiles.
112115
if ors.itemsSentInst != nil {
113116
ors.itemsSentInst.Add(ctx, numSent, ors.metricAttr)
114117
}
115-
// No metrics recorded for profiles.
118+
116119
if ors.itemsFailedInst != nil {
117120
ors.itemsFailedInst.Add(ctx, numFailedToSend, ors.metricAttr)
118121
}

0 commit comments

Comments
 (0)