Skip to content

Commit

Permalink
chore(instrumentation-express): remove deprecated SpanAttributes type
Browse files Browse the repository at this point in the history
  • Loading branch information
david-luna committed Nov 16, 2023
1 parent 7800f90 commit 578fb23
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import { getRPCMetadata, RPCType } from '@opentelemetry/core';
import { trace, context, diag, SpanAttributes } from '@opentelemetry/api';
import { trace, context, diag, Attributes } from '@opentelemetry/api';
import type * as express from 'express';
import { ExpressInstrumentationConfig, ExpressRequestInfo } from './types';
import { ExpressLayerType } from './enums/ExpressLayerType';
Expand Down Expand Up @@ -187,7 +187,7 @@ export class ExpressInstrumentation extends InstrumentationBase<
.filter(path => path !== '/' && path !== '/*')
.join('');

const attributes: SpanAttributes = {
const attributes: Attributes = {
[SemanticAttributes.HTTP_ROUTE]: route.length > 0 ? route : '/',
};
const metadata = getLayerMetadata(layer, layerPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import type { Request } from 'express';
import { SpanAttributes } from '@opentelemetry/api';
import { Attributes } from '@opentelemetry/api';

/**
* This symbol is used to mark express layer as being already instrumented
Expand Down Expand Up @@ -67,6 +67,6 @@ export type ExpressLayer = {
};

export type LayerMetadata = {
attributes: SpanAttributes;
attributes: Attributes;
name: string;
};
19 changes: 17 additions & 2 deletions plugins/node/opentelemetry-instrumentation-express/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,22 @@
* limitations under the License.
*/

import { SpanAttributes } from '@opentelemetry/api';
/*
* 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 { Attributes } from '@opentelemetry/api';
import { IgnoreMatcher, ExpressInstrumentationConfig } from './types';
import { ExpressLayerType } from './enums/ExpressLayerType';
import { AttributeNames } from './enums/AttributeNames';
Expand Down Expand Up @@ -49,7 +64,7 @@ export const getLayerMetadata = (
layer: ExpressLayer,
layerPath?: string
): {
attributes: SpanAttributes;
attributes: Attributes;
name: string;
} => {
if (layer.name === 'router') {
Expand Down

0 comments on commit 578fb23

Please sign in to comment.