Skip to content

Commit

Permalink
feat: add span processor (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
mayurkale22 authored Aug 22, 2019
1 parent 7f5d71b commit b208b2b
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
43 changes: 43 additions & 0 deletions packages/opentelemetry-basic-tracer/src/SpanProcessor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* 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 '@opentelemetry/types';

/**
* SpanProcessor is the interface Tracer SDK uses to allow synchronous hooks
* for when a {@link Span} is started or when a {@link Span} is ended.
*/
export interface SpanProcessor {
/**
* Called when a {@link Span} is started, if the `span.isRecordingEvents()`
* returns true.
* @param span the Span that just started.
*/
onStart(span: Span): void;

/**
* Called when a {@link Span} is ended, if the `span.isRecordingEvents()`
* returns true.
* @param span the Span that just ended.
*/
onEnd(span: Span): void;

/**
* Shuts down the processor. Called when SDK is shut down. This is an
* opportunity for processor to do any cleanup required.
*/
shutdown(): void;
}
1 change: 1 addition & 0 deletions packages/opentelemetry-basic-tracer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ export * from './export/SpanExporter';
export * from './types';
export * from './BasicTracer';
export * from './Span';
export * from './SpanProcessor';

0 comments on commit b208b2b

Please sign in to comment.