Skip to content

Commit 41d0464

Browse files
rmfitzpatrickjeffreyc-splunk
authored andcommitted
Use internal pipelines for collector prometheus metrics (#469)
1 parent f68b14d commit 41d0464

File tree

4 files changed

+51
-10
lines changed

4 files changed

+51
-10
lines changed

cmd/otelcol/config/collector/agent_config.yaml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ receivers:
6565
endpoint: 0.0.0.0:55681
6666
# This section is used to collect the OpenTelemetry Collector metrics
6767
# Even if just a Splunk APM customer, these metrics are included
68-
prometheus:
68+
prometheus/internal:
6969
config:
7070
scrape_configs:
7171
- job_name: 'otel-collector'
@@ -100,12 +100,17 @@ processors:
100100
ballast_size_mib: ${SPLUNK_BALLAST_SIZE_MIB}
101101
check_interval: 2s
102102
limit_mib: ${SPLUNK_MEMORY_LIMIT_MIB}
103-
## detect if the collector is running on a cloud system
104-
## important for creating unique cloud provider dimensions
103+
# detect if the collector is running on a cloud system
104+
# important for creating unique cloud provider dimensions
105105
resourcedetection:
106106
detectors: [system, gce, ecs, ec2, azure]
107107
override: false
108108

109+
# Same as above but overrides resource attributes set by receivers
110+
resourcedetection/internal:
111+
detectors: [system, gce, ecs, ec2, azure]
112+
override: true
113+
109114
# Optional: The following processor can be used to add a default "deployment.environment" attribute to the logs and
110115
# traces when it's not populated by instrumentation libraries.
111116
# If enabled, make sure to enable this processor in the pipeline below.
@@ -157,11 +162,17 @@ service:
157162
# Use instead when sending to gateway
158163
#exporters: [otlp, signalfx]
159164
metrics:
160-
receivers: [hostmetrics, otlp, prometheus, signalfx, smartagent/signalfx-forwarder]
165+
receivers: [hostmetrics, otlp, signalfx, smartagent/signalfx-forwarder]
161166
processors: [memory_limiter, batch, resourcedetection]
162167
exporters: [signalfx]
163168
# Use instead when sending to gateway
164169
#exporters: [otlp]
170+
metrics/internal:
171+
receivers: [prometheus/internal]
172+
processors: [memory_limiter, batch, resourcedetection/internal]
173+
exporters: [signalfx]
174+
# Use instead when sending to gateway
175+
#exporters: [otlp]
165176
logs/signalfx:
166177
receivers: [signalfx]
167178
processors: [memory_limiter, batch]

cmd/otelcol/config/collector/full_config_linux.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ receivers:
127127
# Enables the prometheus receiver -- should only be used for local metric collection
128128
# This section is used to collect the OpenTelemetry Collector metrics
129129
# Even if just a Splunk APM customer, these metrics are included
130-
prometheus:
130+
prometheus/internal:
131131
config:
132132
scrape_configs:
133133
- job_name: 'otel-collector'
@@ -209,6 +209,12 @@ processors:
209209
# # determines if existing resource attributes should be overridden or preserved, defaults to true
210210
#override: <bool>
211211

212+
# detect if the collector is running on a cloud system.
213+
# overrides resource attributes set by receivers
214+
resourcedetection/internal:
215+
detectors: [system, gce, ecs, ec2, azure]
216+
override: true
217+
212218
# Enables the memory limiter processor with default settings
213219
# Full configuration here: https://github.com/open-telemetry/opentelemetry-collector/tree/main/processor/memorylimiter
214220
# Enabling the memory_limiter is strongly recommended for every pipeline.
@@ -554,9 +560,13 @@ service:
554560
#- resource/add_environment
555561
exporters: [sapm, signalfx]
556562
metrics:
557-
receivers: [otlp, prometheus, signalfx, smartagent/signalfx-forwarder]
563+
receivers: [otlp, signalfx, smartagent/signalfx-forwarder]
558564
processors: [memory_limiter, batch]
559565
exporters: [signalfx]
566+
metrics/internal:
567+
receivers: [prometheus/internal]
568+
processors: [memory_limiter, batch, resourcedetection/internal]
569+
exporters: [signalfx]
560570
logs:
561571
receivers: [signalfx]
562572
processors: [memory_limiter, batch]

cmd/otelcol/config/collector/gateway_config.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ receivers:
3131
endpoint: 0.0.0.0:55681
3232
# This section is used to collect the OpenTelemetry Collector metrics
3333
# Even if just a Splunk APM customer, these metrics are included
34-
prometheus:
34+
prometheus/internal:
3535
config:
3636
scrape_configs:
3737
- job_name: 'otel-collector'
@@ -73,6 +73,12 @@ processors:
7373
#value: staging/production/...
7474
#key: deployment.environment
7575

76+
# detect if the collector is running on a cloud system.
77+
# overrides resource attributes set by receivers
78+
resourcedetection/internal:
79+
detectors: [system, gce, ecs, ec2, azure]
80+
override: true
81+
7682
exporters:
7783
# Traces
7884
sapm:
@@ -101,9 +107,13 @@ service:
101107
#- resource/add_environment
102108
exporters: [sapm, signalfx]
103109
metrics:
104-
receivers: [otlp, signalfx, prometheus]
110+
receivers: [otlp, signalfx]
105111
processors: [memory_limiter, batch]
106112
exporters: [signalfx]
113+
metrics/internal:
114+
receivers: [prometheus/internal]
115+
processors: [memory_limiter, batch, resourcedetection/internal]
116+
exporters: [signalfx]
107117
logs:
108118
receivers: [signalfx]
109119
processors: [memory_limiter, batch]

cmd/otelcol/config/collector/otlp_config_linux.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ receivers:
2020
endpoint: 0.0.0.0:55681
2121
# This section is used to collect the OpenTelemetry Collector metrics
2222
# Even if just a Splunk APM customer, these metrics are included
23-
prometheus:
23+
prometheus/internal:
2424
config:
2525
scrape_configs:
2626
- job_name: 'otel-collector'
@@ -65,6 +65,12 @@ processors:
6565
#value: staging/production/...
6666
#key: deployment.environment
6767

68+
# detect if the collector is running on a cloud system.
69+
# overrides resource attributes set by receivers
70+
resourcedetection/internal:
71+
detectors: [system, gce, ecs, ec2, azure]
72+
override: true
73+
6874
exporters:
6975
# Traces
7076
otlphttp:
@@ -102,9 +108,13 @@ service:
102108
#- resource/add_environment
103109
exporters: [otlphttp, signalfx]
104110
metrics:
105-
receivers: [otlp, prometheus, signalfx, smartagent/signalfx-forwarder]
111+
receivers: [otlp, signalfx, smartagent/signalfx-forwarder]
106112
processors: [memory_limiter, batch]
107113
exporters: [signalfx]
114+
metrics/internal:
115+
receivers: [prometheus/internal]
116+
processors: [memory_limiter, batch, resourcedetection/internal]
117+
exporters: [signalfx]
108118
logs:
109119
receivers: [signalfx]
110120
processors: [memory_limiter, batch]

0 commit comments

Comments
 (0)