Remove validation for telemetry logger encoding (#4533)
This commit is contained in:
parent
eb6f0519e8
commit
1aa81d75e5
|
@ -16,6 +16,7 @@
|
|||
- `confighttp`: add client-side compression support. (#4441)
|
||||
- Each exporter should remove `compression` field if they have and should use `confighttp.HTTPClientSettings`
|
||||
- Allow more zap logger configs: `disable_caller`, `disable_stacktrace`, `output_paths`, `error_output_paths`, `initial_fields` (#1048)
|
||||
- Allow the custom zap logger encoding (#4532)
|
||||
- Collector self-metrics may now be configured through the configuration file. (#4069)
|
||||
- CLI flags for configuring self-metrics are deprecated and will be removed
|
||||
in a future release.
|
||||
|
|
|
@ -85,6 +85,15 @@ func TestConfigValidate(t *testing.T) {
|
|||
cfgFn: generateConfig,
|
||||
expected: nil,
|
||||
},
|
||||
{
|
||||
name: "custom-service-telemetry-encoding",
|
||||
cfgFn: func() *Config {
|
||||
cfg := generateConfig()
|
||||
cfg.Service.Telemetry.Logs.Encoding = "test_encoding"
|
||||
return cfg
|
||||
},
|
||||
expected: nil,
|
||||
},
|
||||
{
|
||||
name: "missing-exporters",
|
||||
cfgFn: func() *Config {
|
||||
|
@ -215,15 +224,6 @@ func TestConfigValidate(t *testing.T) {
|
|||
},
|
||||
expected: fmt.Errorf(`extension "nop" has invalid configuration: %w`, errInvalidExtConfig),
|
||||
},
|
||||
{
|
||||
name: "invalid-service-telemetry-encoding",
|
||||
cfgFn: func() *Config {
|
||||
cfg := generateConfig()
|
||||
cfg.Service.Telemetry.Logs.Encoding = "unknown"
|
||||
return cfg
|
||||
},
|
||||
expected: errors.New(`service telemetry logs invalid encoding: "unknown", valid values are "json" and "console"`),
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range testCases {
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
package config // import "go.opentelemetry.io/collector/config"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"go.uber.org/zap/zapcore"
|
||||
|
||||
"go.opentelemetry.io/collector/config/configtelemetry"
|
||||
|
@ -41,10 +39,6 @@ type ServiceTelemetry struct {
|
|||
}
|
||||
|
||||
func (srvT *ServiceTelemetry) validate() error {
|
||||
if err := srvT.Logs.validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return srvT.Metrics.validate()
|
||||
}
|
||||
|
||||
|
@ -62,8 +56,7 @@ type ServiceTelemetryLogs struct {
|
|||
Development bool `mapstructure:"development"`
|
||||
|
||||
// Encoding sets the logger's encoding.
|
||||
// Valid values are "json" and "console".
|
||||
// (default = "console")
|
||||
// Example values are "json", "console".
|
||||
Encoding string `mapstructure:"encoding"`
|
||||
|
||||
// DisableCaller stops annotating logs with the calling function's file
|
||||
|
@ -107,13 +100,6 @@ type ServiceTelemetryLogs struct {
|
|||
InitialFields map[string]interface{} `mapstructure:"initial_fields"`
|
||||
}
|
||||
|
||||
func (srvTL *ServiceTelemetryLogs) validate() error {
|
||||
if srvTL.Encoding != "json" && srvTL.Encoding != "console" {
|
||||
return fmt.Errorf(`service telemetry logs invalid encoding: %q, valid values are "json" and "console"`, srvTL.Encoding)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ServiceTelemetryMetrics exposes the common Telemetry configuration for one component.
|
||||
// Experimental: *NOTE* this structure is subject to change or removal in the future.
|
||||
type ServiceTelemetryMetrics struct {
|
||||
|
|
Loading…
Reference in New Issue