Skip to content

Commit

Permalink
feat: instrumentation description in base class constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
blumamir committed May 17, 2024
1 parent d58aa3b commit a91f419
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import * as web from '@opentelemetry/sdk-trace-web';
import { AttributeNames } from './enums/AttributeNames';
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
import { FetchError, FetchResponse, SpanData } from './types';
import { VERSION } from './version';
import { PACKAGE_DESCRIPTION, VERSION } from './version';
import { _globalThis } from '@opentelemetry/core';

// how long to wait for observer to collect information about resources
Expand Down Expand Up @@ -80,7 +80,7 @@ export class FetchInstrumentation extends InstrumentationBase<FetchInstrumentati
private _tasksCount = 0;

constructor(config: FetchInstrumentationConfig = {}) {
super('@opentelemetry/instrumentation-fetch', VERSION, config);
super('@opentelemetry/instrumentation-fetch', VERSION, config, {description: PACKAGE_DESCRIPTION});
}

init(): void {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ import {
_methodIsIgnored,
} from './utils';
import { AttributeValues } from './enums/AttributeValues';
import { VERSION } from './version';
import { PACKAGE_DESCRIPTION, VERSION } from './version';

export class GrpcInstrumentation extends InstrumentationBase<GrpcInstrumentationConfig> {
private _metadataCapture: metadataCaptureType;

constructor(config: GrpcInstrumentationConfig = {}) {
super('@opentelemetry/instrumentation-grpc', VERSION, config);
super('@opentelemetry/instrumentation-grpc', VERSION, config, { description: PACKAGE_DESCRIPTION });
this._metadataCapture = this._createMetadataCapture();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import {
Https,
} from './types';
import * as utils from './utils';
import { VERSION } from './version';
import { PACKAGE_DESCRIPTION, VERSION } from './version';
import {
InstrumentationBase,
InstrumentationNodeModuleDefinition,
Expand All @@ -70,7 +70,7 @@ export class HttpInstrumentation extends InstrumentationBase<HttpInstrumentation
private _httpClientDurationHistogram!: Histogram;

constructor(config: HttpInstrumentationConfig = {}) {
super('@opentelemetry/instrumentation-http', VERSION, config);
super('@opentelemetry/instrumentation-http', VERSION, config, { description: PACKAGE_DESCRIPTION});
this._headerCapture = this._createHeaderCapture();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {
SendFunction,
XhrMem,
} from './types';
import { VERSION } from './version';
import { PACKAGE_DESCRIPTION, VERSION } from './version';
import { AttributeNames } from './enums/AttributeNames';

// how long to wait for observer to collect information about resources
Expand Down Expand Up @@ -91,7 +91,7 @@ export class XMLHttpRequestInstrumentation extends InstrumentationBase<XMLHttpRe
private _usedResources = new WeakSet<PerformanceResourceTiming>();

constructor(config: XMLHttpRequestInstrumentationConfig = {}) {
super('@opentelemetry/instrumentation-xml-http-request', VERSION, config);
super('@opentelemetry/instrumentation-xml-http-request', VERSION, config, { description: PACKAGE_DESCRIPTION});
}

init() {}
Expand Down
1 change: 1 addition & 0 deletions scripts/version-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const content = `/*
// this is autogenerated file, see scripts/version-update.js
export const VERSION = '${pjson.version}';
export const PACKAGE_DESCRIPTION = '${pjson.description}';
`;

const fileUrl = path.join(appRoot, "src", "version.ts")
Expand Down

0 comments on commit a91f419

Please sign in to comment.