Skip to content
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

Support arbitrary resource attributes #32

Closed
bmerigan opened this issue Feb 1, 2024 · 6 comments
Closed

Support arbitrary resource attributes #32

bmerigan opened this issue Feb 1, 2024 · 6 comments

Comments

@bmerigan
Copy link

bmerigan commented Feb 1, 2024

Is your feature request related to a problem? Please describe

Currently the traces that are logged via this module don't have environment metadata which means I cannot filter traces by environment in Elastic APM. e.g. development/test/staging/production

This feature and why it's useful is explained perfectly in this opentelemetry doco

Describe the solution you'd like

Just like we can set otel_service_name as per nginx-otel doco
I'd like to be able to set the environment with a directive called otel_service_environment

Bonus if you include service.node.name and service.version too.

Describe alternatives you've considered

Adding the value using a resource processor within the otel-collector, which works, but isn't right IMO.

@p-pautov
Copy link
Contributor

p-pautov commented Feb 7, 2024

I think, we can add generic otel_resource block, which would allow setting any resource level attributes, e.g.

otel_resource {
    "deployment.environment" "prod";
    "service.node.name" "mysvc";
    "service.version" "1.0";
}

@bmerigan
Copy link
Author

bmerigan commented Feb 7, 2024

Yeah that would work well

@p-pautov p-pautov changed the title Add otel_service_environment directive Support arbitrary resource attributes Feb 29, 2024
@sahilganguly
Copy link

@bmerigan could you include these attributes using the otel_span_attr directive? Assuming of course you can get those attributes as a variable in nginx.

@bmerigan
Copy link
Author

bmerigan commented Apr 2, 2024

@bmerigan could you include these attributes using the otel_span_attr directive? Assuming of course you can get those attributes as a variable in nginx.

I do use the otel_span_attr for some things, but these attributes are more at the top, trace level.

@oliveromahony
Copy link

hi I think this request is necessary and will help in categorization of OTel data in the case of this module. The issue I foresee is that the proposal quoted only covers attribute tagging effectively:

I think, we can add generic otel_resource block, which would allow setting any resource level attributes, e.g.

otel_resource {
    "deployment.environment" "prod";
    "service.node.name" "mysvc";
    "service.version" "1.0";
}

e.g. if we have multiple OTel NGINX modules reporting to a single collector, the only distinction would be service.node.name. But how does this work if we syncronize configurations with https://docs.nginx.com/nginx/admin-guide/high-availability/configuration-sharing/ and https://docs.nginx.com/nginx-management-suite/nim/how-to/instances/manage-instance-groups/ where the configurations are duplicated and identical on each NGINX instance? In these cases the config would potentially replicate and have the same service.node.name?

@p-pautov
Copy link
Contributor

I don't think, you have to have identical configs on each instance. Say, you can use instance specific file and include it into synced config. Another option is to use environment variables - #40.

p-pautov added a commit that referenced this issue Nov 10, 2024
Now attributes can be set with "otel_resource_attr" directive, e.g.
    otel_resource_attr my.name "my value";
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 a pull request may close this issue.

4 participants