-
Notifications
You must be signed in to change notification settings - Fork 451
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
Remove unnecessary config marshalling in v1beta1 #2603
Comments
@pavolloffay We can create a hardcoded method: func (c *Config) ToMap() map[string]interface{} {
result := make(map[string]interface{})
result["receivers"] = c.Receivers.Object
result["exporters"] = c.Exporters.Object
if c.Processors != nil {
result["processors"] = c.Processors.Object
}
if c.Connectors != nil {
result["connectors"] = c.Connectors.Object
}
if c.Extensions != nil {
result["extensions"] = c.Extensions.Object
}
serviceMap := make(map[string]interface{})
if c.Service.Extensions != nil {
serviceMap["extensions"] = c.Service.Extensions
}
if c.Service.Telemetry != nil {
serviceMap["telemetry"] = c.Service.Telemetry
}
serviceMap["pipelines"] = c.Service.Pipelines.Object
result["service"] = serviceMap
return result
} Or use serialization method: func (c *Config) ToMap() (map[string]interface{}, error) {
var result map[string]interface{}
v, err := json.Marshal(c)
if err != nil {
return nil, err
}
err = json.Unmarshal(v, &result)
if err != nil {
return nil, err
}
return result, err
} But this will still cause multiple calls to the serialization and deserialization method. BWT, maybe we can replace
|
@crossoverJie yep, already working on this :) |
@jaronoff97 is this done? |
Almost! We still have this code block that we should probably try and fix |
Component(s)
collector
Describe the issue you're reporting
Created from #2532
The text was updated successfully, but these errors were encountered: