generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 18
Add Service and Environment dimensions to EMF metrics #299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
syed-ahsan-ishtiaque
wants to merge
4
commits into
main
Choose a base branch
from
add-emf-service-environment-dimensions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+445
−1
Conversation
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
3e9cd4a to
91155d3
Compare
jj22ee
reviewed
Dec 9, 2025
aws-distro-opentelemetry-node-autoinstrumentation/src/exporter/aws/metrics/emf-exporter-base.ts
Outdated
Show resolved
Hide resolved
aws-distro-opentelemetry-node-autoinstrumentation/src/exporter/aws/metrics/emf-exporter-base.ts
Show resolved
Hide resolved
aws-distro-opentelemetry-node-autoinstrumentation/src/exporter/aws/metrics/emf-exporter-base.ts
Show resolved
Hide resolved
aws-distro-opentelemetry-node-autoinstrumentation/src/exporter/aws/metrics/emf-exporter-base.ts
Outdated
Show resolved
Hide resolved
aws-distro-opentelemetry-node-autoinstrumentation/src/exporter/aws/metrics/emf-exporter-base.ts
Outdated
Show resolved
Hide resolved
When both OTEL_AWS_APPLICATION_SIGNALS_ENABLED and OTEL_AWS_APPLICATION_SIGNALS_EMF_EXPORT_ENABLED are set to true, EMF metrics will now include Service and Environment as dimensions: - Service: extracted from service.name resource attribute, falls back to "UnknownService" - Environment: extracted from deployment.environment resource attribute, falls back to "lambda:default" - Dimensions are not added if user already set them (case-insensitive) For Lambda, both env vars default to true via otel-instrument wrapper. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
91155d3 to
363f95e
Compare
jj22ee
reviewed
Dec 9, 2025
Comment on lines
+79
to
+80
| # - Set Application Signals EMF export configuration (adds Service and Environment dimensions) | ||
| if [ -z "${OTEL_AWS_APPLICATION_SIGNALS_EMF_EXPORT_ENABLED}" ]; then |
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the purpose of OTEL_AWS_APPLICATION_SIGNALS_EMF_EXPORT_ENABLED is to only addApplicationSignalsDimensions to EMF, can we use a different Env Var for this?
Changes from v1 to v2 implementation: - Use single env var: OTEL_METRICS_ADD_APPLICATION_SIGNALS_DIMENSIONS - Add platform-aware defaults: lambda:default, ec2:default, ecs:default, eks:default, generic:default - Check deployment.environment.name before deployment.environment - Detect platform via cloud.platform resource attribute 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Use push() instead of unshift/splice to add Service and Environment dimensions without enforcing specific position in the dimensions array. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
c77565d to
53497c6
Compare
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.
Summary
When
OTEL_METRICS_ADD_APPLICATION_SIGNALS_DIMENSIONSis set totrue, EMF metrics will include Service and Environment as dimensions:service.nameresource attribute, falls back to"UnknownService"deployment.environment.nameordeployment.environmentresource attribute, falls back to platform-specific defaultPlatform-Specific Defaults
lambda:defaultec2:defaultecs:defaulteks:defaultgeneric:defaultFor Lambda, the env var defaults to
truevia theotel-instrumentwrapper script.Changes
src/exporter/aws/metrics/emf-exporter-base.tsshouldAddApplicationSignalsDimensions()to check the single env vargetDefaultEnvironmentForPlatform()for platform-aware defaultshasDimensionCaseInsensitive()for case-insensitive dimension checkingaddApplicationSignalsDimensions()to inject Service/Environment dimensionscreateEmfLog()to call the new methodlambda-layer/packages/layer/scripts/otel-instrumentOTEL_METRICS_ADD_APPLICATION_SIGNALS_DIMENSIONS="true"for Lambdatest/exporter/aws/metrics/aws-cloudwatch-emf-exporter.test.tsTest plan
npm run lintpasses (0 errors)npm run compilebuilds successfullyManual Testing
Lambda Code
CW Metrics
Application Signals Related Metrics
🤖 Generated with Claude Code