opentelemetry-dotnet-instrumentation
opentelemetry-dotnet-instrumentation copied to clipboard
Fail fast vs silently continue for wrong env var values
Discussion
References
- "if the user provides a value the SDK does not recognize, the SDK MUST generate a warning and gracefully ignore the setting" - https://github.com/open-telemetry/opentelemetry-specification/blob/1fd2db2ad56668959a2dc99551b76d0ff2fc1e9e/specification/sdk-environment-variables.md?plain=1#L24
- "The API or SDK MAY fail fast and cause the application to fail on initialization, e.g. because of a bad user config or environment, but MUST NOT cause the application to fail later at run time, e.g. due to dynamic config settings received from the Collector." - https://github.com/open-telemetry/opentelemetry-specification/blob/1fd2db2ad56668959a2dc99551b76d0ff2fc1e9e/specification/error-handling.md?plain=1#L18
- #875
Solution
Our current solution is to fail fast when given values does not met requirements. There is a second option, silently ignore problems (proffered by sdk-env-variables).
We should decide if we stick with current approach or we change it.
From my "spec reading" understanding is that the first rule (regarding enum values parsing) overrides the second (regarding initialization error handling) as:
-
MUST
is stronger thanMAY
- it is a more concrete scenario
However, I prefer the current behavior as it clearly "shouts" that the given configuration is not supported.
Is it something that should be discussed with the OTel Specification SIG?
@mtwo, do you have any comment here? Could you please share with OTel Specification SIG, if needed?
@Kielek do you feel comfortable presenting this at the spec SIG yourself (I can join as well!)? I'll have trouble presenting it with specific examples of where this has been a problem
PR created https://github.com/open-telemetry/opentelemetry-specification/pull/2766
@open-telemetry/dotnet-instrumentation-approvers
It looks as if it is not a problem as the spec defined the behavior for SDK and not for automatic instrumentation.
Closign per SIG discussion.