-
Notifications
You must be signed in to change notification settings - Fork 772
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 exporter - step 1 #1078
Conversation
/// </summary> | ||
/// <param name="batch">Batch of activities to export.</param> | ||
/// <returns>Result of export.</returns> | ||
public abstract ExportResult Export(IEnumerable<Activity> batch); |
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 this IEnumerable
should be replaced with something that doesn't have heap allocation, not trying to cover it in this 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.
❤️ this! Just got this merged so we can prevent allocations doing foreach
s on the Activity data (tags, links, events, etc.): dotnet/runtime#40544
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.
#1080 for tracking.
Codecov Report
@@ Coverage Diff @@
## master #1078 +/- ##
==========================================
- Coverage 77.40% 77.33% -0.07%
==========================================
Files 220 221 +1
Lines 6080 6085 +5
==========================================
Hits 4706 4706
- Misses 1374 1379 +5
|
/// <summary> | ||
/// Enumeration used to define the result of an export operation. | ||
/// </summary> | ||
public enum ExportResultSync |
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.
should we simply use a bool to indicate success/failure?
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 guess we want to keep close to the spec.
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.
Now I wonder why spec didn't simply use a boolean? I guess its leftover from old behavior where ExportResult had more than 2 possible values!
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 guess it leaves the room so in the future folks can add more value.
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.
mm.. Is there any value in Export() returning anything at all? I mean, irrespective of the return value, the Processor simply moves on to next batch. Is it to let Processor do some logging that batch is being dropped? Or to allow future possibilities..
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 see BIG value, but I do see value - for example - the processor could log an internal error, or the processor can use this indication to report exporting statistics (e.g. metrics telling folks how many activities are exported successfully vs. dropped).
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.
the processor could log an internal error, or the processor can use this indication to report exporting statistics
These are definitely interesting use cases, but seems to me to be more of a concern for the exporter itself since it has the underlying knowledge of either the error or statistics.
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 agree.
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.
ok. lets stick with spec and keep enum with 2 values for now :)
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.
LGTM. Will wait till end of day to get additional feedback before merging.
The spec says "Export() must not block indefinitely, there must be a reasonable upper limit after which the call must time out with an error result (Failure).". I'm curious what is considered |
I've seen 15 seconds, 1 minutes and some value in between :) |
@reyang Plan looks solid to me. |
Trying to fix several issues in the current exporter design. Related to #896 and #896 (comment).
The overall thinking:
SimpleActivityProcessor
should be renamed toSimpleExportActivityProcessor
to avoid the confusion (and the same for batch exporter) - OpenTelemetry Python is doing the right job here.maxExportBatchSize
should be enforced - the exporter should never receive a batch with more thanmaxExportBatchSize
items specified in theBatchExportActivityProcessor
.Changes
ActivityExporterSync
, which I plan to replace the currentActivityExporter
in the next couple PRs (and rename back toActivityExporter
after the refactor is done).Success
andFailure
, as the spec is saying there are only two values.For significant contributions please make sure you have completed the following items: