Repository navigation
Internal - Move sampling configs to sampler component config - #661
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Critical sampler regressions break existing configurations and initialization, while shared settings and stale fetcher callbacks can apply incorrect sampling policies.
10 open issues
Preserve or migrate legacy sampling configuration parsing · New Restore compatibility provider for swo/sampler · New Allow sampler-scoped service keys during declarative initialization · New Validate scoped service keys and service names before fetching · New Prevent retired fetchers from dispatching callbacks · New Isolate settings state between scoped sampler instances · New Preserve SolarWinds default sampler when sampler is omitted · New Clean up HTTP fetchers during enabled SDK shutdown · New Parse context limits in the JSON sampling provider · New Clear stale state and listeners during reset · New
What changed in this PR
Moves declarative sampling configuration into dedicated HTTP and JSON sampler components for the standard and Lambda agents.
Changes:
- Adds sampler providers with component-level settings and validation, replacing the shared
swo/samplerprovider and legacy sampling parsers. - Separates HTTP collector, service-key, and proxy configuration from global agent settings.
- Updates settings initialization, fetcher replacement, tests, and YAML fixtures.
| File | Description |
|---|---|
smoke-tests/sdk-config.yaml |
Migrates the fallback sampler and transaction rules to swo_http. |
libs/shared/src/test/resources/sdk-config.yaml |
Uses component-level sampling settings. |
libs/shared/src/test/resources/sdk-config-bad-transaction-settings-1.yaml |
Removes an obsolete invalid-config fixture. |
libs/shared/src/test/resources/sdk-config-bad-transaction-settings-0.yaml |
Removes an obsolete invalid-config fixture. |
libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/config/provider/SharedConfigCustomizerProviderTest.java |
Updates expectations for omitted samplers. |
libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/config/provider/SamplerComponentProviderTest.java |
Removes the legacy provider test. |
libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/config/provider/AbstractSamplerComponentProviderTest.java |
Tests shared sampling configuration and validation. |
libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/UrlSampleRateConfigParserTest.java |
Removes tests for the retired URL-rate parser. |
libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/TriggerTraceParserTest.java |
Removes tests for the retired trigger-trace parser. |
libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/TransactionSettingsConfigParserTest.java |
Removes tests for the retired transaction parser. |
libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/TracingModeParserTest.java |
Removes tests for the retired tracing-mode parser. |
libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/SharedNames.java |
Defines HTTP and JSON sampler names. |
libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/provider/SharedConfigCustomizerProvider.java |
Removes automatic default sampler injection. |
libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/provider/SamplerComponentProvider.java |
Removes the legacy sampler provider. |
libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/provider/AbstractSamplerComponentProvider.java |
Centralizes component-level sampling parsing and initialization. |
libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/UrlSampleRateConfigParser.java |
Moves URL-rate parsing out of global configuration. |
libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/TriggerTraceParser.java |
Removes global trigger-trace parsing. |
libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/TransactionSettingsConfigParser.java |
Moves transaction parsing into the sampler provider. |
libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/TracingModeParser.java |
Removes global tracing-mode parsing. |
libs/sampling/src/test/java/com/solarwinds/joboe/sampling/SettingsManagerTest.java |
Tests fetcher replacement, reset, and waiting behavior. |
libs/sampling/src/main/java/com/solarwinds/joboe/sampling/SettingsManager.java |
Adds initialization checks, reset, and fetcher cleanup. |
libs/lambda/src/test/java/com/solarwinds/opentelemetry/extensions/JsonSamplerComponentProviderTest.java |
Tests JSON sampler file selection and validation. |
libs/lambda/src/main/java/com/solarwinds/opentelemetry/extensions/LambdaAgentListener.java |
Preserves initialized settings and resets disabled-agent state. |
libs/lambda/src/main/java/com/solarwinds/opentelemetry/extensions/JsonSamplerComponentProvider.java |
Adds the file-backed swo_json sampler provider. |
libs/lambda/build.gradle.kts |
Adds declarative configuration dependencies. |
custom/src/test/resources/sdk-config.yaml |
Migrates tracing mode to swo_http. |
custom/src/test/java/com/solarwinds/opentelemetry/extensions/config/provider/HttpSamplerComponentProviderTest.java |
Tests HTTP sampler settings, isolation, and validation. |
custom/src/test/java/com/solarwinds/opentelemetry/extensions/config/HttpSettingsReaderTest.java |
Tests scoped reader values and defaults. |
custom/src/test/java/com/solarwinds/opentelemetry/extensions/config/HttpSettingsReaderDelegateTest.java |
Tests explicit proxy and no-proxy configuration. |
custom/src/main/java/com/solarwinds/opentelemetry/extensions/SolarwindsAgentListener.java |
Avoids replacing initialized settings and uses the system-config reader. |
custom/src/main/java/com/solarwinds/opentelemetry/extensions/config/provider/HttpSamplerComponentProvider.java |
Adds HTTP sampler configuration and fetcher construction. |
custom/src/main/java/com/solarwinds/opentelemetry/extensions/config/HttpSettingsReaderDelegate.java |
Supports explicitly supplied proxy settings. |
custom/src/main/java/com/solarwinds/opentelemetry/extensions/config/HttpSettingsReader.java |
Separates system-backed and explicitly scoped configuration. |
Review effort: Balanced
cleverchuk
force-pushed
the
cc/NH-153394
branch
from
October 28, 2026 22:16
a07c3b7 to
44f5cf4
Compare
cleverchuk
force-pushed
the
cc/NH-153394
branch
from
October 29, 2026 16:47
44f5cf4 to
efa4f80
Compare
jerrytfleung
requested changes
Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


This pull request introduces a new HTTP-based sampler component provider for the OpenTelemetry SolarWinds agent, enabling more flexible and isolated configuration of sampling settings, including support for per-sampler collector, service key, and proxy settings. It also refactors
HttpSettingsReaderandHttpSettingsReaderDelegateto support this flexibility and adds comprehensive tests for the new functionality.Key changes:
New HTTP Sampler Component Provider
Added
HttpSamplerComponentProvider, a newComponentProviderimplementation that allows configuring a sampler with its own collector, service key, and proxy settings, independent of the global agent configuration. It validates configuration, parses proxy settings, and constructs the appropriate settings fetcher.Added a full test suite for
HttpSamplerComponentProvider, verifying correct configuration parsing, isolation from global agent config, proxy handling, and error handling for invalid configs.Refactoring for Configurability and Testability
Refactored
HttpSettingsReaderto support two construction modes: one using system/global config (forSystemConfig) and another for explicit file/scoped config (forFileConfig). This allows samplers to use their own collector/service key, with sensible defaults if not provided.Refactored
HttpSettingsReaderDelegateto accept aProxyConfigvia constructor, enabling per-sampler proxy settings instead of always using the global config. The proxy is now supplied as a functional interface, improving testability and configurability. [1] [2]Testing Enhancements
HttpSettingsReaderandHttpSettingsReaderDelegateto verify correct use of per-sampler collector, service key, and proxy settings, as well as default fallbacks. [1] [2]Integration and Initialization Improvements
Updated agent initialization logic to use the new
HttpSettingsReader.forSystemConfigmethod and ensure that settings are only initialized once, preventing redundant initialization.Ensured settings are reset on shutdown to avoid stale state between runs.
Test services data