Add Azure Dynamic Tags Support via AzureTagger Processor#1998
Draft
Add Azure Dynamic Tags Support via AzureTagger Processor#1998
Conversation
Rename unused 'r' parameter to '_' in TestProvider_Refresh_Timeout to satisfy revive linter.
The return statement in InitGlobalProvider was reading globalErr without holding the lock, causing a race with concurrent readers.
sync.Once cannot be safely reset while concurrent Do() calls may be in progress. Replace with atomic uint32 flag and double-checked locking pattern, which allows safe reset from tests without racing.
- Reset global provider in TestTranslator to ensure test uses mock metadata - Update placeholderUtil tests to use SetGlobalProviderForTest instead of relying on legacy fallback path which doesn't work on Azure - Skip TestGetMetadataInfo_FallbackToLegacy on Azure since azure.IsAzure() takes precedence over the legacy fallback path
The test was resetting the global provider but then calling GetMetadataInfo which falls through to the Azure path on Azure CI runners. Now we set the mock provider first so GetMetadataInfo uses it instead of Azure IMDS.
- Add azuretagger processor mirroring ec2tagger pattern - Add StartRefreshLoop to Azure provider for tag refresh - Add ScalingGroupName to MockProvider - Register azuretagger in default components - Add translator for azuretagger processor - Remove non-code files (PR_DESCRIPTION.md, MERGE_CHECKLIST.md)
Contributor
|
This PR was marked stale due to lack of activity. |
jefchien
reviewed
Feb 9, 2026
Contributor
jefchien
left a comment
There was a problem hiding this comment.
Is there a reason we decided to create this instead of using https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/resourcedetectionprocessor#azure?
Contributor
|
This PR was marked stale due to lack of activity. |
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.
Add Azure Dynamic Tags Support via AzureTagger Processor
Problem
CloudWatch Agent supports dynamic tag fetching on AWS via the
ec2taggerprocessor, which retrieves instance tags from EC2 and adds them as metric dimensions. Azure VMs have tags available through IMDS, but there's no equivalent processor to fetch and apply these tags to metrics at runtime.Solution
Introduce an
azuretaggerprocessor that mirrors theec2taggerpattern for Azure environments. The processor fetches VM tags from Azure IMDS at startup and optionally refreshes them periodically, adding them as dimensions to metrics flowing through the pipeline.Architecture
Data Flow:
azuretaggerprocessor intercepts metricsCMCA.GetTags()to get cached Azure tagsTag Source:
169.254.169.254/metadata/instance/compute?tagsListec2:DescribeTags)Key Design Decisions:
Changes
New AzureTagger Processor (
plugins/processors/azuretagger/)azuretagger.go- Main processor: fetches tags from CMCA, adds to metricsconfig.go- Configuration: metadata tags, instance tag keys, refresh intervalfactory.go- OTel processor factory registrationconstants.go- Azure-specific dimension keys (InstanceId, VMScaleSetName, etc.)*_test.go- Unit tests for all componentsAzure Provider Enhancement (
internal/cloudmetadata/azure/)StartRefreshLoop()method for periodic metadata refreshComponent Registration (
service/defaultcomponents/)azuretaggerfactory in processor listTranslator (
translator/translate/otel/processor/azuretaggerprocessor/)Comparison with ec2tagger
DescribeTags)tagsList)ec2:DescribeTags)AutoScalingGroupNameVMScaleSetNameTesting
Unit Tests
*)Manual Verification
make build,make lint,go test ./...all pass-raceflagFuture Work