Skip to content
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

Migrate ZipkinExporter to BatchExportActivityProcessor #1103

Merged
merged 5 commits into from Aug 20, 2020

Conversation

reyang
Copy link
Member

@reyang reyang commented Aug 20, 2020

Related to #1078.

Changes

  • Moved the existing Zipkin exporter to the lock-free circular buffer and zero-alloc foreach.

Please provide a brief description of the changes here. Update the
CHANGELOG.md for non-trivial changes.

For significant contributions please make sure you have completed the following items:

  • Design discussion issue #
  • Changes in public API reviewed

@reyang reyang requested a review from a team as a code owner August 20, 2020 00:55

return ExportResult.Success;
return ExportResultSync.Success;
}
catch (Exception ex)
{
ZipkinExporterEventSource.Log.FailedExport(ex);

// TODO distinguish retryable exceptions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still a relevant TODO?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont think so. but not because of this PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it is still a TODO, the scheduler and flush (and potentially offline storage) part still needs to be improved.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes to that part.

I meant that there is no distinct return type for Failed vs FailedButRetryable. Spec was modified to have only 2 return types back to Processor- Success or Failure.

https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/sdk.md#span-exporter

@eddynaka
Copy link
Contributor

@reyang , are we going to move all exporters to the new batch implementation?

@reyang
Copy link
Member Author

reyang commented Aug 20, 2020

@reyang , are we going to move all exporters to the new batch implementation?

Yes, the old one has unbounded behavior such like shooting random Tasks, we'll remove the old one once we've moved everything over.

@eddynaka
Copy link
Contributor

@reyang , are we going to move all exporters to the new batch implementation?

Yes, the old one has unbounded behavior such like shooting random Tasks, we'll remove the old one once we've moved everything over.

Ok! I can help you with the other exporters :)

@codecov
Copy link

codecov bot commented Aug 20, 2020

Codecov Report

Merging #1103 into master will increase coverage by 1.34%.
The diff coverage is 85.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1103      +/-   ##
==========================================
+ Coverage   74.71%   76.05%   +1.34%     
==========================================
  Files         223      223              
  Lines        6379     6381       +2     
==========================================
+ Hits         4766     4853      +87     
+ Misses       1613     1528      -85     
Impacted Files Coverage Δ
...rc/OpenTelemetry.Exporter.Zipkin/ZipkinExporter.cs 86.84% <83.33%> (+0.35%) ⬆️
....Exporter.Zipkin/ZipkinExporterHelperExtensions.cs 100.00% <100.00%> (ø)
...us/Implementation/PrometheusExporterEventSource.cs 63.63% <0.00%> (-9.10%) ⬇️
...nTelemetry/Internal/OpenTelemetrySdkEventSource.cs 82.35% <0.00%> (+1.47%) ⬆️
...mentation.Http/HttpClientInstrumentationOptions.cs 100.00% <0.00%> (+4.16%) ⬆️
...elemetry/Trace/ReentrantExportActivityProcessor.cs 27.27% <0.00%> (+27.27%) ⬆️
...penTelemetry/Trace/BatchExportActivityProcessor.cs 36.36% <0.00%> (+36.36%) ⬆️
src/OpenTelemetry/Internal/CircularBuffer.cs 43.18% <0.00%> (+43.18%) ⬆️
src/OpenTelemetry/Batch.cs 55.55% <0.00%> (+55.55%) ⬆️
...enTelemetry/Trace/SimpleExportActivityProcessor.cs 100.00% <0.00%> (+100.00%) ⬆️

@reyang reyang changed the title Migrate zipkin exporter to BatchExportActivityProcessor Migrate Zipkin exporter to BatchExportActivityProcessor Aug 20, 2020
@reyang reyang changed the title Migrate Zipkin exporter to BatchExportActivityProcessor Migrate ZipkinExporter to BatchExportActivityProcessor Aug 20, 2020
{
try
{
await this.SendBatchActivityAsync(batchActivity, cancellationToken).ConfigureAwait(false);
// take a snapshot of the batch
var activities = new List<Activity>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of work to avoid allocations just to allocate 🤣 What's the plan here?

Copy link
Member Author

@reyang reyang Aug 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plan is to change the serializer to take the zero-alloc foreach (and potentially streaming JSON writer) instead of IEnumerator.
For now, the immediate goal is to migrate/clean up so we have a stable API for Beta-2, and do micro optimization in separate PRs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good I figured you would have a plan for it.

Copy link
Member

@CodeBlanch CodeBlanch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cijothomas cijothomas merged commit b4ce36f into master Aug 20, 2020
@cijothomas cijothomas deleted the reyang/zipkin branch August 20, 2020 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants