[feature request] Avoid overwriting the deployment.environment in AppServiceResourceDetector #2357
Labels
comp:resources.azure
Things related to OpenTelemetry.Resources.Azure
enhancement
New feature or request
Component
OpenTelemetry.Resources.Azure
Is your feature request related to a problem?
While instrumenting a .NET Azure function, I noticed that the deployment.environment resource attribute got set to "Production", but couldn't figure out why.
It appears that it's being set in the AppServiceResourceDetector class.
First, the WEBSITE_SLOT_NAME environment variable value is loaded into a dictionary:
It turns out that the default deployment slot for an Azure function is "Production", so the default value for WEBSITE_SLOT_NAME is also "Production".
The resource attribute then gets added as follows:
Note that the code doesn't current check to see if a resource attribute with the same name already exists.
What is the expected behavior?
If the deployment.environment resource attribute is already set, either via the OTEL_RESOURCE_ATTRIBUTES environment variable or via code, it should not be overwritten.
Which alternative solutions or features have you considered?
For now, I've created another deployment slot which indirectly produces the desired deployment.environment name. I may also be able to manually override the value of the WEBSITE_SLOT_NAME environment variable.
Additional context
No response
The text was updated successfully, but these errors were encountered: