-
Notifications
You must be signed in to change notification settings - Fork 839
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
Add SpanExporter Interface #75
Closed
Closed
Changes from all commits
Commits
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
32 changes: 32 additions & 0 deletions
32
packages/opentelemetry-types/src/trace/export/SpanExporter.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Copyright 2019, OpenTelemetry Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { Span } from '../span'; | ||
|
||
/** | ||
* An interface that allows different tracing services to export recorded data | ||
* for sampled spans in their own format. | ||
*/ | ||
export interface SpanExporter { | ||
/** | ||
* Called to export sampled {@link Span}s. | ||
* @param spans the list of sampled Spans to be exported. | ||
*/ | ||
export(spans: Span[]): void; | ||
|
||
/** Stops the exporter. */ | ||
stop(): void; | ||
} |
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.
When is this called? We need spans to be grouped by trace, so unless this is called at the end of every trace it wouldn't work for us.
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 was planning to add a
SpanEventListener
interface to record start and end of the spans. Exporters would use these methods to collect and store spans locally andexport
method would run every few secs to export to backend.Let me know if this makes sense, otherwise please suggest an alternatives.
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'm not sure I understand how this addresses the issue. What we need is to be able to report traces to our backend as traces and not as individual spans. In OpenCensus for example, it's traces that were passed to this method and not individual spans.
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 assume by traces here you mean all of the spans for a given trace that were generated by the process? (Since presumably the full distributed trace is being written by different microservices). Could we implement that behavior by having some kind of buffering adapter that listens for spans and groups them by trace ID and then flushes them once a certain period of time goes by? Or how might the system know that no more spans for a given trace ID within the process will be created?
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, but given the recent discussions it seems that exporters will be responsible for handling the batching, in which case my initial concern is solved.
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.
Cool, yeah, I could imagine some batching utilities that exporters could use for common batching strategies, one of which could be grouping by trace ID
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 need will naturally appear if code starts to be duplicated. In the meantime, I wouldn't try to predict how batching will be done. In our case, we batch in very specific ways to optimize calls as much as possible, so we wouldn't be able to use a generic batch utility.