weaveworks-experiments / kspan

Turning Kubernetes Events into spans
Apache License 2.0
785 stars 56 forks source link

Add support for user defined OTEL resource attributes #36

Open clly opened 3 years ago

clly commented 3 years ago

This will add support for pulling in opentelemetry's default attributes It adds sdk information, service.name and discrete key/value entries as specified on the environment and local host information such as the hostname and instance.

bboreham commented 3 years ago

Thanks for the PR.

Can you describe how those attributes are useful for Kspan? It generates spans that claim to come from many different components such as kubectl, scheduler, controller-manager, so I wonder if it would be confusing that they all have the same host information.

clly commented 3 years ago

Sorry about that. One of the default attributes is also anything that exists in the OTEL_RESOURCE_ATTRIBUTES environment variable.

This change pulls that in as well as all the SDK and local host/runtime environment information

clly commented 3 years ago

It is possible to only pull in the environment variable attributes instead of everything. If that's preferred let me know and I can change it

bboreham commented 3 years ago

Yes, might be safer to start just with the env-vars.

clly commented 2 years ago

I've updated the PR to only pull in resources from the environment