opentelemetry-configuration icon indicating copy to clipboard operation
opentelemetry-configuration copied to clipboard

add support for instrumentation configuration?

Open brettmc opened this issue 1 year ago • 5 comments

Over in PHP SIG, we've started to implement file-based configuration, and it's going well. We also have a requirement where some of our automatic instrumentation modules require configuration. So, following the file-configuration way of thinking, we're enabling this through a secondary .yaml file, along with another env var to point to the file. For example, OTEL_PHP_INSTRUMENTATION_CONFIG_FILE=otel-instrumentation.yaml:

config:
  - example_instrumentation:
      span_name: ${EXAMPLE_INSTRUMENTATION_SPAN_NAME:-example span}
  - another_instrumentation:
      enabled: false
      foo_param: "some.value"

Could something like this be incorporated into the SDK configuration schema, for example under an instrumentation key?

brettmc avatar May 09 '24 05:05 brettmc

Could something like this be incorporated into the SDK configuration schema, for example under an instrumentation key?

Yes I think so. There are a couple of things to think through:

  • What configuration is language / framework agnostic enough to warrant inclusion in the schema?
  • How should we accommodate language / framework specific configuration?
  • How does instrumentation access the configuration? We talked about this in the 5/13/24 config working group and one idea was to add API surface area for configuration, such that instrumentation could access configuration from a global. We could expose something like the component provider properties type, and potentially some helper methods for instrumentation to resolve certain common configuration given a generic configuration type.

I think a good starting point is to include a handful of obvious generic instrumentation configuration properties in the schema, and work through some of these questions during that PR and in followups. One that @trask brought up was which headers should be captured for http semantic conventions. There are probably others.

Would you be willing to open a PR?

jack-berg avatar May 16 '24 20:05 jack-berg

https://github.com/open-telemetry/opentelemetry-specification/issues/3560 is another example of instrumentation config.

jack-berg avatar May 16 '24 20:05 jack-berg

Related to https://github.com/open-telemetry/opentelemetry-specification/issues/3535.

jack-berg avatar May 16 '24 20:05 jack-berg

An old related issue where we tried to compile examples of instrumentation configuration: https://github.com/MrAlias/otel-schema/issues/8

jack-berg avatar May 16 '24 20:05 jack-berg

Would you be willing to open a PR?

Yes. I'll start to play around with it to see how I can achieve something basic first. I like the idea of having some generic/common properties - headers to capture is one that PHP also requires across a couple of different instrumentation packages.

brettmc avatar May 19 '24 10:05 brettmc