Skip to content

Conversation

@constanca-m
Copy link
Contributor

@github-actions
Copy link

⚠️ Warning

System-tests will not be executed for this PR because it is from a forked repository.
But it will still create a successful run-system-tests status check.

Copy link
Member

@vigneshshanmugam vigneshshanmugam left a 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.

@constanca-m constanca-m marked this pull request as ready for review August 27, 2025 08:34
@constanca-m
Copy link
Contributor Author

@vigneshshanmugam It is no longer a breaking change now, both options are supported

@constanca-m constanca-m changed the title Add multiple attributes in topic attribute function Add new option for multiple attributes in topic attribute functions (metrics and logs) Aug 27, 2025
Comment on lines -910 to -911
assert.NotNil(t, cfg.TopicAttributeFunc)
cfg.TopicAttributeFunc = nil
Copy link
Contributor Author

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

@constanca-m
Copy link
Contributor Author

constanca-m commented Aug 27, 2025

Not sure why ci/run-tests is failing, running locally works fine:

image

And

image

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 {
Copy link
Member

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

Copy link
Contributor Author

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

Copy link
Member

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 ?

Copy link
Contributor Author

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

Copy link
Member

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

Copy link
Contributor Author

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!! :)

@kruskall kruskall enabled auto-merge (squash) September 3, 2025 15:14
@kruskall kruskall merged commit ceb5909 into elastic:main Sep 3, 2025
4 checks passed
@constanca-m constanca-m deleted the add-multiple-attributes branch September 3, 2025 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants