-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid rendering the whole event to get only the provider name (#34914)
**Description:** The code was always getting the event as a XML string that was unmarshalled into a type only to obtain the provider name. That can be done in a cheaper fashion by requesting the `System` properties of the event and reading only the provider name. **Link to tracking Issue:** Fixes #34755 **Testing:** The benchmark below is only good to compare memory usage, which shows that this change is already beneficial. See the changes for the benchmark code. ```terminal goos: windows goarch: amd64 pkg: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/windowseventlogreceiver cpu: Intel(R) Core(TM) i9-10885H CPU @ 2.40GHz │ .\old.txt │ .\pr.txt │ │ sec/op │ sec/op vs base │ ReadWindowsEventLogger/10-16 1.255 ± 0% 1.255 ± 0% ~ (p=0.912 n=10) ReadWindowsEventLogger/100-16 1.379 ± 9% 1.256 ± 0% ~ (p=0.190 n=10) ReadWindowsEventLogger/1_000-16 2.633 ± 5% 2.507 ± 0% ~ (p=0.063 n=10) geomean 1.658 1.581 -4.62% │ .\old.txt │ .\pr.txt │ │ B/op │ B/op vs base │ ReadWindowsEventLogger/10-16 3.228Mi ± 6% 2.190Mi ± 8% -32.17% (p=0.000 n=10) ReadWindowsEventLogger/100-16 5.399Mi ± 42% 2.276Mi ± 4% -57.85% (p=0.000 n=10) ReadWindowsEventLogger/1_000-16 26.12Mi ± 8% 17.66Mi ± 4% -32.38% (p=0.000 n=10) geomean 7.693Mi 4.448Mi -42.18% │ .\old.txt │ .\pr.txt │ │ allocs/op │ allocs/op vs base │ ReadWindowsEventLogger/10-16 67.18k ± 7% 44.74k ± 9% -33.40% (p=0.000 n=10) ReadWindowsEventLogger/100-16 112.87k ± 42% 46.69k ± 4% -58.64% (p=0.000 n=10) ReadWindowsEventLogger/1_000-16 551.6k ± 8% 368.0k ± 4% -33.28% (p=0.000 n=10) geomean 161.1k 91.61k -43.14% ``` **Documentation:** N/A
- Loading branch information
Showing
5 changed files
with
185 additions
and
33 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
.chloggen/avoid_rendering_whole_event_to_obtain_provider_name_windowseventlogreceiver.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Use this changelog template to create an entry for release notes. | ||
|
||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: 'enhancement' | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) | ||
component: windowseventlogreceiver | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Avoid rendering the whole event to obtain the provider name | ||
|
||
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. | ||
issues: [34755] | ||
|
||
# (Optional) One or more lines of additional information to render under the primary note. | ||
# These lines will be padded with 2 spaces and then inserted directly into the document. | ||
# Use pipe (|) for multiline entries. | ||
subtext: | ||
|
||
# If your change doesn't affect end users or the exported elements of any package, | ||
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. | ||
# Optional: The change log or logs in which this entry should be included. | ||
# e.g. '[user]' or '[user, api]' | ||
# Include 'user' if the change is relevant to end users. | ||
# Include 'api' if there is a change to a library API. | ||
# Default: '[user]' | ||
change_logs: [user] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters