-
Notifications
You must be signed in to change notification settings - Fork 71
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
Create otel_logging_supported_config
feature tracking metric.
#1861
base: master
Are you sure you want to change the base?
Create otel_logging_supported_config
feature tracking metric.
#1861
Conversation
otel_logging_support
feature tracking metric.otel_logging_support
feature tracking metric.
otel_logging_support
feature tracking metric.otel_logging_compatible_config
feature tracking metric.
confgenerator/config.go
Outdated
} | ||
validProcessors := map[string]OTelProcessor{} | ||
for k, v := range processors { | ||
if v, ok := v.(OTelProcessor); ok { |
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.
This doesn't actually check if the processor is supported, only if it might be supported.
Instead of doing all this work to separately validate, I would just clone the config, set the experimental flag, and see if generating causes an error:
func (uc *UnifiedConfig) OTelLoggingSupported() bool {
uc2 := uc.DeepCopy(ctx)
if uc2.Logging == nil {
return false
}
if uc2.Logging.Service == nil {
uc2.Logging.Service = &Service{}
}
uc2.Logging.Service.OTelLogging = true
_, err := uc2.GenerateOtelConfig(ctx)
return err == 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.
If you wanted it per-pipeline, you could do
pipelines, err := uc.Pipelines(ctx)
if err != nil {
return nil, nil, err
}
for name, pipeline := range pipelines {
_, _, err := pipeline.otelComponents(ctx)
supported[name] = err == 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 decided to only check the whole config
and not consider individual pipelines for the current PR.
IMO, feature tracking about individual pipelines would not be very helpful for our goal (getting statistics of OTel logging supported configs), since it would require several additional metric labels to describe the pipeline in detail (which receivers, processors or features are unsupported for each pipeline).
I think it would be simpler to track specific unsupported receivers or processors, not tied to a specific pipeline. We can consider if this data is needed in the future. I consider this additional labels about which specific feature is not supported is out of scope of this initial task / PR and could added later if need.
confgenerator/feature_tracking.go
Outdated
Value: "false", | ||
} | ||
|
||
ctx := context.Background() |
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.
This needs to be the Context
from the unit test, not context.Background()
. It looks like that needs to be passed into ExtractFeatures
.
@@ -101,11 +112,8 @@ func (uc *UnifiedConfig) GenerateOtelConfig(ctx context.Context) (string, error) | |||
ReceiverPipelineName: "fluentbit", | |||
} | |||
|
|||
if uc.Metrics.Service.LogLevel == "" { |
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.
Your current diff will cause the logging log level to override the metrics log level. I think we should stick with the existing behavior of only using the metrics log level, which you could do with
logLevel := "info"
if uc.Metrics != nil && uc.Metrics.Service != nil && uc.Metrics.Service.LogLevel != "" {
logLevel = uc.Metrics.Service.LogLevel
}
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.
Done.
confgenerator/config.go
Outdated
@@ -907,15 +907,17 @@ func (uc *UnifiedConfig) ValidateCombined() error { | |||
|
|||
func (uc *UnifiedConfig) MetricsReceivers() (map[string]MetricsReceiver, error) { | |||
validReceivers := map[string]MetricsReceiver{} | |||
if uc.Metrics != nil { | |||
if uc.Metrics != nil && uc.Metrics.Receivers != 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.
This is unnecessary; it's valid to iterate over a nil
map.
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.
Removed the uc.Metrics.Receivers != nil
. Done.
confgenerator/config.go
Outdated
for k, v := range uc.Metrics.Receivers { | ||
validReceivers[k] = v | ||
} | ||
} | ||
if uc.Combined != nil { | ||
for k, v := range uc.Combined.Receivers { | ||
if _, ok := uc.Metrics.Receivers[k]; ok { | ||
return nil, fmt.Errorf("metrics receiver %q has the same name as combined receiver %q", k, k) | ||
if uc.Metrics != nil && uc.Metrics.Receivers != 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.
This only needs to be if uc.Metrics != nil
; subscripting a nil
map is valid.
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.
Removed the uc.Metrics.Receivers != nil. Done.
otel_logging_compatible_config
feature tracking metric.otel_logging_supported_config
feature tracking metric.
a3341e2
to
73a24db
Compare
Description
Create
otel_logging_support
feature tracking metric.Related issue
b/390671495
How has this been tested?
Checklist: