Skip to content

Comments

Add support for deployment.environment.name#1722

Merged
thpierce merged 2 commits intomainfrom
depenv
Jun 11, 2025
Merged

Add support for deployment.environment.name#1722
thpierce merged 2 commits intomainfrom
depenv

Conversation

@thpierce
Copy link
Collaborator

@thpierce thpierce commented Jun 11, 2025

Description of the issue

ApplicationSignalsProcessor relies on the resource attribute deployment.environment as a customer-provided override for ApplicationSignals Environment. However, deployment.environment has been deprecated and replaced with deployment.environment.name in the upstream.

Description of changes

In this PR, we are adding support for the new attribute, while maintaining support for the old attribute, since customers may still specify deployment.environment, for example, if they are running on older OTEL versions.

Callout: We are no longer getting these attribute names from semconv as:

  1. We were relying on go.opentelemetry.io/collector/semconv/v1.22.0, which does not have deployment.environment.name
  2. https://pkg.go.dev/go.opentelemetry.io/collector/semconv has been deprecated
  3. It's replacement, https://pkg.go.dev/go.opentelemetry.io/otel/semconv does not include deployment.environment.name: https://github.com/search?q=repo%3Aopen-telemetry%2Fopentelemetry-go+deployment.environment.name&type=code
  4. Nor does it include deployment.environment in the latest releases (1.3x): https://github.com/search?q=repo%3Aopen-telemetry%2Fopentelemetry-go+deployment.environment&type=code

So we hardcode these attributes within the processor logic.

License

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Tests

  • Unit tests pass
  • E2E testing: done on EC2 with a simple Java application and latest ADOT SDK.
    • Scenario 1: export OTEL_RESOURCE_ATTRIBUTES="service.name=2122Test1" - Success, Environment metric dimension set to ec2:default.
    • Scenario 2: export OTEL_RESOURCE_ATTRIBUTES="service.name=2122Test1,deployment.environment=test1" - Success, Environment metric dimension set to test1.
    • Scenario 3: export OTEL_RESOURCE_ATTRIBUTES="service.name=2122Test1,deployment.environment.name=test2" - Success, Environment metric dimension set to test2.
    • Scenario 4: export OTEL_RESOURCE_ATTRIBUTES="service.name=2122Test1,deployment.environment=test3,deployment.environment.name=test4" - Success, Environment metric dimension set to test4. // Not a realistic test, just edge testing.
    • Scenario 5: export OTEL_RESOURCE_ATTRIBUTES="service.name=2122Test1,deployment.environment.name=test5,deployment.environment=test6" - Success, Environment metric dimension set to test5. // Not a realistic test, just edge testing.

Requirements

Before commiting your code, please do the following steps.

  1. Run make fmt and make fmt-sh
  2. Run make lint

Done


Integration Tests

To run integration tests against this PR, add the ready for testing label.

thpierce added 2 commits June 11, 2025 10:34
ApplicationSignalsProcessor relies on the resource attribute `deployment.environment` as a customer-provided override for ApplicationSignals `Environment`. However, `deployment.environment` has been deprecated and replaced with `deployment.environment.name` in the upstream. In this PR, we are adding support for the new attribute, while maintaining support for the old attribute, since customers may still specify `deployment.environment`, for example, if they are running on older OTEL versions.

Callout: We are no longer getting these attribute names from semconv as:
1. We were relying on go.opentelemetry.io/collector/semconv/v1.22.0, which does not have `deployment.environment.name`
2. https://pkg.go.dev/go.opentelemetry.io/collector/semconv has been deprecated
3. It's replacement, https://pkg.go.dev/go.opentelemetry.io/otel/semconv does not include `deployment.environment.name`: https://github.com/search?q=repo%3Aopen-telemetry%2Fopentelemetry-go+deployment.environment.name&type=code
4. Nor does it include `deployment.environment` in the latest releases (1.3x): https://github.com/search?q=repo%3Aopen-telemetry%2Fopentelemetry-go+deployment.environment&type=code

So we hardcode these attributes within the processor logic.
@thpierce thpierce requested a review from a team as a code owner June 11, 2025 18:04
@thpierce thpierce changed the title Depenv Add support for deployment.environment.name Jun 11, 2025
@thpierce thpierce merged commit 6f37dec into main Jun 11, 2025
17 checks passed
@thpierce thpierce deleted the depenv branch June 11, 2025 22:13
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