-
Notifications
You must be signed in to change notification settings - Fork 487
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
component/otelcol: use zap adapter to accept logs from wrapped components #2323
Conversation
…ents This introduces component/otelcol/internal/zapadapter, which creates a *zap.Logger instance from a github.com/go-kit/log.Logger instance. This is then used when creating OpenTelemetry Collector components, allowing us to continue to use github.com/go-kit/log consistently throughout Flow. Related to grafana#2213.
func (fe *fieldEncoder) AddArray(key string, marshaler zapcore.ArrayMarshaler) error { | ||
// TODO(rfratto): allow this to write the value of the array instead of | ||
// placeholder text. | ||
fe.fields = append(fe.fields, fe.keyName(key), "<array>") | ||
return nil | ||
} | ||
|
||
func (fe *fieldEncoder) AddObject(key string, marshaler zapcore.ObjectMarshaler) error { | ||
// TODO(rfratto): allow this to write the value of the object instead of | ||
// placeholder text. | ||
fe.fields = append(fe.fields, fe.keyName(key), "<object>") | ||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't implement these here because:
- I think they're going to be a massive pain.
- I suspect logging arrays and objects is going to be fairly uncommon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some odd underlying things with Zap but overall LHTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This introduces component/otelcol/internal/zapadapter, which creates a *zap.Logger instance from a github.com/go-kit/log.Logger instance. This is then used when creating OpenTelemetry Collector components, allowing us to continue to use github.com/go-kit/log consistently throughout Flow.
Related to #2213.