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

Is it possible to dinamically inject resourceLogs's resource attributes? #5721

Closed
smoms opened this issue Jun 25, 2024 · 2 comments
Closed
Assignees
Labels
question Further information is requested

Comments

@smoms
Copy link

smoms commented Jun 25, 2024

What is the question?

Hi,

I would need to understand if possible to dinamically add attributes in the structure below while logs are being generated, i.e. not only at build time:

"resourceLogs": [
		{
			"resource": {
				"attributes": [
					{
						"key": "service.name",
						"value": {
							"stringValue": "my name"
						}
					},
					{
						"key": "service.namespace",
						"value": {
							"stringValue": "my namespace"
						}
					},
					{
						**"key": "my custom attributes",
						"value": {
							"stringValue": "xyz"
						}**
					},

Maybe extending the BaseProcessor<Resource> ?

thanks

@smoms smoms added the question Further information is requested label Jun 25, 2024
@TimothyMothra
Copy link
Contributor

Hi @smoms,
No, the resource attribute is immutable and cannot be modified after initializing the sdk.
This is defined in OpenTelemetry's spec https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/sdk.md

@cijothomas
Copy link
Member

Adding this too : #5691 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants