-
Notifications
You must be signed in to change notification settings - Fork 16
Add new option for multiple attributes in topic attribute functions (metrics and logs) #696
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
Conversation
|
vigneshshanmugam
left a comment
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.
Lets not do this as a breaking change for both MIS and MOTel, Maybe introduce new methods on the kafka config and deprecate the old ones.
|
@vigneshshanmugam It is no longer a breaking change now, both options are supported |
| assert.NotNil(t, cfg.TopicAttributeFunc) | ||
| cfg.TopicAttributeFunc = 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.
Since we wrap this function with multiple attributes, this is no longer valid, so I removed the check
kafka/manager.go
Outdated
| for _, response := range responses.Sorted() { | ||
| topic := strings.TrimPrefix(response.Topic, namespacePrefix) | ||
| logger := m.cfg.Logger.With(zap.String("topic", topic)) | ||
| if m.cfg.TopicLogFieldFunc != 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.
suggestion: we should remove usage of the deprecated func everywhere since it will be converted to the new func during creation
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 can't do that here because this is a field that is exportable and it would be a breaking change
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.
It should be fine, the constructor for the manager takes care of migrating the old func to the new one. Am I missing something ?
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.
First I must say I am not familiar at all with where this code is being used.
But looking at the MOTel controller (which was what brought me here), it uses this variable: https://github.com/elastic/hosted-otel-controller/blob/66ffdebb8a868d61501e93a8d5b0922eb849b509/internal/queuemanager/kafka.go#L50. I am afraid other services are using it as well
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.
that's ok, NewManager will take care of converting them to the new func during init. The internal code should then only use the new func
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.
You are totally right, I removed all usages of the deprecated functions, apart from the declaration in CommonConfig and merging them on finalize. I updated the test, it should all be working now.
Thank you so much for such careful review!! :)


This would be a breaking change.
Relates to https://github.com/elastic/hosted-otel-controller/pull/173#discussion_r2299185735.