File tree Expand file tree Collapse file tree 1 file changed +38
-3
lines changed
packages/opentelemetry-node/src Expand file tree Collapse file tree 1 file changed +38
-3
lines changed Original file line number Diff line number Diff line change
1
+ import { Context } from '@opentelemetry/api' ;
2
+ import { Span as OtelSpan , SpanProcessor as OtelSpanProcessor } from '@opentelemetry/sdk-trace-base' ;
3
+ import { getCurrentHub } from '@sentry/core' ;
4
+
1
5
/**
2
- * Test function
6
+ * Converts OpenTelemetry Spans to Sentry Spans and sends them to Sentry via
7
+ * the Sentry SDK.
3
8
*/
4
- export function test ( ) : void {
5
- // no-op
9
+ export class SentrySpanProcessor implements OtelSpanProcessor {
10
+ /**
11
+ * @inheritDoc
12
+ */
13
+ public onStart ( span : OtelSpan , parentContext : Context ) : void {
14
+ // do something
15
+ }
16
+
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ public onEnd ( span : OtelSpan ) : void {
21
+ // do something
22
+ }
23
+
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ public shutdown ( ) : Promise < void > {
28
+ return Promise . resolve ( ) ;
29
+ }
30
+
31
+ /**
32
+ * @inheritDoc
33
+ */
34
+ public async forceFlush ( ) : Promise < void > {
35
+ const client = getCurrentHub ( ) . getClient ( ) ;
36
+ if ( client ) {
37
+ return client . flush ( ) . then ( ) ;
38
+ }
39
+ return Promise . resolve ( ) ;
40
+ }
6
41
}
You can’t perform that action at this time.
0 commit comments