Skip to content

Commit

Permalink
Revert open-telemetry#3134 - remove anchored clock
Browse files Browse the repository at this point in the history
  • Loading branch information
dyladan committed Oct 25, 2022
1 parent 4420402 commit cf9111e
Showing 1 changed file with 5 additions and 25 deletions.
30 changes: 5 additions & 25 deletions packages/opentelemetry-sdk-trace-base/src/Tracer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,16 @@
*/

import * as api from '@opentelemetry/api';
import {
InstrumentationLibrary,
sanitizeAttributes,
isTracingSuppressed,
AnchoredClock,
otperformance,
} from '@opentelemetry/core';
import { InstrumentationLibrary, isTracingSuppressed, sanitizeAttributes } from '@opentelemetry/core';
import { Resource } from '@opentelemetry/resources';
import { BasicTracerProvider } from './BasicTracerProvider';
import { IdGenerator } from './IdGenerator';
import { RandomIdGenerator } from './platform';
import { Sampler } from './Sampler';
import { Span } from './Span';
import { SpanProcessor } from './SpanProcessor';
import { GeneralLimits, SpanLimits, TracerConfig } from './types';
import { mergeConfig } from './utility';
import { SpanProcessor } from './SpanProcessor';
import { Sampler } from './Sampler';
import { IdGenerator } from './IdGenerator';
import { RandomIdGenerator } from './platform';

/**
* This class represents a basic tracer.
Expand Down Expand Up @@ -74,22 +68,10 @@ export class Tracer implements api.Tracer {
context = api.trace.deleteSpan(context);
}
const parentSpan = api.trace.getSpan(context);
let clock: AnchoredClock | undefined;
if (parentSpan) {
clock = (parentSpan as any)['_clock'];
}

if (!clock) {
clock = new AnchoredClock(Date, otperformance);
if (parentSpan) {
(parentSpan as any)['_clock'] = clock;
}
}

if (isTracingSuppressed(context)) {
api.diag.debug('Instrumentation suppressed, returning Noop Span');
const nonRecordingSpan = api.trace.wrapSpanContext(api.INVALID_SPAN_CONTEXT);
(nonRecordingSpan as any)['_clock'] = clock;
return nonRecordingSpan;
}

Expand Down Expand Up @@ -134,7 +116,6 @@ export class Tracer implements api.Tracer {
if (samplingResult.decision === api.SamplingDecision.NOT_RECORD) {
api.diag.debug('Recording is off, propagating context in a non-recording span');
const nonRecordingSpan = api.trace.wrapSpanContext(spanContext);
(nonRecordingSpan as any)['_clock'] = clock;
return nonRecordingSpan;
}

Expand All @@ -147,7 +128,6 @@ export class Tracer implements api.Tracer {
parentSpanId,
links,
options.startTime,
clock,
);
// Set initial span attributes. The attributes object may have been mutated
// by the sampler, so we sanitize the merged attributes before setting them.
Expand Down

0 comments on commit cf9111e

Please sign in to comment.