Skip to content

Commit

Permalink
fix: remove component attribute from instrumentations (#1399)
Browse files Browse the repository at this point in the history
Co-authored-by: Gerhard Stöbich <[email protected]>
  • Loading branch information
blumamir and Flarna authored Feb 19, 2023
1 parent ee0a59a commit e93a192
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/
export enum AttributeNames {
COMPONENT = 'graphql',
SOURCE = 'graphql.source',
FIELD_NAME = 'graphql.field.name',
FIELD_PATH = 'graphql.field.path',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,10 @@ import { AttributeNames } from './enums/AttributeNames';
import { VERSION } from './version';
import { getMiddlewareMetadata, isLayerIgnored } from './utils';
import { getRPCMetadata, RPCType, setRPCMetadata } from '@opentelemetry/core';
import {
kLayerPatched,
KoaComponentName,
KoaPatchedMiddleware,
} from './internal-types';
import { kLayerPatched, KoaPatchedMiddleware } from './internal-types';

/** Koa instrumentation for OpenTelemetry */
export class KoaInstrumentation extends InstrumentationBase<typeof koa> {
static readonly component = KoaComponentName;
constructor(config: KoaInstrumentationConfig = {}) {
super(
'@opentelemetry/instrumentation-koa',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,3 @@ export const kLayerPatched: unique symbol = Symbol('koa-layer-patched');
export type KoaPatchedMiddleware = KoaMiddleware & {
[kLayerPatched]?: boolean;
};

export const KoaComponentName = 'koa';
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

export enum AttributeNames {
COMPONENT = 'component',
DOCUMENT_LOAD = 'documentLoad',
DOCUMENT_FETCH = 'documentFetch',
RESOURCE_FETCH = 'resourceFetch',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ export class DocumentLoadInstrumentation extends InstrumentationBase<unknown> {
},
parentSpan ? trace.setSpan(context.active(), parentSpan) : undefined
);
span.setAttribute(AttributeNames.COMPONENT, this.component);
return span;
}
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ import type {
const LONGTASK_PERFORMANCE_TYPE = 'longtask';

export class LongTaskInstrumentation extends InstrumentationBase {
readonly component: string = 'long-task';
readonly version: string = VERSION;
moduleName = this.component;

private _observer?: PerformanceObserver;
override _config!: LongtaskInstrumentationConfig;
Expand Down Expand Up @@ -66,7 +64,6 @@ export class LongTaskInstrumentation extends InstrumentationBase {
diag.error('longtask instrumentation: observer callback failed', err);
}
}
span.setAttribute('component', this.component);
span.setAttribute('longtask.name', entry.name);
span.setAttribute('longtask.entry_type', entry.entryType);
span.setAttribute('longtask.duration', entry.duration);
Expand Down

0 comments on commit e93a192

Please sign in to comment.