Skip to content

Define Resource Detector API #5066

@thompson-tomo

Description

@thompson-tomo

What are you trying to achieve?

I want to have a way in which I create the resource based on config. Within declarative config we can define:

  • attributes to be included/excluded
  • config options for the detector

However when I look at otel specs the usage of this is not defined https://opentelemetry.io/docs/specs/otel/resource/sdk/

This has come about as I was looking to understand how resource detectors can be enabled/disabled in zero-code scenarios.

What would help is if we had an api doc which defines the methods the sdk is to implement just like other domains

My thoughts would be:

  • introduce a create method on ResourceDetector with parameters (all optional):
    • options
    • attributes to be included/excluded
    • schemaRegistry (schema Url without version)
  • define a detect method on ResourceDetector which returns a resource
  • introduce a detect method on ResourceDetector which takes parameters (all optional):
    • schema url
  • introduce an enabled method on ResourceDetector so sdk can know if it is enabled
  • introduce a schemaRange property (min & Max) on ResourceDetector to return what is supported on enabled detectors so that the sdk can determine what min schema version is to be used in detect
  • define the create method for a resource
  • define the merge method for a resource

Why this is important is currently if a language follows the specs, they would not be implementing resources as part of the api library but just the sdk. The impact of this is all resource detectors would be dependent on the sdk rather than api which we don't want.

I know there is multiple things and would suggest first tackling the define items as these are already in the sdk and then tackling seperately the introduction.

Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    spec:resourceRelated to the specification/resource directory

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions