Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent SDK from throwing on null instrumentation name (#1941)
CHANGELOG: the SDK will no longer throw an exception with a null instrumentation name on tracers or meters, but this is still not recommended usage. * Provide a default Tracer and Meter for invalid instrumentation names According to the spec, https://github.com/open-telemetry/opentelemetry-specification/blob/v0.6.0/specification/trace/api.md#tracerprovider-operations both a null and empty instrumentation name are invalid and a default implementation should be provided. However, the spec is vague on what default means. See open-telemetry/opentelemetry-specification#586 (comment) This change interprets "default" as meaning, "it should still work, but it's not ideal". Accordingly, a real Tracer or Meter implementation from the SDK is used. It meets the requirements of exporters and such by using a valid instrumentation name. It meets the requirements of application developers by producing valid tracing data. It also warns library and application developers by logging at the WARN level that an invalid value has been given. The rational for this interpretation is that things should always work for the application developer. If an app developer doesn't provide a name, they should be chided, but they are instrumenting their own app, and likely don't care about the lack of name. If an app developer incorporates a library that doesn't specify the instrumentation name, the instrumentation should still be made available to application devs, but they should be able to turn if off (hence a valid name) and be made aware of something not being right (hence the logging) so they can report it to the library maintainers. Fies #1879 * Mark instrumentation version nullable in MeterProvider and TracerProvider The spec dictates this to be optional, and the implementations treat it as nullable already. * Remove ComponentRegistry#get(String) overload This overload is not no longer used by our code. * fixup! Mark instrumentation version nullable in MeterProvider and TracerProvider * fixup! Provide a default Tracer and Meter for invalid instrumentation names * fixup! Provide a default Tracer and Meter for invalid instrumentation names * fixup! Remove ComponentRegistry#get(String) overload This reverts commit db56814 * Revert "Mark instrumentation version nullable in MeterProvider and TracerProvider" This reverts commit 7e92b39
- Loading branch information