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

No clear API defined for resource detector libraries #4016

Open
joaopgrassi opened this issue Apr 26, 2024 · 4 comments
Open

No clear API defined for resource detector libraries #4016

joaopgrassi opened this issue Apr 26, 2024 · 4 comments
Labels
spec:resource Related to the specification/resource directory triage:deciding:community-feedback

Comments

@joaopgrassi
Copy link
Member

joaopgrassi commented Apr 26, 2024

What are you trying to achieve?

We have specified the way to load resource attributes from the environment via resource detector packages.

The Resource SDK spec says:

Resource detector packages MUST provide a method that returns a resource. This can then be associated with TracerProvider or MeterProvider instances as described above.

But it never defined exactly what the method is called. This may end up in a situation where each library exposes a method with a different name which then creates problems if such packages are to be loaded/invoked automatically (e.g., by an agent). This would make implementing something like #2948 impossible.

What did you expect to see?

Clear specification of what a resource detector package must provide, giving which method it must have, similar to what we do for Samplers for example.

@joaopgrassi joaopgrassi added the spec:resource Related to the specification/resource directory label Apr 26, 2024
@svrnm
Copy link
Member

svrnm commented Apr 26, 2024

Since many languages have resource detectors implemented already, a few pointers how it looks like right now:

  • Go has resource.with<X>, see below
  • Erlang has a resource detector behaviour
  • Java has <X>Resource.get()
  • JS has <X>detector.detect(<config>)
  • ...

@joaopgrassi
Copy link
Member Author

  • Go has resource.with<X>

  • Erlang has a resource detector behaviour

  • Java has <X>Resource.get()

  • JS has <X>detector.detect(<config>)

As I expected, already inconsistent behavior =/

@MrAlias
Copy link
Contributor

MrAlias commented Apr 26, 2024

For Go it is Detector.Detect: https://pkg.go.dev/go.opentelemetry.io/otel/sdk/resource#Detector

@joaopgrassi
Copy link
Member Author

For C++ and Envoy it's also Detect.

So I think we should add this method to the specification. It seems it's the most common denominator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec:resource Related to the specification/resource directory triage:deciding:community-feedback
Projects
None yet
Development

No branches or pull requests

4 participants