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.
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.
❤️ this! Just got this merged so we can prevent allocations doing foreachs on the Activity data (tags, links, events, etc.): dotnet/runtime#40544
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.
should we simply use a bool to indicate success/failure?
There was a problem hiding this comment.
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.
I guess it leaves the room so in the future folks can add more value.
There was a problem hiding this comment.
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.
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.
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.
ok. lets stick with spec and keep enum with 2 values for now :)
cijothomas
left a comment
There was a problem hiding this comment.
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:
SimpleActivityProcessorshould be renamed toSimpleExportActivityProcessorto avoid the confusion (and the same for batch exporter) - OpenTelemetry Python is doing the right job here.maxExportBatchSizeshould be enforced - the exporter should never receive a batch with more thanmaxExportBatchSizeitems specified in theBatchExportActivityProcessor.Changes
ActivityExporterSync, which I plan to replace the currentActivityExporterin the next couple PRs (and rename back toActivityExporterafter the refactor is done).SuccessandFailure, as the spec is saying there are only two values.For significant contributions please make sure you have completed the following items: