Skip to content

Add environment name to OTel metrics - #2188

Merged
theseanything merged 1 commit into
mainfrom
theseanything/add-env-label-otel-metrics
Jul 6, 2026
Merged

Add environment name to OTel metrics#2188
theseanything merged 1 commit into
mainfrom
theseanything/add-env-label-otel-metrics

Conversation

@theseanything

@theseanything theseanything commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Set deployment.environment.name as a resource attribute in the ADOT collector metrics pipeline so metrics in CloudWatch can be filtered and grouped by environment (dev, staging, production).

This allows not to have to set the environment name in the application itself for every single metric.

Tested in dev.

Set deployment.environment.name as a resource attribute in the ADOT
collector metrics pipeline so metrics in CloudWatch can be filtered
and grouped by environment (dev, staging, production).

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds the deployment environment name to ADOT/OTel metrics emitted from ECS services by injecting deployment.environment.name as a resource attribute in the collector configuration. This centralizes environment tagging in infrastructure so CloudWatch metrics can be filtered/grouped by environment without requiring each application to set the attribute.

Changes:

  • Pass env_name into the ADOT collector config Terraform template.
  • Add a resource/env processor that upserts deployment.environment.name into resource attributes.
  • Wire the new processor into the metrics pipeline (resourcedetection/ecs -> resource/env -> batch/metrics).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
infra/modules/ecs-service/adot.tf Passes env_name into the ADOT collector config templatefile inputs.
infra/modules/ecs-service/adot-collector-config.yaml.tpl Adds a resource processor to set deployment.environment.name and includes it in the metrics pipeline.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread infra/modules/ecs-service/adot-collector-config.yaml.tpl
@theseanything
theseanything added this pull request to the merge queue Jul 6, 2026
Merged via the queue into main with commit f9d4102 Jul 6, 2026
22 checks passed
@theseanything
theseanything deleted the theseanything/add-env-label-otel-metrics branch July 6, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants