Skip to content

Commit

Permalink
chore: removing usage of timed event from api (#2183)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Dyla <[email protected]>
  • Loading branch information
obecny and dyladan authored May 11, 2021
1 parent 5f7ec00 commit 805c2e8
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 6 deletions.
3 changes: 1 addition & 2 deletions packages/opentelemetry-exporter-collector/src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ import {
Link,
SpanKind,
SpanStatus,
TimedEvent,
TraceState,
} from '@opentelemetry/api';
import * as core from '@opentelemetry/core';
import { Resource } from '@opentelemetry/resources';
import { ReadableSpan } from '@opentelemetry/tracing';
import { ReadableSpan, TimedEvent } from '@opentelemetry/tracing';
import { CollectorExporterBase } from './CollectorExporterBase';
import {
COLLECTOR_SPAN_KIND_MAPPING,
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-exporter-zipkin/src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import * as api from '@opentelemetry/api';
import { ReadableSpan } from '@opentelemetry/tracing';
import { ReadableSpan, TimedEvent } from '@opentelemetry/tracing';
import { hrTimeToMicroseconds } from '@opentelemetry/core';
import * as zipkinTypes from './types';
import { Resource } from '@opentelemetry/resources';
Expand Down Expand Up @@ -94,7 +94,7 @@ export function _toZipkinTags(
* Converts OpenTelemetry Events to Zipkin Annotations format.
*/
export function _toZipkinAnnotations(
events: api.TimedEvent[]
events: TimedEvent[]
): zipkinTypes.Annotation[] {
return events.map(event => ({
timestamp: hrTimeToMicroseconds(event.time),
Expand Down
3 changes: 2 additions & 1 deletion packages/opentelemetry-tracing/src/Span.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
import { Resource } from '@opentelemetry/resources';
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
import { ReadableSpan } from './export/ReadableSpan';
import { TimedEvent } from './TimedEvent';
import { Tracer } from './Tracer';
import { SpanProcessor } from './SpanProcessor';
import { TraceParams } from './types';
Expand All @@ -43,7 +44,7 @@ export class Span implements api.Span, ReadableSpan {
readonly parentSpanId?: string;
readonly attributes: api.SpanAttributes = {};
readonly links: api.Link[] = [];
readonly events: api.TimedEvent[] = [];
readonly events: TimedEvent[] = [];
readonly startTime: api.HrTime;
readonly resource: Resource;
readonly instrumentationLibrary: InstrumentationLibrary;
Expand Down
29 changes: 29 additions & 0 deletions packages/opentelemetry-tracing/src/TimedEvent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright The 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 { HrTime, SpanAttributes } from '@opentelemetry/api';

/**
* Represents a timed event.
* A timed event is an event with a timestamp.
*/
export interface TimedEvent {
time: HrTime;
/** The name of the event. */
name: string;
/** The attributes of the event. */
attributes?: SpanAttributes;
}
2 changes: 1 addition & 1 deletion packages/opentelemetry-tracing/src/export/ReadableSpan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import {
HrTime,
Link,
SpanContext,
TimedEvent,
} from '@opentelemetry/api';
import { Resource } from '@opentelemetry/resources';
import { InstrumentationLibrary } from '@opentelemetry/core';
import { TimedEvent } from '../TimedEvent';

export interface ReadableSpan {
readonly name: string;
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry-tracing/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ export * from './export/SimpleSpanProcessor';
export * from './export/SpanExporter';
export * from './Span';
export * from './SpanProcessor';
export * from './TimedEvent';
export * from './types';

0 comments on commit 805c2e8

Please sign in to comment.