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

Add extra resource attributes to config #127

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

oxcafedead
Copy link

@oxcafedead oxcafedead commented Apr 11, 2024

Currently, there is no API to insert custom resource attributes.
For example, to set deployment.environment semantic attribute from OpenTelemetry Semantic Conventions, one has to do smth like:

		postProcessor: (spans) => {
			if (spans.length == 0) {
				return spans;
			}
			const resource = spans[0].resource;
			resource.attributes['deployment.environment'] = env.ENV_NAME;
			return spans;
		}

Ideally, would go great to have it configurable

As I am not sure about proper naming / place to put this -- feel free to throw it away or change, but the overall idea is:

	return {
		exporter: {
			url: tracesEndpoint,
		},
		service: {
			name: serviceName,
			version: env.VERSION,
		},
                extraResourceAttributes: parseAttributes(env.OTEL_ATTRS)),
...

Also not sure if we should update readme as this is not an essential config part.

@oxcafedead oxcafedead marked this pull request as ready for review April 15, 2024 10:39
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.

None yet

1 participant