-
Notifications
You must be signed in to change notification settings - Fork 779
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
Refactor aggregator and exporters #2295
Merged
cijothomas
merged 20 commits into
open-telemetry:metrics
from
cijothomas:cijothomas/metricexporter_refactor
Sep 2, 2021
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
b7cfe07
Refactor aggregator and exporters
cijothomas 075f2cc
build fix
cijothomas 15b98dc
fix prometheus
cijothomas a169c91
fix format
cijothomas d8b5524
Merge branch 'main' into cijothomas/metricexporter_refactor
cijothomas 0edc3f0
build fix
cijothomas 71e0fef
Merge branch 'main' into cijothomas/metricexporter_refactor
cijothomas 5cefd33
Add histogram to metric point
cijothomas 20d8831
fix
cijothomas 4fa5fdc
console exporter historgram support
cijothomas 2063999
build fix
cijothomas 85dbba7
fix httpclient metric tests
cijothomas 58aaf2d
prometheus histogram fix
cijothomas 83623dc
unwanted doc change revert
cijothomas f190cfa
space
cijothomas 07114a0
Merge branch 'main' into cijothomas/metricexporter_refactor
cijothomas e2690cd
Merge branch 'metrics' into cijothomas/metricexporter_refactor
cijothomas 1b7323c
cleanup
cijothomas 8142a92
add todo for unknown instrument
cijothomas fbc8992
unwanted using
cijothomas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think 1) metrics exporter will always run in a separate thread (unlike trace/log exporter which might run in the hot path - e.g. SimpleExportingProcessor) 2) metrics exporter will only be triggered at a much lower frequency (unlike trace/log exporter which might get triggered for every single event), so it might be actually easier if we define this as
IEnumerable<Metric>
.I understand that there might be a desire to have
ConsoleExporter<T>
which covers logs/metrics/traces (for sake of consistency).@CodeBlanch do you have strong opinion on this? (look at the change on the
src/OpenTelemetry/Batch.cs
, do you think the extra if-condition could slow down traces/logs?)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.
Yes agree to make this simpler with just
IEnumerable
, so we won't affect the other signals's hot path.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.
Could we do
IList<T>
instead ofIEnumerable<T>
? With that we could at least do afor (int i = 0; i < list.Count; i++) { var item = list[i]; }
type of loop that doesn't allocate an enumerator. Or we could even pass the array directly. Array doesn't have a struct enumerator but AFAIK the JIT is smart enough to re-write a foreach loop on an array to be allocation-free.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 don't know if we will be able to tell the count of metrics or not, if we could, IList definitely works better.
I guess array won't work since it assumes certain memory layout. For example, if we pre-allocate memory and keep reusing them, we would need to compact the pre-allocated aggregation buffer before exporting (and that seems to be expensive).
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.
https://github.com/open-telemetry/opentelemetry-dotnet/pull/2306/files#diff-4d53a254dbe35c9d4bcfd7b6523549ab07b5372f3493d79b76797c724720cf75R170
I added a comment about this in the follow up PR.
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.
We could also pass a ReadOnlySpan over the array?