-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Log KeyValue Kind: KindError #5909
Comments
If this is acceptable approach, I could work on the PR for it (as well as the subsequent PRs in https://github.com/open-telemetry/opentelemetry-go-contrib that would want to be updated to use the new Kind) |
I feel like this would break the specification requirements: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/data-model.md#type-any @pellared what do you think about this proposal? |
@Jesse0Michael, first of all, thanks for raising the issue. I agree with @dmathieu that this would be not compliant with the specification. The SDK is designed to support the OpenTelemetry data-model and be compliant with the specification (see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/sdk.md#additional-logrecord-interfaces). Therefore, it does not have kinds for all the core/common Go types. We could say that we also lack If you think that the current design is not good (e.g. not user friendly), feel free to create an issue in https://github.com/open-telemetry/opentelemetry-specification so we can discuss it further.
I think currently this is the way to go... E.g. decorate https://pkg.go.dev/go.opentelemetry.io/contrib/bridges/otelslog. |
@Jesse0Michael should we close this issue? |
@dmathieu, I think we can discuss it further. Maybe the API could accept a generic |
Problem Statement
I am trying to write a custom Log Record Processor that will look at the record attributes for a KeyValue containing an
error
, and, if the record severity >= Error and it found anerror
Value that matches criteria included when configuring the processor, downgrade the severity to a Warn.This is something I've done in other logging solutions with hooks or handlers. But I'm unable to write an otel Log Processor because there is no way to pull the
error
that was used as a log attribute, because theerror
value is converted to a string.example: If the error is a context.Canceled, downgrade the severity of the log to a Warn
Proposed Solution
Would it be alright to add a new
KindError
to the log KeyValue KindsWith supported
func Error(key string, value error) KeyValue
andfunc ErrorValue(v error) Value
andfunc (v Value) AsError() error
functions.The text was updated successfully, but these errors were encountered: