-
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
base: main
Are you sure you want to change the base?
Conversation
3e9cd4a to
91155d3
Compare
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
| if (serviceAttr && serviceAttr !== defaultServiceName()) { | ||
| serviceName = String(serviceAttr); |
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.
Is this because we don't want to set serviceName as unknown_service:${process.argv0}, so we fallback to UnknownService instead?
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.
This is what we're doing in python as well.
we want to fallback to UnknownService instead of the OTel default unknown_service:node. Do you think this is correct?
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 <[email protected]>
91155d3 to
363f95e
Compare
| # - Set Application Signals EMF export configuration (adds Service and Environment dimensions) | ||
| if [ -z "${OTEL_AWS_APPLICATION_SIGNALS_EMF_EXPORT_ENABLED}" ]; then |
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?
Summary
When both
OTEL_AWS_APPLICATION_SIGNALS_ENABLEDandOTEL_AWS_APPLICATION_SIGNALS_EMF_EXPORT_ENABLEDare set totrue, EMF metrics will now include Service and Environment as dimensions:service.nameresource attribute, falls back to"UnknownService"deployment.environmentresource attribute, falls back to"lambda:default"For Lambda, both env vars default to
truevia theotel-instrumentwrapper script.Changes
src/exporter/aws/metrics/emf-exporter-base.tsisApplicationSignalsEmfExportEnabled()to check both env varshasDimensionCaseInsensitive()for case-insensitive dimension checkingaddApplicationSignalsDimensions()to inject Service/Environment dimensionscreateEmfLog()to call the new methodlambda-layer/packages/layer/scripts/otel-instrumentOTEL_AWS_APPLICATION_SIGNALS_EMF_EXPORT_ENABLED="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