From 0ce74d2fc9f24291511375ca37eaf980c3b209c1 Mon Sep 17 00:00:00 2001 From: cleverchuk Date: Mon, 2 Nov 2026 13:43:12 -0500 Subject: [PATCH 1/4] Internal - Add kitchen sink sdk config example and trim root sdk config to minimum required --- custom/src/test/resources/sdk-config.yaml | 4 - .../MetricExporterComponentProvider.java | 6 + .../MetricExporterComponentProviderTest.java | 33 ++ .../shared/src/test/resources/sdk-config.yaml | 4 - sdk-config-kitchen-sink.yaml | 327 ++++++++++++++++++ sdk-config.yaml | 82 +++-- smoke-tests/sdk-config.yaml | 4 - 7 files changed, 415 insertions(+), 45 deletions(-) create mode 100644 sdk-config-kitchen-sink.yaml diff --git a/custom/src/test/resources/sdk-config.yaml b/custom/src/test/resources/sdk-config.yaml index d782c844..0570cdb4 100644 --- a/custom/src/test/resources/sdk-config.yaml +++ b/custom/src/test/resources/sdk-config.yaml @@ -100,10 +100,6 @@ meter_provider: timeout: 10000 # Configure headers. Entries have higher priority than entries from .headers_list. headers_list: ${OTEL_EXPORTER_OTLP_HEADERS} - # Configure temporality preference. - temporality_preference: cumulative - # Configure default histogram aggregation. - default_histogram_aggregation: explicit_bucket_histogram # Configure logger provider. logger_provider: diff --git a/libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/provider/MetricExporterComponentProvider.java b/libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/provider/MetricExporterComponentProvider.java index a3efba79..52fe8982 100644 --- a/libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/provider/MetricExporterComponentProvider.java +++ b/libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/provider/MetricExporterComponentProvider.java @@ -29,7 +29,10 @@ import io.opentelemetry.exporter.otlp.internal.OtlpDeclarativeConfigUtil; import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider; import io.opentelemetry.sdk.common.export.ProxyOptions; +import io.opentelemetry.sdk.metrics.Aggregation; +import io.opentelemetry.sdk.metrics.InstrumentType; import io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector; +import io.opentelemetry.sdk.metrics.export.DefaultAggregationSelector; import io.opentelemetry.sdk.metrics.export.MetricExporter; import java.net.InetSocketAddress; @@ -69,6 +72,9 @@ public MetricExporter create(DeclarativeConfigProperties config) { () -> builder.setMeterProvider(MeterProvider::noop)); builder.setAggregationTemporalitySelector(AggregationTemporalitySelector.deltaPreferred()); + builder.setDefaultAggregationSelector( + DefaultAggregationSelector.getDefault() + .with(InstrumentType.HISTOGRAM, Aggregation.base2ExponentialBucketHistogram())); ProxyConfig proxyConfig = ProxyHelper.toProxyConfig(config); if (proxyConfig != null) { diff --git a/libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/config/provider/MetricExporterComponentProviderTest.java b/libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/config/provider/MetricExporterComponentProviderTest.java index 707977fd..f7847c79 100644 --- a/libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/config/provider/MetricExporterComponentProviderTest.java +++ b/libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/config/provider/MetricExporterComponentProviderTest.java @@ -23,6 +23,9 @@ import com.solarwinds.opentelemetry.extensions.DelegatingMetricExporter; import io.opentelemetry.api.incubator.config.DeclarativeConfigProperties; +import io.opentelemetry.sdk.metrics.Aggregation; +import io.opentelemetry.sdk.metrics.InstrumentType; +import io.opentelemetry.sdk.metrics.data.AggregationTemporality; import io.opentelemetry.sdk.metrics.export.MetricExporter; import java.util.ArrayList; import java.util.List; @@ -70,6 +73,36 @@ void testCreateWithDefaults() { assertEquals(true, arguments.get(1)); } + @Test + void testCreateUsesDeltaTemporalityAndBase2ExponentialHistogram() { + assertDeltaAndBase2( + createAndCaptureArguments("swo_otlp:\n endpoint: https://localhost:4318/v1/metrics\n")); + } + + @Test + void testCreateIgnoresConfiguredTemporalityAndHistogramAggregation() { + assertDeltaAndBase2( + createAndCaptureArguments( + "swo_otlp:\n" + + " endpoint: https://localhost:4318/v1/metrics\n" + + " temporality_preference: cumulative\n" + + " default_histogram_aggregation: explicit_bucket_histogram\n")); + } + + private static void assertDeltaAndBase2(List arguments) { + MetricExporter delegate = (MetricExporter) arguments.get(0); + + assertEquals( + AggregationTemporality.DELTA, delegate.getAggregationTemporality(InstrumentType.COUNTER)); + + assertEquals( + AggregationTemporality.DELTA, delegate.getAggregationTemporality(InstrumentType.HISTOGRAM)); + + assertEquals( + Aggregation.base2ExponentialBucketHistogram().toString(), + delegate.getDefaultAggregation(InstrumentType.HISTOGRAM).toString()); + } + private List createAndCaptureArguments(String yaml) { DeclarativeConfigProperties config = exporterConfig(yaml); List> arguments = new ArrayList<>(); diff --git a/libs/shared/src/test/resources/sdk-config.yaml b/libs/shared/src/test/resources/sdk-config.yaml index 37269c20..efad65ff 100644 --- a/libs/shared/src/test/resources/sdk-config.yaml +++ b/libs/shared/src/test/resources/sdk-config.yaml @@ -105,10 +105,6 @@ meter_provider: timeout: 10000 # Configure headers. Entries have higher priority than entries from .headers_list. headers_list: ${OTEL_EXPORTER_OTLP_HEADERS} - # Configure temporality preference. - temporality_preference: cumulative - # Configure default histogram aggregation. - default_histogram_aggregation: explicit_bucket_histogram # Configure logger provider. logger_provider: diff --git a/sdk-config-kitchen-sink.yaml b/sdk-config-kitchen-sink.yaml new file mode 100644 index 00000000..a705c9fc --- /dev/null +++ b/sdk-config-kitchen-sink.yaml @@ -0,0 +1,327 @@ +# sdk-config-kitchen-sink.yaml lists every option supported by the SolarWinds components of our custom distribution, +# alongside the commonly used upstream options. Values shown are either defaults or illustrative examples. +# See sdk-config.yaml for the minimum required configuration. +# +# Each option is marked Required, Recommended or Optional. Recommended options are optional but should be set. +# An Optional section's children are only evaluated when the section is present, and a Required child of an +# Optional section is only required when that section is used. + +# NOTE: With the exception of env var substitution syntax (i.e. ${MY_ENV}), SDKs ignore +# environment variables when interpreting config files. This including ignoring all env +# vars defined in https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/. + +# Required. The file format version. +file_format: "1.1" + +# Optional. Configure if the SDK is disabled or not. Defaults to false. +disabled: false + +# Optional. Configure resource for all signals. +resource: + # Optional. Entries must contain .name and .value, and may optionally include .type, which defaults to "string". + # Values for .type include: string, bool, int, double, string_array, bool_array, int_array, double_array. + attributes: + - name: service.name + value: my-service + - name: deployment.environment.name + value: production + # Optional. SolarWinds detectors are listed first so upstream detectors can override their attributes. + detection/development: + detectors: + # Optional. Adds the APM module and distribution version attributes. + - swo_apm: + # Optional. Adds the UAMS client id attributes. Use when the UAMS host agent is installed. + - swo_uams: + # Optional. Adds kubernetes attributes. Use when running in kubernetes. + - swo_k8s: + # Optional. Overrides the auto-detected namespace. + namespace: my-namespace + # Optional. Overrides the auto-detected pod uid. + pod_uid: 00000000-0000-0000-0000-000000000000 + # Optional. Overrides the auto-detected pod name. + pod_name: my-pod + # Recommended. Adds service.instance.id, and service.name from OTEL_SERVICE_NAME. + - service: + # Recommended. Adds host.name, host.arch and os attributes. + - host: + # Optional. Adds container.id. + - container: + # Recommended. Adds process.pid, process.executable.path and Java runtime attributes. + - process: + +# Optional. SolarWinds distribution settings. +distribution: + solarwinds: + # Optional. Agent logging. + logging: + # Optional. One of: off, fatal, error, warn, info, debug, trace. Defaults to info. + level: info + # Optional. Defaults to true. + stdout: true + # Optional. Defaults to true. + stderr: true + # Optional. Log to a rotating file in addition to stdout/stderr. + file: + # Required. + location: /var/log/solarwinds-apm/agent.log + # Optional. Max file size in MB before rotation. Defaults to 10. + maxSize: 10 + # Optional. Number of rotated files to keep. Defaults to 5. + maxBackup: 5 + +# Optional. Configure attribute limits for all signals. +attribute_limits: + # Optional. Defaults to no limit. + attribute_value_length_limit: 4096 + # Optional. Defaults to 128. + attribute_count_limit: 128 + +# Required. Configure text map context propagators. +propagator: + composite: + # Required. + - tracecontext: + # Optional. + - baggage: + # Required. Needed for distributed tracing with other SolarWinds instrumented services. + - swo_tracestate: + # Required. Needed for trigger trace (X-Trace-Options) support. + - swo_xtraceoptions: + +# Required. Configure tracer provider. +tracer_provider: + # Required. + processors: + # Optional. Captures stacktraces for spans that last at least min_duration and carry any of the selector + # attributes. db.system is always a selector. + - swo_stacktrace: + # Optional. Milliseconds. A negative value disables the processor. Defaults to 5. + min_duration: 5 + # Optional. Span attribute keys that trigger capture. + selectors: + - http.request.method + # Optional. Setting a filter class name delegates to the upstream stacktrace processor and ignores selectors. + # filter: com.example.MyStacktraceFilter + + # Required. Records response time metrics and transaction names for SolarWinds APM. + - swo_response_time: + # Optional. Forces a single transaction name for all spans. + transaction_name: my-transaction + # Optional. Evaluated in order; the first scheme that yields a name wins. + transaction_name_schemes: + # Required. + - scheme: spanAttribute + # Required. + delimiter: ":" + # Required. Span attribute values joined with the delimiter. + attributes: + - HandlerName + - http.request.method + + # Optional. Code profiler. service_key, collector and proxy here are also used by the agent's gRPC client. + - swo_profiler: + # Optional. Defaults to false. + enabled: true + # Required when enabled. Format: : + service_key: ${SW_APM_SERVICE_KEY} + # Optional. Set to your data center's collector. + collector: apm.collector.na-01.cloud.solarwinds.com + # Optional. Both host and port (1-65535) are required, otherwise the proxy is ignored. + proxy: + host: proxy.example.com + port: 8080 + # Optional. Sampling interval in milliseconds. Must be >= 10, or 0 for standby. Defaults to 20. + interval: 20 + # Optional. Defaults to 100. + circuit_breaker_duration_threshold: 100 + # Optional. Defaults to 2. + circuit_breaker_count_threshold: 2 + # Optional. Package prefixes excluded from profiles. Defaults to the list below. + exclude_packages: + - java + - javax + - com.sun + - sun + - sunw + + # Required. Exports spans. + - batch: + # Optional. Milliseconds. Defaults to 5000. + schedule_delay: 5000 + # Optional. Milliseconds. Defaults to 30000. + export_timeout: 30000 + # Optional. Defaults to 2048. + max_queue_size: 2048 + # Optional. Defaults to 512. + max_export_batch_size: 512 + # Required. + exporter: + # Use otlp_http unless you need a proxy. swo_otlp is OTLP/HTTP with proxy support. + swo_otlp: + # Required. Set to your data center's endpoint. + endpoint: https://otel.collector.na-01.cloud.solarwinds.com/v1/traces + # Required. Entries have higher priority than entries from headers_list. + headers: + - name: authorization + value: Bearer ${SW_APM_API_TOKEN} + # Optional. Comma separated key=value pairs. + headers_list: ${OTEL_EXPORTER_OTLP_HEADERS:-} + # Recommended. One of: gzip, none. Defaults to none. + compression: gzip + # Optional. Milliseconds. Defaults to 10000. + timeout: 10000 + # Optional. PEM files used for TLS and mTLS. The files must exist. + # tls: + # ca_file: /path/to/ca.pem + # key_file: /path/to/client-key.pem + # cert_file: /path/to/client-cert.pem + # Optional. Both host and port (1-65535) are required, otherwise the proxy is ignored. + proxy: + host: proxy.example.com + port: 8080 + + # Required. + sampler: + # Required. Fetches sampling settings from the SolarWinds collector. + swo_http: + # Required. Format: : + service_key: ${SW_APM_SERVICE_KEY} + # Required. Set to your data center's collector. Falls back to apm.collector.na-01.cloud.solarwinds.com. + collector: apm.collector.na-01.cloud.solarwinds.com + # Optional. Both host and port (1-65535) are required, otherwise the proxy is ignored. + proxy: + host: proxy.example.com + port: 8080 + # Optional. Overrides the tracing mode from the collector when set. + tracing_enabled: true + # Optional. Defaults to true. + trigger_trace_enabled: true + # Optional. Positive integer that overrides the collector supplied limit. + context_ttl: 600 + # Optional. Positive integer that overrides the collector supplied limit. + context_max_events: 100000 + # Optional. Positive integer that overrides the collector supplied limit. + context_max_backtraces: 1000 + # Optional. Each entry needs tracing (enabled|disabled) and exactly one of regex or extensions. + transaction_settings: + - regex: ".*/healthcheck" + tracing: disabled + - extensions: + - png + - css + - js + tracing: disabled + # Optional. Legacy alternative to transaction_settings and ignored when transaction_settings is defined. + # Each entry maps a url regex to a sample_rate (out of 1000000) and/or tracing_enabled. + # url_sample_rates: + # - ".*/greet": + # sample_rate: 1000000 + # tracing_enabled: true + + # AWS Lambda only, in place of swo_http: reads sampling settings from a file. Supports the same options as + # swo_http except service_key, collector, proxy and context_*. + # swo_json: + # # Optional. Defaults to /tmp/solarwinds-apm-settings.json. + # file: /tmp/solarwinds-apm-settings.json + +# Required. Configure meter provider. +meter_provider: + # Required. + readers: + - periodic: + # Optional. Milliseconds. Defaults to 60000. + interval: 60000 + # Optional. Milliseconds. Defaults to 30000. + timeout: 30000 + # Required. + exporter: + # Recommended over otlp_http. swo_otlp is OTLP/HTTP with proxy support and resets transaction names after + # each export. Without the reset, transaction names beyond the first 200 are reported as "other". + # swo_otlp always uses delta temporality and base2 exponential histograms; temporality_preference and + # default_histogram_aggregation are ignored. + swo_otlp: + # Required. Set to your data center's endpoint. + endpoint: https://otel.collector.na-01.cloud.solarwinds.com/v1/metrics + # Required. + headers: + - name: authorization + value: Bearer ${SW_APM_API_TOKEN} + # Optional. + headers_list: ${OTEL_EXPORTER_OTLP_HEADERS:-} + # Recommended. Defaults to none. + compression: gzip + # Optional. Milliseconds. Defaults to 10000. + timeout: 10000 + # Optional. + # tls: + # ca_file: /path/to/ca.pem + # key_file: /path/to/client-key.pem + # cert_file: /path/to/client-cert.pem + # Optional. + proxy: + host: proxy.example.com + port: 8080 + # Optional. Set to false to export only SolarWinds metrics (sampling and request metrics). Defaults to true. + metric_export_enabled: true + +# Optional. Configure logger provider. Remove to disable log export. +logger_provider: + # Required. + processors: + - batch: + # Optional. Milliseconds. Defaults to 1000. + schedule_delay: 1000 + # Optional. Milliseconds. Defaults to 30000. + export_timeout: 30000 + # Optional. Defaults to 2048. + max_queue_size: 2048 + # Optional. Defaults to 512. + max_export_batch_size: 512 + # Required. + exporter: + # Use otlp_http unless you need a proxy. swo_otlp is OTLP/HTTP with proxy support. + swo_otlp: + # Required. Set to your data center's endpoint. + endpoint: https://otel.collector.na-01.cloud.solarwinds.com/v1/logs + # Required. + headers: + - name: authorization + value: Bearer ${SW_APM_API_TOKEN} + # Optional. + headers_list: ${OTEL_EXPORTER_OTLP_HEADERS:-} + # Recommended. Defaults to none. + compression: gzip + # Optional. Milliseconds. Defaults to 10000. + timeout: 10000 + # Optional. + # tls: + # ca_file: /path/to/ca.pem + # key_file: /path/to/client-key.pem + # cert_file: /path/to/client-cert.pem + # Optional. + proxy: + host: proxy.example.com + port: 8080 + +# Optional. Instrumentation settings. +instrumentation/development: + java: + common: + # Optional. Defaults to true. + default-enabled: true + # Recommended. JVM runtime metrics. + runtime_telemetry: + # Recommended. Adds JFR based runtime metrics. Defaults to false. + emit_experimental_jfr_metrics/development: true + # Optional. SQL tagging adds trace context comments to JDBC statements. + swo_jdbc: + # Optional. Defaults to false. + sql_tag: true + # Optional. Defaults to false. + sql_tag_prepared: true + # Optional. Databases to tag. Defaults to mysql. + sql_tag_databases: + - postgresql + - mysql + # Optional. Must be between 2048 and 131072. + sql_query_max_length: 4096 diff --git a/sdk-config.yaml b/sdk-config.yaml index 41952b4f..5ac00b96 100644 --- a/sdk-config.yaml +++ b/sdk-config.yaml @@ -1,41 +1,35 @@ -# sdk-config.yaml is a typical starting point for configuring our custom distribution, including exporting to -# localhost via OTLP. +# sdk-config.yaml is the minimum configuration required to report traces, metrics and logs to SolarWinds Observability +# with our custom distribution. See sdk-config-kitchen-sink.yaml for every supported option, including the swo_otlp +# exporter for proxy support and exporting only service-level system metrics. # NOTE: With the exception of env var substitution syntax (i.e. ${MY_ENV}), SDKs ignore # environment variables when interpreting config files. This including ignoring all env # vars defined in https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/. +# Required environment variables: +# SW_APM_SERVICE_KEY: : +# SW_APM_API_TOKEN: + +# Replace na-01 in the sampler collector and exporter endpoints with your SolarWinds Observability data center. + # The file format version. file_format: "1.1" -# Configure if the SDK is disabled or not. This setting is optional, the default value when not provided is for the SDK to be enabled -disabled: false - # Configure resource for all signals. resource: - # Configure resource attributes. Entries have higher priority than entries from .resource.attributes_list. - # Entries must contain .name nand .value, and may optionally include .type, which defaults ot "string" if not set. The value must match the type. Values for .type include: string, bool, int, double, string_array, bool_array, int_array, double_array. attributes: - name: service.name - value: swi-test-app - # Configure resource detectors. SolarWinds detectors are listed first so upstream detectors can override their attributes. + value: my-service + # SolarWinds detectors are listed first so upstream detectors can override their attributes. detection/development: detectors: - swo_apm: - - swo_uams: - - swo_k8s: - -distribution: - solarwinds: - logging: - level: info - -# Configure general attribute limits. See also tracer_provider.limits, logger_provider.limits. -attribute_limits: + - service: + - host: + - process: # Configure text map context propagators. propagator: - # Configure the set of propagators to include in the composite text map propagator. composite: - tracecontext: - baggage: @@ -45,29 +39,51 @@ propagator: # Configure tracer provider. tracer_provider: processors: - - swo_stacktrace: - swo_response_time: - - swo_profiler: - enabled: false - interval: 20 - exclude_packages: - - java - - javax - - com.sun - - sun - - sunw + - batch: + exporter: + otlp_http: + endpoint: https://otel.collector.na-01.cloud.solarwinds.com/v1/traces + headers: + - name: authorization + value: Bearer ${SW_APM_API_TOKEN} + # Recommended. + compression: gzip + sampler: + swo_http: + service_key: ${SW_APM_SERVICE_KEY} + collector: apm.collector.na-01.cloud.solarwinds.com # Configure meter provider. meter_provider: readers: + - periodic: + exporter: + # swo_otlp resets transaction names after each export, and always uses delta temporality and base2 + # exponential histograms. + swo_otlp: + endpoint: https://otel.collector.na-01.cloud.solarwinds.com/v1/metrics + headers: + - name: authorization + value: Bearer ${SW_APM_API_TOKEN} + # Recommended. + compression: gzip -# Configure logger provider. Remove to disable log export +# Configure logger provider. Remove to disable log export. logger_provider: processors: + - batch: + exporter: + otlp_http: + endpoint: https://otel.collector.na-01.cloud.solarwinds.com/v1/logs + headers: + - name: authorization + value: Bearer ${SW_APM_API_TOKEN} + # Recommended. + compression: gzip +# Recommended. JVM runtime metrics. instrumentation/development: java: runtime_telemetry: emit_experimental_jfr_metrics/development: true - common: - default-enabled: true \ No newline at end of file diff --git a/smoke-tests/sdk-config.yaml b/smoke-tests/sdk-config.yaml index 9d232ba8..9a26006d 100644 --- a/smoke-tests/sdk-config.yaml +++ b/smoke-tests/sdk-config.yaml @@ -140,10 +140,6 @@ meter_provider: timeout: 10000 # Configure headers. Entries have higher priority than entries from .headers_list. headers_list: ${OTEL_EXPORTER_OTLP_HEADERS} - # Configure temporality preference. - temporality_preference: cumulative - # Configure default histogram aggregation. - default_histogram_aggregation: explicit_bucket_histogram # Configure logger provider. logger_provider: From 0c64e89e3ada477fc6fc946c75d9cd44ec9a5bae Mon Sep 17 00:00:00 2001 From: cleverchuk <15526124+cleverchuk@users.noreply.github.com> Date: Wed, 4 Nov 2026 09:25:53 -0500 Subject: [PATCH 2/4] Modify context settings in sdk-config-kitchen-sink.yaml Updated context_ttl to a longer duration and added clarifications for context_max_events and context_max_backtraces. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- sdk-config-kitchen-sink.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk-config-kitchen-sink.yaml b/sdk-config-kitchen-sink.yaml index a705c9fc..19c5b0f3 100644 --- a/sdk-config-kitchen-sink.yaml +++ b/sdk-config-kitchen-sink.yaml @@ -196,11 +196,11 @@ tracer_provider: tracing_enabled: true # Optional. Defaults to true. trigger_trace_enabled: true - # Optional. Positive integer that overrides the collector supplied limit. - context_ttl: 600 - # Optional. Positive integer that overrides the collector supplied limit. + # Optional. Positive initial context lifetime in milliseconds. Collector MaxContextAge updates take precedence. + context_ttl: 600000 + # Optional. Positive initial event limit. Collector MaxContextEvents updates take precedence. context_max_events: 100000 - # Optional. Positive integer that overrides the collector supplied limit. + # Optional. Positive initial backtrace limit. Collector MaxContextBacktraces updates take precedence. context_max_backtraces: 1000 # Optional. Each entry needs tracing (enabled|disabled) and exactly one of regex or extensions. transaction_settings: From 49458ebd2c61a18841061ed9f508034659616afc Mon Sep 17 00:00:00 2001 From: cleverchuk <15526124+cleverchuk@users.noreply.github.com> Date: Wed, 4 Nov 2026 09:29:29 -0500 Subject: [PATCH 3/4] Clarify swo_response_time transaction name fallback Updated comment for swo_response_time to clarify fallback transaction name functionality. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- sdk-config-kitchen-sink.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk-config-kitchen-sink.yaml b/sdk-config-kitchen-sink.yaml index 19c5b0f3..8ab60160 100644 --- a/sdk-config-kitchen-sink.yaml +++ b/sdk-config-kitchen-sink.yaml @@ -105,7 +105,7 @@ tracer_provider: # Required. Records response time metrics and transaction names for SolarWinds APM. - swo_response_time: - # Optional. Forces a single transaction name for all spans. + # Optional. Fallback transaction name when none of the configured transaction_name_schemes yields a name. transaction_name: my-transaction # Optional. Evaluated in order; the first scheme that yields a name wins. transaction_name_schemes: From c16d208a5f8f983962fab84d4ed4f0f4a3570855 Mon Sep 17 00:00:00 2001 From: cleverchuk Date: Wed, 4 Nov 2026 12:00:51 -0500 Subject: [PATCH 4/4] Internal - Use snake case for trigger_tracing_enabled and log file declarative config keys --- .../config/parser/yaml/LogSettingParser.java | 4 +-- .../AbstractSamplerComponentProvider.java | 4 +-- .../parser/yaml/LogSettingParserTest.java | 27 +++++++++++++++++++ .../AbstractSamplerComponentProviderTest.java | 4 +-- .../shared/src/test/resources/sdk-config.yaml | 2 +- sdk-config-kitchen-sink.yaml | 6 ++--- 6 files changed, 37 insertions(+), 10 deletions(-) diff --git a/libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/LogSettingParser.java b/libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/LogSettingParser.java index 56800995..7aec5e96 100644 --- a/libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/LogSettingParser.java +++ b/libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/LogSettingParser.java @@ -52,8 +52,8 @@ public LogSetting convert(DeclarativeConfigProperties declarativeConfigPropertie loggingSettings.getBoolean("stdout", true), loggingSettings.getBoolean("stderr", true), filePath, - fileInfo.getInt("maxSize"), - fileInfo.getInt("maxBackup")); + fileInfo.getInt("max_size"), + fileInfo.getInt("max_backup")); } @Override diff --git a/libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/provider/AbstractSamplerComponentProvider.java b/libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/provider/AbstractSamplerComponentProvider.java index 5e0d2259..8b558ffa 100644 --- a/libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/provider/AbstractSamplerComponentProvider.java +++ b/libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/provider/AbstractSamplerComponentProvider.java @@ -47,7 +47,7 @@ public abstract class AbstractSamplerComponentProvider implements ComponentProvi private static final String TRACING_ENABLED = "tracing_enabled"; - private static final String TRIGGER_TRACE_ENABLED = "trigger_trace_enabled"; + private static final String TRIGGER_TRACING_ENABLED = "trigger_tracing_enabled"; private static final String TRANSACTION_SETTINGS = "transaction_settings"; @@ -76,7 +76,7 @@ public Sampler create(DeclarativeConfigProperties declarativeConfigProperties) { SamplingConfiguration.builder() .tracingMode(parseTracingMode(declarativeConfigProperties)) .triggerTraceEnabled( - declarativeConfigProperties.getBoolean(TRIGGER_TRACE_ENABLED, true)) + declarativeConfigProperties.getBoolean(TRIGGER_TRACING_ENABLED, true)) .internalTransactionSettings(parseTraceConfigs(declarativeConfigProperties)); parseConfig(declarativeConfigProperties, builder); diff --git a/libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/LogSettingParserTest.java b/libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/LogSettingParserTest.java index 25e8f151..44952afa 100644 --- a/libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/LogSettingParserTest.java +++ b/libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/LogSettingParserTest.java @@ -23,8 +23,11 @@ import com.solarwinds.joboe.logging.Logger; import io.opentelemetry.api.incubator.config.DeclarativeConfigProperties; import io.opentelemetry.sdk.autoconfigure.declarativeconfig.DeclarativeConfiguration; +import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.nio.file.Paths; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -53,8 +56,32 @@ void testConvert() throws InvalidConfigException { assertEquals(new LogSetting(Logger.Level.TRACE, true, true, null, 10, 5), logSetting); } + @Test + void testConvertWithFileSettings() throws InvalidConfigException { + LogSetting logSetting = + tested.convert( + fromYaml( + "logging:\n" + + " level: debug\n" + + " stdout: false\n" + + " stderr: false\n" + + " file:\n" + + " location: /tmp/agent.log\n" + + " max_size: 20\n" + + " max_backup: 3\n")); + + assertEquals( + new LogSetting(Logger.Level.DEBUG, false, false, Paths.get("/tmp/agent.log"), 20, 3), + logSetting); + } + @Test void configKey() { assertEquals("logging", tested.configKey()); } + + private static DeclarativeConfigProperties fromYaml(String yaml) { + return DeclarativeConfiguration.toConfigProperties( + new ByteArrayInputStream(yaml.getBytes(StandardCharsets.UTF_8))); + } } diff --git a/libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/config/provider/AbstractSamplerComponentProviderTest.java b/libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/config/provider/AbstractSamplerComponentProviderTest.java index bd0e75c1..b6d34280 100644 --- a/libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/config/provider/AbstractSamplerComponentProviderTest.java +++ b/libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/config/provider/AbstractSamplerComponentProviderTest.java @@ -127,7 +127,7 @@ void testCreateWithEmptyConfigUsesDefaults() { @Test void testCreateDisablesTriggerTrace() { - tested.create(fromYaml("swo_http:\n trigger_trace_enabled: false\n")); + tested.create(fromYaml("swo_http:\n trigger_tracing_enabled: false\n")); assertFalse(samplingConfiguration().isTriggerTraceEnabled()); } @@ -179,7 +179,7 @@ void testCreateAppliesExtensionsMatcher() { @MethodSource("invalidConfigs") void testCreateThrowsForInvalidConfig(String description, String yaml, String expectedMessage) { tested.create( - fromYaml("swo_http:\n tracing_enabled: false\n trigger_trace_enabled: false\n")); + fromYaml("swo_http:\n tracing_enabled: false\n trigger_tracing_enabled: false\n")); SamplingConfiguration previous = samplingConfiguration(); RuntimeException exception = diff --git a/libs/shared/src/test/resources/sdk-config.yaml b/libs/shared/src/test/resources/sdk-config.yaml index efad65ff..ee101b1b 100644 --- a/libs/shared/src/test/resources/sdk-config.yaml +++ b/libs/shared/src/test/resources/sdk-config.yaml @@ -71,7 +71,7 @@ tracer_provider: # Configure sampler. swo_http: tracing_enabled: true - trigger_trace_enabled: true + trigger_tracing_enabled: true transaction_settings: - regex: ".*/specialties" tracing: "disabled" diff --git a/sdk-config-kitchen-sink.yaml b/sdk-config-kitchen-sink.yaml index 8ab60160..e79ae97e 100644 --- a/sdk-config-kitchen-sink.yaml +++ b/sdk-config-kitchen-sink.yaml @@ -65,9 +65,9 @@ distribution: # Required. location: /var/log/solarwinds-apm/agent.log # Optional. Max file size in MB before rotation. Defaults to 10. - maxSize: 10 + max_size: 10 # Optional. Number of rotated files to keep. Defaults to 5. - maxBackup: 5 + max_backup: 5 # Optional. Configure attribute limits for all signals. attribute_limits: @@ -195,7 +195,7 @@ tracer_provider: # Optional. Overrides the tracing mode from the collector when set. tracing_enabled: true # Optional. Defaults to true. - trigger_trace_enabled: true + trigger_tracing_enabled: true # Optional. Positive initial context lifetime in milliseconds. Collector MaxContextAge updates take precedence. context_ttl: 600000 # Optional. Positive initial event limit. Collector MaxContextEvents updates take precedence.