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

feat: add InMemorySpanExporter, MultiSpanProcessor #234

Merged
merged 2 commits into from
Sep 9, 2019

Conversation

mayurkale22
Copy link
Member

Which problem is this PR solving?

Short description of the changes

  • This PR introduces the InMemorySpanExporter, it can be used for testing purposes, especially in the plugins. It stores the exported spans in a list in memory.
  • SDK Usage (example):
  const memoryExporter = new InMemorySpanExporter();
  const tracer = new BasicTracer({
    scopeManager: new NoopScopeManager(),
  });
  // register simple processor with InMemoryExporter
   tracer.addSpanProcessor(new SimpleSpanProcessor(memoryExporter));

  // register batch processor with Jaeger Exporter
  // tracer.addSpanProcessor(new BatchSpanProcessor(jaegerExporter));
  • I will open another PR to add Batching processor (BatchSpanProcessor).

@codecov-io
Copy link

codecov-io commented Sep 4, 2019

Codecov Report

Merging #234 into master will decrease coverage by <.01%.
The diff coverage is 99.2%.

@@            Coverage Diff             @@
##           master     #234      +/-   ##
==========================================
- Coverage   98.78%   98.78%   -0.01%     
==========================================
  Files          55       60       +5     
  Lines        2146     2221      +75     
  Branches      147      152       +5     
==========================================
+ Hits         2120     2194      +74     
- Misses         26       27       +1
Impacted Files Coverage Δ
...entelemetry-basic-tracer/src/MultiSpanProcessor.ts 100% <100%> (ø)
...ages/opentelemetry-basic-tracer/src/BasicTracer.ts 98.36% <100%> (+0.21%) ⬆️
...ry-basic-tracer/src/export/InMemorySpanExporter.ts 100% <100%> (ø)
...metry-basic-tracer/test/MultiSpanProcessor.test.ts 100% <100%> (ø)
packages/opentelemetry-basic-tracer/src/Span.ts 100% <100%> (ø) ⬆️
...ic-tracer/test/export/InMemorySpanExporter.test.ts 100% <100%> (ø)
...pentelemetry-basic-tracer/src/NoopSpanProcessor.ts 75% <75%> (ø)
...kages/opentelemetry-basic-tracer/test/Span.test.ts 100% <0%> (ø) ⬆️
...sic-tracer/test/export/SimpleSpanProcessor.test.ts 100% <0%> (ø) ⬆️
... and 4 more

this._finishedSpan = [];
}

reset() {
Copy link
Member

Choose a reason for hiding this comment

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

stopped = false?

Copy link
Member Author

Choose a reason for hiding this comment

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

reset is just to clean the collected spans. If we make it stopped = false, it won't export/collect any spans after reset.

Copy link
Member

@OlivierAlbertini OlivierAlbertini left a comment

Choose a reason for hiding this comment

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

LGTM. Good job!

@mayurkale22
Copy link
Member Author

/cc @hekike Please review. You may need to make a few minor changes in Zipkin exporter PR (#192) based on this.

@mayurkale22 mayurkale22 merged commit c8a37be into open-telemetry:master Sep 9, 2019
@mayurkale22 mayurkale22 deleted the multispanprocessor branch September 9, 2019 16:50
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.

5 participants