-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
[translator/azurelogs] Improve performance #39340
base: main
Are you sure you want to change the base?
[translator/azurelogs] Improve performance #39340
Conversation
@@ -227,26 +218,42 @@ func copyPropertiesAndApplySemanticConventions(category string, properties *any, | |||
return | |||
} | |||
|
|||
// TODO: check if this is a valid JSON string and parse it? |
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 have removed this TODO: if we parse as JSON we will lose some fields and it would be a breaking change at this point. I think it will also be worse for performance to unmarshal instead of just iterating over the map. But having any
is an issue for performance we should look at.
…; remove redundant casting
// TODO Add unit test again once bug gets fixed. | ||
// Bug https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/39186#issuecomment-2798517892 | ||
// "log_maximum": { | ||
// logFilename: "log-maximum.json", | ||
// expectedFilename: "log-maximum-expected.yaml", | ||
// }, |
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.
🚨
Description
This PR is only to improve performance, it does not change any functionality or any output as you can see by the passing unit tests.
These are the main changes:
mappings
. It is expensive to look up the field this way. As an alternative, we now have a function that checks the field, and adds that to the attribute. This function is used from the beginning, as we know the category right away.jsoniter
and borrow iterator.Results:
Performance increased in all metrics.
There are still improvements that can be done, but I will not add them to this PR so it won't get too big:
These issues might also get affected by #39186 if it goes forward.
Link to tracking issue
Relates #39119.
Testing
Unit tests and benchmark.