Skip to content

Commit efe481f

Browse files
committed
chore: Otel declarative config initial support
1 parent 373fa42 commit efe481f

File tree

1 file changed

+316
-0
lines changed

1 file changed

+316
-0
lines changed
Lines changed: 316 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,316 @@
1+
# sdk-migration-config.yaml is a typical starting point for configuring the SDK when migrating
2+
# from environment variable based configuration.
3+
#
4+
# This template includes env var substitution references (i.e. ${MY_ENV}) for all spec defined
5+
# env vars (https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/)
6+
# which map cleanly to declarative configuration. For example, OTEL_SDK_DISABLED is referenced
7+
# below, but OTEL_TRACES_EXPORTER is not since it does not map well to the hierarchical
8+
# structure of declarative configuration.
9+
#
10+
# NOTE: With the exception of env var substitution syntax, SDKs ignore environment variables
11+
# when interpreting config files. For example, if "disabled: ${OTEL_SDK_DISABLED:-false}"
12+
# is replaced with "disabled: false", then setting the env var OTEL_SDK_DISABLED will have
13+
# no effect. See https://opentelemetry.io/docs/specs/otel/configuration/data-model/
14+
# for more information. The following spec defined env vars are NOT referenced and are thus
15+
# ignored:
16+
#
17+
# - OTEL_TRACES_SAMPLER
18+
# - OTEL_TRACES_SAMPLER_ARG
19+
# - OTEL_EXPORTER_ZIPKIN_ENDPOINT
20+
# - OTEL_EXPORTER_ZIPKIN_TIMEOUT
21+
# - OTEL_EXPORTER_PROMETHEUS_HOST
22+
# - OTEL_EXPORTER_PROMETHEUS_PORT
23+
# - OTEL_TRACES_EXPORTER
24+
# - OTEL_METRICS_EXPORTER
25+
# - OTEL_LOGS_EXPORTER
26+
# - OTEL_EXPORTER_OTLP_PROTOCOL, OTEL_EXPORTER_OTLP_{SIGNAL}_PROTOCOL
27+
# - OTEL_EXPORTER_OTLP_ENDPOINT
28+
# - OTEL_EXPORTER_OTLP_INSECURE, OTEL_EXPORTER_OTLP_{SIGNAL}_INSECURE
29+
# - OTEL_EXPORTER_OTLP_CERTIFICATE
30+
# - OTEL_EXPORTER_OTLP_CLIENT_KEY
31+
# - OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE
32+
# - OTEL_EXPORTER_OTLP_COMPRESSION
33+
# - OTEL_EXPORTER_OTLP_TIMEOUT
34+
35+
# The file format version.
36+
# The yaml format is documented at
37+
# https://github.com/open-telemetry/opentelemetry-configuration/tree/main/schema
38+
file_format: "0.4"
39+
# Configure if the SDK is disabled or not.
40+
# If omitted or null, false is used.
41+
disabled: ${OTEL_SDK_DISABLED:-false}
42+
# Configure the log level of the internal logger used by the SDK.
43+
# If omitted, info is used.
44+
log_level: ${OTEL_LOG_LEVEL:-info}
45+
# Configure resource for all signals.
46+
# If omitted, the default resource is used.
47+
resource:
48+
# Configure resource attributes. Entries have higher priority than entries from .resource.attributes_list.
49+
# Entries must contain .name and .value, and may optionally include .type. If an entry's .type omitted or null, string is used.
50+
# The .value's type must match the .type. Values for .type include: string, bool, int, double, string_array, bool_array, int_array, double_array.
51+
attributes:
52+
- name: service.name
53+
value: ${OTEL_SERVICE_NAME:-unknown_service}
54+
# Configure resource attributes. Entries have lower priority than entries from .resource.attributes.
55+
# The value is a list of comma separated key-value pairs matching the format of OTEL_RESOURCE_ATTRIBUTES. See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk-environment-variables.md#general-sdk-configuration for details.
56+
# If omitted or null, no resource attributes are added.
57+
attributes_list: ${OTEL_RESOURCE_ATTRIBUTES}
58+
# Configure general attribute limits. See also tracer_provider.limits, logger_provider.limits.
59+
attribute_limits:
60+
# Configure max attribute value size.
61+
# Value must be non-negative.
62+
# If omitted or null, there is no limit.
63+
attribute_value_length_limit: ${OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT}
64+
# Configure max attribute count.
65+
# Value must be non-negative.
66+
# If omitted or null, 128 is used.
67+
attribute_count_limit: ${OTEL_ATTRIBUTE_COUNT_LIMIT:-128}
68+
# Configure text map context propagators.
69+
# If omitted, a noop propagator is used.
70+
propagator:
71+
# Configure the propagators in the composite text map propagator. Entries from .composite_list are appended to the list here with duplicates filtered out.
72+
# Built-in propagator keys include: tracecontext, baggage, b3, b3multi, jaeger, ottrace. Known third party keys include: xray.
73+
# If the resolved list of propagators (from .composite and .composite_list) is empty, a noop propagator is used.
74+
composite: []
75+
# Configure the propagators in the composite text map propagator. Entries are appended to .composite with duplicates filtered out.
76+
# The value is a comma separated list of propagator identifiers matching the format of OTEL_PROPAGATORS. See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk-environment-variables.md#general-sdk-configuration for details.
77+
# Built-in propagator identifiers include: tracecontext, baggage, b3, b3multi, jaeger, ottrace. Known third party identifiers include: xray.
78+
# If the resolved list of propagators (from .composite and .composite_list) is empty, a noop propagator is used.
79+
composite_list: ${OTEL_PROPAGATORS:-tracecontext,baggage}
80+
# Configure tracer provider.
81+
# If omitted, a noop tracer provider is used.
82+
tracer_provider:
83+
# Configure span processors.
84+
processors:
85+
- # Configure a batch span processor.
86+
batch:
87+
# Configure delay interval (in milliseconds) between two consecutive exports.
88+
# Value must be non-negative.
89+
# If omitted or null, 5000 is used.
90+
schedule_delay: ${OTEL_BSP_SCHEDULE_DELAY:-5000}
91+
# Configure maximum allowed time (in milliseconds) to export data.
92+
# Value must be non-negative. A value of 0 indicates no limit (infinity).
93+
# If omitted or null, 30000 is used.
94+
export_timeout: ${OTEL_BSP_EXPORT_TIMEOUT:-30000}
95+
# Configure maximum queue size. Value must be positive.
96+
# If omitted or null, 2048 is used.
97+
max_queue_size: ${OTEL_BSP_MAX_QUEUE_SIZE:-2048}
98+
# Configure maximum batch size. Value must be positive.
99+
# If omitted or null, 512 is used.
100+
max_export_batch_size: ${OTEL_BSP_MAX_EXPORT_BATCH_SIZE:-512}
101+
# Configure exporter.
102+
exporter:
103+
# Configure exporter to be OTLP with HTTP transport.
104+
otlp_http:
105+
# Configure endpoint, including the trace specific path.
106+
# If omitted or null, http://localhost:4318/v1/traces is used.
107+
endpoint: ${OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:-http://localhost:4318/v1/traces}
108+
# Configure certificate used to verify a server's TLS credentials.
109+
# Absolute path to certificate file in PEM format.
110+
# If omitted or null, system default certificate verification is used for secure connections.
111+
certificate_file: ${OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE}
112+
# Configure mTLS private client key.
113+
# Absolute path to client key file in PEM format. If set, .client_certificate must also be set.
114+
# If omitted or null, mTLS is not used.
115+
client_key_file: ${OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY}
116+
# Configure mTLS client certificate.
117+
# Absolute path to client certificate file in PEM format. If set, .client_key must also be set.
118+
# If omitted or null, mTLS is not used.
119+
client_certificate_file: ${OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE}
120+
# Configure compression.
121+
# Values include: gzip, none. Implementations may support other compression algorithms.
122+
# If omitted or null, none is used.
123+
compression: ${OTEL_EXPORTER_OTLP_TRACES_COMPRESSION:-gzip}
124+
# Configure max time (in milliseconds) to wait for each export.
125+
# Value must be non-negative. A value of 0 indicates no limit (infinity).
126+
# If omitted or null, 10000 is used.
127+
timeout: ${OTEL_EXPORTER_OTLP_TRACES_TIMEOUT:-10000}
128+
# Configure headers. Entries have higher priority than entries from .headers_list.
129+
# If an entry's .value is null, the entry is ignored.
130+
headers: []
131+
# Configure headers. Entries have lower priority than entries from .headers.
132+
# The value is a list of comma separated key-value pairs matching the format of OTEL_EXPORTER_OTLP_HEADERS. See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#configuration-options for details.
133+
# If omitted or null, no headers are added.
134+
headers_list: ${OTEL_EXPORTER_OTLP_TRACES_HEADERS}
135+
# Configure span limits. See also attribute_limits.
136+
limits:
137+
# Configure max attribute value size. Overrides .attribute_limits.attribute_value_length_limit.
138+
# Value must be non-negative.
139+
# If omitted or null, there is no limit.
140+
attribute_value_length_limit: ${OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT}
141+
# Configure max attribute count. Overrides .attribute_limits.attribute_count_limit.
142+
# Value must be non-negative.
143+
# If omitted or null, 128 is used.
144+
attribute_count_limit: ${OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT:-128}
145+
# Configure max span event count.
146+
# Value must be non-negative.
147+
# If omitted or null, 128 is used.
148+
event_count_limit: ${OTEL_SPAN_EVENT_COUNT_LIMIT:-128}
149+
# Configure max span link count.
150+
# Value must be non-negative.
151+
# If omitted or null, 128 is used.
152+
link_count_limit: ${OTEL_SPAN_LINK_COUNT_LIMIT:-128}
153+
# Configure max attributes per span event.
154+
# Value must be non-negative.
155+
# If omitted or null, 128 is used.
156+
event_attribute_count_limit: ${OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT:-128}
157+
# Configure max attributes per span link.
158+
# Value must be non-negative.
159+
# If omitted or null, 128 is used.
160+
link_attribute_count_limit: ${OTEL_LINK_ATTRIBUTE_COUNT_LIMIT:-128}
161+
# Configure the sampler.
162+
# If omitted, parent based sampler with a root of always_on is used.
163+
sampler:
164+
# Configure sampler to be parent_based.
165+
parent_based:
166+
# Configure root sampler.
167+
# If omitted or null, always_on is used.
168+
root:
169+
# Configure sampler to be always_on.
170+
always_on:
171+
# Configure remote_parent_sampled sampler.
172+
# If omitted or null, always_on is used.
173+
remote_parent_sampled:
174+
# Configure sampler to be always_on.
175+
always_on:
176+
# Configure remote_parent_not_sampled sampler.
177+
# If omitted or null, always_off is used.
178+
remote_parent_not_sampled:
179+
# Configure sampler to be always_off.
180+
always_off:
181+
# Configure local_parent_sampled sampler.
182+
# If omitted or null, always_on is used.
183+
local_parent_sampled:
184+
# Configure sampler to be always_on.
185+
always_on:
186+
# Configure local_parent_not_sampled sampler.
187+
# If omitted or null, always_off is used.
188+
local_parent_not_sampled:
189+
# Configure sampler to be always_off.
190+
always_off:
191+
192+
193+
# Configure meter provider.
194+
# If omitted, a noop meter provider is used.
195+
meter_provider:
196+
# Configure metric readers.
197+
readers:
198+
- # Configure a periodic metric reader.
199+
periodic:
200+
# Configure delay interval (in milliseconds) between start of two consecutive exports.
201+
# Value must be non-negative.
202+
# If omitted or null, 60000 is used.
203+
interval: ${OTEL_METRIC_EXPORT_INTERVAL:-60000}
204+
# Configure maximum allowed time (in milliseconds) to export data.
205+
# Value must be non-negative. A value of 0 indicates no limit (infinity).
206+
# If omitted or null, 30000 is used.
207+
timeout: ${OTEL_METRIC_EXPORT_TIMEOUT:-30000}
208+
# Configure exporter.
209+
exporter:
210+
# Configure exporter to be OTLP with HTTP transport.
211+
otlp_http:
212+
# Configure endpoint, including the metric specific path.
213+
# If omitted or null, http://localhost:4318/v1/metrics is used.
214+
endpoint: ${OTEL_EXPORTER_OTLP_METRICS_ENDPOINT:-http://localhost:4318/v1/metrics}
215+
# Configure certificate used to verify a server's TLS credentials.
216+
# Absolute path to certificate file in PEM format.
217+
# If omitted or null, system default certificate verification is used for secure connections.
218+
certificate_file: ${OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE}
219+
# Configure mTLS private client key.
220+
# Absolute path to client key file in PEM format. If set, .client_certificate must also be set.
221+
# If omitted or null, mTLS is not used.
222+
client_key_file: ${OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY}
223+
# Configure mTLS client certificate.
224+
# Absolute path to client certificate file in PEM format. If set, .client_key must also be set.
225+
# If omitted or null, mTLS is not used.
226+
client_certificate_file: ${OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE}
227+
# Configure compression.
228+
# Values include: gzip, none. Implementations may support other compression algorithms.
229+
# If omitted or null, none is used.
230+
compression: ${OTEL_EXPORTER_OTLP_METRICS_COMPRESSION:-gzip}
231+
# Configure max time (in milliseconds) to wait for each export.
232+
# Value must be non-negative. A value of 0 indicates no limit (infinity).
233+
# If omitted or null, 10000 is used.
234+
timeout: ${OTEL_EXPORTER_OTLP_METRICS_TIMEOUT:-10000}
235+
# Configure headers. Entries have higher priority than entries from .headers_list.
236+
# If an entry's .value is null, the entry is ignored.
237+
headers: []
238+
# Configure headers. Entries have lower priority than entries from .headers.
239+
# The value is a list of comma separated key-value pairs matching the format of OTEL_EXPORTER_OTLP_HEADERS. See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#configuration-options for details.
240+
# If omitted or null, no headers are added.
241+
headers_list: ${OTEL_EXPORTER_OTLP_METRICS_HEADERS}
242+
# Configure temporality preference.
243+
# Values include: cumulative, delta, low_memory. For behavior of values, see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk_exporters/otlp.md.
244+
# If omitted or null, cumulative is used.
245+
temporality_preference: ${OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE:-cumulative}
246+
# Configure default histogram aggregation.
247+
# Values include: explicit_bucket_histogram, base2_exponential_bucket_histogram. For behavior of values, see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk_exporters/otlp.md.
248+
# If omitted or null, explicit_bucket_histogram is used.
249+
default_histogram_aggregation: ${OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION:-explicit_bucket_histogram}
250+
# Configure the exemplar filter.
251+
# Values include: trace_based, always_on, always_off. For behavior of values see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk-environment-variables.md#metrics-sdk-configuration.
252+
# If omitted or null, trace_based is used.
253+
exemplar_filter: ${OTEL_METRICS_EXEMPLAR_FILTER:-trace_based}
254+
# Configure logger provider.
255+
# If omitted, a noop logger provider is used.
256+
logger_provider:
257+
# Configure log record processors.
258+
processors:
259+
- # Configure a batch log record processor.
260+
batch:
261+
# Configure delay interval (in milliseconds) between two consecutive exports.
262+
# Value must be non-negative.
263+
# If omitted or null, 1000 is used.
264+
schedule_delay: ${OTEL_BLRP_SCHEDULE_DELAY:-1000}
265+
# Configure maximum allowed time (in milliseconds) to export data.
266+
# Value must be non-negative. A value of 0 indicates no limit (infinity).
267+
# If omitted or null, 30000 is used.
268+
export_timeout: ${OTEL_BLRP_EXPORT_TIMEOUT:-30000}
269+
# Configure maximum queue size. Value must be positive.
270+
# If omitted or null, 2048 is used.
271+
max_queue_size: ${OTEL_BLRP_MAX_QUEUE_SIZE:-2048}
272+
# Configure maximum batch size. Value must be positive.
273+
# If omitted or null, 512 is used.
274+
max_export_batch_size: ${OTEL_BLRP_MAX_EXPORT_BATCH_SIZE:-512}
275+
# Configure exporter.
276+
exporter:
277+
# Configure exporter to be OTLP with HTTP transport.
278+
otlp_http:
279+
endpoint: ${OTEL_EXPORTER_OTLP_LOGS_ENDPOINT:-http://localhost:4318/v1/logs}
280+
# Configure certificate used to verify a server's TLS credentials.
281+
# Absolute path to certificate file in PEM format.
282+
# If omitted or null, system default certificate verification is used for secure connections.
283+
certificate_file: ${OTEL_EXPORTER_OTLP_LOGS_CERTIFICATE}
284+
# Configure mTLS private client key.
285+
# Absolute path to client key file in PEM format. If set, .client_certificate must also be set.
286+
# If omitted or null, mTLS is not used.
287+
client_key_file: ${OTEL_EXPORTER_OTLP_LOGS_CLIENT_KEY}
288+
# Configure mTLS client certificate.
289+
# Absolute path to client certificate file in PEM format. If set, .client_key must also be set.
290+
# If omitted or null, mTLS is not used.
291+
client_certificate_file: ${OTEL_EXPORTER_OTLP_LOGS_CLIENT_CERTIFICATE}
292+
# Configure compression.
293+
# Values include: gzip, none. Implementations may support other compression algorithms.
294+
# If omitted or null, none is used.
295+
compression: ${OTEL_EXPORTER_OTLP_LOGS_COMPRESSION:-gzip}
296+
# Configure max time (in milliseconds) to wait for each export.
297+
# Value must be non-negative. A value of 0 indicates no limit (infinity).
298+
# If omitted or null, 10000 is used.
299+
timeout: ${OTEL_EXPORTER_OTLP_LOGS_TIMEOUT:-10000}
300+
# Configure headers. Entries have higher priority than entries from .headers_list.
301+
# If an entry's .value is null, the entry is ignored.
302+
headers: []
303+
# Configure headers. Entries have lower priority than entries from .headers.
304+
# The value is a list of comma separated key-value pairs matching the format of OTEL_EXPORTER_OTLP_HEADERS. See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#configuration-options for details.
305+
# If omitted or null, no headers are added.
306+
headers_list: ${OTEL_EXPORTER_OTLP_LOGS_HEADERS}
307+
# Configure log record limits. See also attribute_limits.
308+
limits:
309+
# Configure max attribute value size. Overrides .attribute_limits.attribute_value_length_limit.
310+
# Value must be non-negative.
311+
# If omitted or null, there is no limit.
312+
attribute_value_length_limit: ${OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT}
313+
# Configure max attribute count. Overrides .attribute_limits.attribute_count_limit.
314+
# Value must be non-negative.
315+
# If omitted or null, 128 is used.
316+
attribute_count_limit: ${OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT:-128}

0 commit comments

Comments
 (0)