Skip to content

Commit

Permalink
chore: removing usage of timed event from api (open-telemetry#470)
Browse files Browse the repository at this point in the history
Co-authored-by: Valentin Marchaud <contact@vmarchaud.fr>
  • Loading branch information
obecny and vmarchaud authored May 8, 2021
1 parent 1386d75 commit 60c015a
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 6 deletions.
18 changes: 15 additions & 3 deletions packages/opentelemetry-test-utils/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

import * as childProcess from 'child_process';
import {
SpanKind,
SpanAttributes,
HrTime,
Span,
SpanAttributes,
SpanKind,
SpanStatus,
TimedEvent,
} from '@opentelemetry/api';
import * as assert from 'assert';
import { ReadableSpan } from '@opentelemetry/tracing';
Expand Down Expand Up @@ -126,3 +126,15 @@ export const assertPropagation = (
);
assert.notStrictEqual(targetSpanContext.spanId, sourceSpanContext.spanId);
};

/**
* 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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
Span,
SpanKind,
SpanStatus,
TimedEvent,
setSpan,
} from '@opentelemetry/api';
import { BasicTracerProvider } from '@opentelemetry/tracing';
Expand All @@ -36,6 +35,7 @@ import * as assert from 'assert';
import * as pg from 'pg';
import * as pgPool from 'pg-pool';
import { AttributeNames } from '../src/enums';
import { TimedEvent } from './types';
import {
SemanticAttributes,
DbSystemValues,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
Span,
SpanKind,
SpanStatus,
TimedEvent,
setSpan,
getSpan,
} from '@opentelemetry/api';
Expand All @@ -36,6 +35,7 @@ import * as assert from 'assert';
import type * as pg from 'pg';
import { PgInstrumentation } from '../src';
import { AttributeNames } from '../src/enums';
import { TimedEvent } from './types';
import {
SemanticAttributes,
DbSystemValues,
Expand Down
29 changes: 29 additions & 0 deletions plugins/node/opentelemetry-instrumentation-pg/test/types.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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
* limitations under the License.
*/

import { context, propagation, TimedEvent } from '@opentelemetry/api';
import {
context,
HrTime,
propagation,
SpanAttributes,
} from '@opentelemetry/api';
import { HttpTraceContext, TRACE_PARENT_HEADER } from '@opentelemetry/core';
import {
BasicTracerProvider,
Expand Down Expand Up @@ -607,3 +612,15 @@ describe('DocumentLoad Instrumentation', () => {
shouldExportCorrectSpan();
});
});

/**
* Represents a timed event.
* A timed event is an event with a timestamp.
*/
interface TimedEvent {
time: HrTime;
/** The name of the event. */
name: string;
/** The attributes of the event. */
attributes?: SpanAttributes;
}

0 comments on commit 60c015a

Please sign in to comment.