From 82e39c470a8f2767e095624497ed351745ad919e Mon Sep 17 00:00:00 2001 From: legendecas Date: Wed, 12 Jan 2022 00:07:40 +0800 Subject: [PATCH] chore: apply eslint rule semi (#2710) --- eslint.config.js | 3 ++ .../src/OTLPMetricExporter.ts | 4 +- .../src/platform/node/OTLPMetricExporter.ts | 2 +- .../src/http.ts | 2 +- .../src/types.ts | 2 +- .../src/utils.ts | 2 +- .../test/functionals/http-disable.test.ts | 2 +- .../test/functionals/http-enable.test.ts | 10 ++-- .../test/functionals/https-disable.test.ts | 2 +- .../test/functionals/utils.test.ts | 10 ++-- .../test/utils/assertSpan.ts | 2 +- .../src/platform/node/instrumentation.ts | 2 +- .../test/node/InstrumentationBase.test.ts | 24 ++++----- .../src/Measurement.ts | 6 +-- .../src/MeterProvider.ts | 10 ++-- .../src/aggregator/Histogram.ts | 4 +- .../src/aggregator/LastValue.ts | 4 +- .../src/aggregator/Sum.ts | 4 +- .../exemplar/AlwaysSampleExemplarFilter.ts | 4 +- .../src/exemplar/Exemplar.ts | 2 +- .../src/exemplar/ExemplarFilter.ts | 6 +-- .../src/exemplar/ExemplarReservoir.ts | 12 ++--- .../src/exemplar/NeverSampleExemplarFilter.ts | 4 +- .../SimpleFixedSizeExemplarReservoir.ts | 6 +-- .../src/exemplar/WithTraceExemplarFilter.ts | 4 +- .../src/export/MetricReader.ts | 2 +- .../export/PeriodicExportingMetricReader.ts | 2 +- .../src/view/InstrumentSelector.ts | 2 +- .../test/ExemplarFilter.test.ts | 6 +-- .../test/ExemplarReservoir.test.ts | 6 +-- .../PeriodicExportingMetricReader.test.ts | 12 ++--- .../test/state/MetricCollector.test.ts | 4 +- .../state/MultiWritableMetricStorage.test.ts | 4 +- .../test/util.ts | 2 +- .../test/view/ViewRegistry.test.ts | 6 +-- .../src/OTLPExporterNodeBase.ts | 4 +- .../src/OTLPTraceExporter.ts | 2 +- .../browser/OTLPExporterBrowserBase.ts | 2 +- .../src/platform/node/OTLPExporterNodeBase.ts | 2 +- .../test/browser/util.test.ts | 2 +- .../test/traceHelper.ts | 2 +- .../src/OTLPExporterNodeBase.ts | 4 +- .../exporter-trace-otlp-proto/src/util.ts | 2 +- .../src/jaeger.ts | 2 +- .../test/jaeger.test.ts | 2 +- .../src/zipkin.ts | 2 +- .../test/node/zipkin.test.ts | 6 +-- .../test/B3Propagator.test.ts | 2 +- .../opentelemetry-resources/src/Resource.ts | 2 +- .../browser/export/BatchSpanProcessor.ts | 14 ++--- .../browser/export/BatchSpanProcessor.test.ts | 34 ++++++------ .../test/common/Tracer.test.ts | 22 ++++---- .../test/registration.test.ts | 2 +- .../resource/SemanticResourceAttributes.ts | 26 ++++----- .../src/trace/SemanticAttributes.ts | 54 +++++++++---------- 55 files changed, 185 insertions(+), 182 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index c78e7b660da..61d75e50090 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -10,6 +10,8 @@ module.exports = { "project": "./tsconfig.json" }, rules: { + "no-trailing-spaces": "error", + "eol-last": "error", "quotes": [2, "single", { "avoidEscape": true }], "@typescript-eslint/no-floating-promises": 2, "@typescript-eslint/no-this-alias": "off", @@ -40,6 +42,7 @@ module.exports = { } }], "@typescript-eslint/no-shadow": ["warn"], + "@typescript-eslint/semi": "error", "arrow-parens": ["error", "as-needed"], "node/no-deprecated-api": ["warn"], "header/header": [2, "block", [{ diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/src/OTLPMetricExporter.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/src/OTLPMetricExporter.ts index 18169928501..3311eef290e 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/src/OTLPMetricExporter.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/src/OTLPMetricExporter.ts @@ -15,7 +15,7 @@ */ import { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http'; -import { toOTLPExportMetricServiceRequest } from '@opentelemetry/exporter-metrics-otlp-http' +import { toOTLPExportMetricServiceRequest } from '@opentelemetry/exporter-metrics-otlp-http'; import { MetricRecord, MetricExporter } from '@opentelemetry/sdk-metrics-base'; import { OTLPExporterConfigNode, @@ -45,7 +45,7 @@ export class OTLPMetricExporter const headers = baggageUtils.parseKeyPairsIntoRecord(getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS); this.metadata ||= new Metadata(); for (const [k, v] of Object.entries(headers)) { - this.metadata.set(k, v) + this.metadata.set(k, v); } } diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/node/OTLPMetricExporter.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/node/OTLPMetricExporter.ts index 05bf6af767e..2e83ee6be6d 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/node/OTLPMetricExporter.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/node/OTLPMetricExporter.ts @@ -15,7 +15,7 @@ */ import { MetricRecord, MetricExporter } from '@opentelemetry/sdk-metrics-base'; -import { +import { OTLPExporterNodeBase, OTLPExporterNodeConfigBase, otlpTypes, diff --git a/experimental/packages/opentelemetry-instrumentation-http/src/http.ts b/experimental/packages/opentelemetry-instrumentation-http/src/http.ts index e183d5e5e65..ecfd1c4f859 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/src/http.ts +++ b/experimental/packages/opentelemetry-instrumentation-http/src/http.ts @@ -685,6 +685,6 @@ export class HttpInstrumentation extends InstrumentationBase { captureRequestHeaders: utils.headerCapture('request', config.headersToSpanAttributes?.server?.requestHeaders ?? []), captureResponseHeaders: utils.headerCapture('response', config.headersToSpanAttributes?.server?.responseHeaders ?? []), } - } + }; } } diff --git a/experimental/packages/opentelemetry-instrumentation-http/src/types.ts b/experimental/packages/opentelemetry-instrumentation-http/src/types.ts index 79f4e844cd2..ed57c139f56 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/src/types.ts +++ b/experimental/packages/opentelemetry-instrumentation-http/src/types.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { +import { Span, SpanAttributes, } from '@opentelemetry/api'; diff --git a/experimental/packages/opentelemetry-instrumentation-http/src/utils.ts b/experimental/packages/opentelemetry-instrumentation-http/src/utils.ts index 4f8a03c7af8..308cb7a4397 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/src/utils.ts +++ b/experimental/packages/opentelemetry-instrumentation-http/src/utils.ts @@ -501,7 +501,7 @@ export function headerCapture(type: 'request' | 'response', headers: string[]) { return (span: Span, getHeader: (key: string) => undefined | string | string[] | number) => { for (const [capturedHeader, normalizedHeader] of normalizedHeaders) { const value = getHeader(capturedHeader); - + if (value === undefined) { continue; } diff --git a/experimental/packages/opentelemetry-instrumentation-http/test/functionals/http-disable.test.ts b/experimental/packages/opentelemetry-instrumentation-http/test/functionals/http-disable.test.ts index b52b0451092..77b7e03b972 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/test/functionals/http-disable.test.ts +++ b/experimental/packages/opentelemetry-instrumentation-http/test/functionals/http-disable.test.ts @@ -36,7 +36,7 @@ describe('HttpInstrumentation', () => { describe('disable()', () => { let provider: TracerProvider; let startSpanStub: sinon.SinonStub; - + before(() => { provider = { getTracer: () => { diff --git a/experimental/packages/opentelemetry-instrumentation-http/test/functionals/http-enable.test.ts b/experimental/packages/opentelemetry-instrumentation-http/test/functionals/http-enable.test.ts index 72c1ca5a1f7..e72387088f4 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/test/functionals/http-enable.test.ts +++ b/experimental/packages/opentelemetry-instrumentation-http/test/functionals/http-enable.test.ts @@ -18,7 +18,7 @@ import { context, propagation, Span as ISpan, - SpanKind, + SpanKind, trace, SpanAttributes, } from '@opentelemetry/api'; @@ -100,13 +100,13 @@ export const responseHookFunction = ( export const startIncomingSpanHookFunction = ( request: IncomingMessage ): SpanAttributes => { - return {guid: request.headers?.guid} + return {guid: request.headers?.guid}; }; export const startOutgoingSpanHookFunction = ( request: RequestOptions ): SpanAttributes => { - return {guid: request.headers?.guid} + return {guid: request.headers?.guid}; }; describe('HttpInstrumentation', () => { @@ -507,12 +507,12 @@ describe('HttpInstrumentation', () => { hostname: 'localhost', pathname: '/', forceStatus: { - code: SpanStatusCode.ERROR, + code: SpanStatusCode.ERROR, message: err.message, }, component: 'http', noNetPeer: true, - } + }; assertSpan(spans[0], SpanKind.CLIENT, validations); return true; }); diff --git a/experimental/packages/opentelemetry-instrumentation-http/test/functionals/https-disable.test.ts b/experimental/packages/opentelemetry-instrumentation-http/test/functionals/https-disable.test.ts index c09b1742d22..f87fa54dd0e 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/test/functionals/https-disable.test.ts +++ b/experimental/packages/opentelemetry-instrumentation-http/test/functionals/https-disable.test.ts @@ -37,7 +37,7 @@ describe('HttpsInstrumentation', () => { describe('disable()', () => { let provider: TracerProvider; let startSpanStub: sinon.SinonStub; - + before(() => { provider = { getTracer: () => { diff --git a/experimental/packages/opentelemetry-instrumentation-http/test/functionals/utils.test.ts b/experimental/packages/opentelemetry-instrumentation-http/test/functionals/utils.test.ts index 7b8a2e8d1ef..e4837ab0827 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/test/functionals/utils.test.ts +++ b/experimental/packages/opentelemetry-instrumentation-http/test/functionals/utils.test.ts @@ -475,12 +475,12 @@ describe('Utility', () => { request.headers = { 'user-agent': 'chrome', 'x-forwarded-for': ', , ' - } - const attributes = utils.getIncomingRequestAttributes(request, { component: 'http'}) - assert.strictEqual(attributes[SemanticAttributes.HTTP_ROUTE], undefined) + }; + const attributes = utils.getIncomingRequestAttributes(request, { component: 'http'}); + assert.strictEqual(attributes[SemanticAttributes.HTTP_ROUTE], undefined); }); }); - + describe('headers to span attributes capture', () => { let span: Span; @@ -539,6 +539,6 @@ describe('Utility', () => { assert.deepStrictEqual(span.attributes['http.request.header.origin'], ['localhost']); assert.deepStrictEqual(span.attributes['http.request.header.accept'], undefined); - }) + }); }); }); diff --git a/experimental/packages/opentelemetry-instrumentation-http/test/utils/assertSpan.ts b/experimental/packages/opentelemetry-instrumentation-http/test/utils/assertSpan.ts index a2d67fd7c6e..b887a46649a 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/test/utils/assertSpan.ts +++ b/experimental/packages/opentelemetry-instrumentation-http/test/utils/assertSpan.ts @@ -119,7 +119,7 @@ export const assertSpan = ( assert.ok( span.attributes[SemanticAttributes.NET_PEER_PORT], 'must have PEER_PORT' - ); + ); } assert.ok( (span.attributes[SemanticAttributes.HTTP_URL] as string).indexOf( diff --git a/experimental/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts b/experimental/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts index 92dab57c0a6..f67476930d7 100644 --- a/experimental/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts +++ b/experimental/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts @@ -67,7 +67,7 @@ export abstract class InstrumentationBase } catch (error) { diag.warn('Failed extracting version', baseDir); } - + return undefined; } diff --git a/experimental/packages/opentelemetry-instrumentation/test/node/InstrumentationBase.test.ts b/experimental/packages/opentelemetry-instrumentation/test/node/InstrumentationBase.test.ts index e1c42681d3d..4a44e91f61f 100644 --- a/experimental/packages/opentelemetry-instrumentation/test/node/InstrumentationBase.test.ts +++ b/experimental/packages/opentelemetry-instrumentation/test/node/InstrumentationBase.test.ts @@ -39,14 +39,14 @@ describe('InstrumentationBase', () => { let instrumentation: TestInstrumentation; let modulePatchSpy: sinon.SinonSpy; - + beforeEach(() => { instrumentation = new TestInstrumentation(); // @ts-expect-error access internal property for testing instrumentation._enabled = true; modulePatchSpy = sinon.spy(); }); - + describe('when patching a module', () => { describe('AND there is no wildcard supported version', () => { it('should not patch module', () => { @@ -56,7 +56,7 @@ describe('InstrumentationBase', () => { name: MODULE_NAME, patch: modulePatchSpy as unknown, } as InstrumentationModuleDefinition; - + // @ts-expect-error access internal property for testing instrumentation._onRequire( instrumentationModule, @@ -64,7 +64,7 @@ describe('InstrumentationBase', () => { MODULE_NAME, MODULE_DIR ); - + assert.strictEqual(instrumentationModule.moduleVersion, undefined); assert.strictEqual(instrumentationModule.moduleExports, undefined); sinon.assert.notCalled(modulePatchSpy); @@ -79,7 +79,7 @@ describe('InstrumentationBase', () => { name: MODULE_NAME, patch: modulePatchSpy as unknown, } as InstrumentationModuleDefinition; - + // @ts-expect-error access internal property for testing instrumentation._onRequire( instrumentationModule, @@ -87,20 +87,20 @@ describe('InstrumentationBase', () => { MODULE_NAME, MODULE_DIR ); - + assert.strictEqual(instrumentationModule.moduleVersion, undefined); assert.strictEqual(instrumentationModule.moduleExports, moduleExports); sinon.assert.calledOnceWithExactly(modulePatchSpy, moduleExports, undefined); }); }); }); - + describe('when patching module files', () => { let filePatchSpy: sinon.SinonSpy; beforeEach(() => { filePatchSpy = sinon.spy(); - }) + }); describe('AND there is no wildcard supported version', () => { it('should not patch module file', () => { @@ -116,7 +116,7 @@ describe('InstrumentationBase', () => { patch: filePatchSpy as unknown }] } as InstrumentationModuleDefinition; - + // @ts-expect-error access internal property for testing instrumentation._onRequire( instrumentationModule, @@ -124,7 +124,7 @@ describe('InstrumentationBase', () => { MODULE_FILE_NAME, MODULE_DIR ); - + assert.strictEqual(instrumentationModule.moduleVersion, undefined); assert.strictEqual(instrumentationModule.moduleExports, undefined); sinon.assert.notCalled(modulePatchSpy); @@ -146,7 +146,7 @@ describe('InstrumentationBase', () => { patch: filePatchSpy as unknown }] } as InstrumentationModuleDefinition; - + // @ts-expect-error access internal property for testing instrumentation._onRequire( instrumentationModule, @@ -154,7 +154,7 @@ describe('InstrumentationBase', () => { MODULE_FILE_NAME, MODULE_DIR ); - + assert.strictEqual(instrumentationModule.moduleVersion, undefined); assert.strictEqual(instrumentationModule.files[0].moduleExports, moduleExports); sinon.assert.notCalled(modulePatchSpy); diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/Measurement.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/Measurement.ts index 4ea34a6b6bd..a83b42843cb 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/Measurement.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/Measurement.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import * as api from '@opentelemetry/api' -import { Attributes } from '@opentelemetry/api-metrics-wip' +import * as api from '@opentelemetry/api'; +import { Attributes } from '@opentelemetry/api-metrics-wip'; // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#measurement @@ -24,4 +24,4 @@ export type Measurement = { // TODO use common attributes attributes: Attributes context?: api.Context; -} +}; diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/MeterProvider.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/MeterProvider.ts index 5a534533033..d7b30e30814 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/MeterProvider.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/MeterProvider.ts @@ -29,7 +29,7 @@ import { MetricCollector } from './state/MetricCollector'; export type MeterProviderOptions = { resource?: Resource; -} +}; export class MeterProvider { private _sharedState: MeterProviderSharedState; @@ -42,7 +42,7 @@ export class MeterProvider { getMeter(name: string, version = '', options: metrics.MeterOptions = {}): metrics.Meter { // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#meter-creation if (this._shutdown) { - api.diag.warn('A shutdown MeterProvider cannot provide a Meter') + api.diag.warn('A shutdown MeterProvider cannot provide a Meter'); return metrics.NOOP_METER; } @@ -84,7 +84,7 @@ export class MeterProvider { } catch (e) { // Log all Errors. if (e instanceof Error) { - api.diag.error(`Error shutting down: ${e.message}`) + api.diag.error(`Error shutting down: ${e.message}`); } } } @@ -103,7 +103,7 @@ export class MeterProvider { // do not flush after shutdown if (this._shutdown) { - api.diag.warn('invalid attempt to force flush after shutdown') + api.diag.warn('invalid attempt to force flush after shutdown'); return; } @@ -113,7 +113,7 @@ export class MeterProvider { } catch (e) { // Log all Errors. if (e instanceof Error) { - api.diag.error(`Error flushing: ${e.message}`) + api.diag.error(`Error flushing: ${e.message}`); } } } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/aggregator/Histogram.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/aggregator/Histogram.ts index fadfc1f3033..4caa575c3c9 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/aggregator/Histogram.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/aggregator/Histogram.ts @@ -155,8 +155,8 @@ export class HistogramAggregator implements Aggregator { startTime, endTime, point: accumulation.toPoint(), - } + }; }) - } + }; } } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/aggregator/LastValue.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/aggregator/LastValue.ts index 2ed5b938179..ddfc5a024b3 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/aggregator/LastValue.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/aggregator/LastValue.ts @@ -84,8 +84,8 @@ export class LastValueAggregator implements Aggregator { startTime, endTime, point: accumulation.toPoint(), - } + }; }) - } + }; } } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/aggregator/Sum.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/aggregator/Sum.ts index 28cb68f77c6..5a9aaac8d14 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/aggregator/Sum.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/aggregator/Sum.ts @@ -74,8 +74,8 @@ export class SumAggregator implements Aggregator { startTime, endTime, point: accumulation.toPoint(), - } + }; }) - } + }; } } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/AlwaysSampleExemplarFilter.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/AlwaysSampleExemplarFilter.ts index 335da937fb7..349cf9fea73 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/AlwaysSampleExemplarFilter.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/AlwaysSampleExemplarFilter.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import { Attributes } from '@opentelemetry/api-metrics-wip' -import { Context, HrTime } from '@opentelemetry/api' +import { Attributes } from '@opentelemetry/api-metrics-wip'; +import { Context, HrTime } from '@opentelemetry/api'; import { ExemplarFilter } from './ExemplarFilter'; diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/Exemplar.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/Exemplar.ts index 8b874b75203..1b22c086e23 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/Exemplar.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/Exemplar.ts @@ -44,4 +44,4 @@ export type Exemplar = { // trace_id may be missing if the measurement is not recorded inside a trace // or if the trace is not sampled. traceId?: string; -} +}; diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/ExemplarFilter.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/ExemplarFilter.ts index 435e3b37f97..e3f89b4305c 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/ExemplarFilter.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/ExemplarFilter.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import { Attributes } from '@opentelemetry/api-metrics-wip' -import { Context, HrTime } from '@opentelemetry/api' +import { Attributes } from '@opentelemetry/api-metrics-wip'; +import { Context, HrTime } from '@opentelemetry/api'; /** * This interface represents a ExemplarFilter. Exemplar filters are @@ -25,7 +25,7 @@ import { Context, HrTime } from '@opentelemetry/api' export interface ExemplarFilter { /** * Returns whether or not a reservoir should attempt to filter a measurement. - * + * * @param value The value of the measurement * @param timestamp A timestamp that best represents when the measurement was taken * @param attributes The complete set of Attributes of the measurement diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/ExemplarReservoir.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/ExemplarReservoir.ts index 09da8d4603a..a6eb5877221 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/ExemplarReservoir.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/ExemplarReservoir.ts @@ -14,9 +14,9 @@ * limitations under the License. */ -import { Attributes } from '@opentelemetry/api-metrics-wip' -import { Context, HrTime, isSpanContextValid, trace } from '@opentelemetry/api' -import { Exemplar } from './Exemplar' +import { Attributes } from '@opentelemetry/api-metrics-wip'; +import { Context, HrTime, isSpanContextValid, trace } from '@opentelemetry/api'; +import { Exemplar } from './Exemplar'; /** @@ -29,13 +29,13 @@ export interface ExemplarReservoir { value: number, timestamp: HrTime, attributes: Attributes, - ctx: Context + ctx: Context ): void; /** * Returns accumulated Exemplars and also resets the reservoir * for the next sampling period - * - * @param pointAttributes The attributes associated with metric point. + * + * @param pointAttributes The attributes associated with metric point. * * @returns a list of {@link Exemplar}s. Retuned exemplars contain the attributes that were filtered out by the * aggregator, but recorded alongside the original measurement. diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/NeverSampleExemplarFilter.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/NeverSampleExemplarFilter.ts index b20ea116e9e..a66a755fe28 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/NeverSampleExemplarFilter.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/NeverSampleExemplarFilter.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import { Attributes } from '@opentelemetry/api-metrics-wip' -import { Context, HrTime } from '@opentelemetry/api' +import { Attributes } from '@opentelemetry/api-metrics-wip'; +import { Context, HrTime } from '@opentelemetry/api'; import { ExemplarFilter } from './ExemplarFilter'; export class NeverSampleExemplarFilter implements ExemplarFilter { diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/SimpleFixedSizeExemplarReservoir.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/SimpleFixedSizeExemplarReservoir.ts index 4184e09f377..ddf7ef268d9 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/SimpleFixedSizeExemplarReservoir.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/SimpleFixedSizeExemplarReservoir.ts @@ -21,7 +21,7 @@ import { FixedSizeExemplarReservoirBase } from './ExemplarReservoir'; /** * Fixed size reservoir that uses equivalent of naive reservoir sampling * algorithm to accept measurements. - * + * */ export class SimpleFixedSizeExemplarReservoir extends FixedSizeExemplarReservoirBase { private _numMeasurementsSeen: number; @@ -31,7 +31,7 @@ export class SimpleFixedSizeExemplarReservoir extends FixedSizeExemplarReservoir } private getRandomInt(min: number, max: number) { //[min, max) - return Math.floor(Math.random() * (max - min) + min); + return Math.floor(Math.random() * (max - min) + min); } private _findBucketIndex(_value: number, _timestamp: HrTime, _attributes: Attributes, _ctx: Context) { @@ -43,7 +43,7 @@ export class SimpleFixedSizeExemplarReservoir extends FixedSizeExemplarReservoir offer(value: number, timestamp: HrTime, attributes: Attributes, ctx: Context): void { const index = this._findBucketIndex(value, timestamp, attributes, ctx); if (index !== -1) { - this._reservoirStorage[index].offer(value, timestamp, attributes, ctx) + this._reservoirStorage[index].offer(value, timestamp, attributes, ctx); } } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/WithTraceExemplarFilter.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/WithTraceExemplarFilter.ts index f9f75e4ddd1..77f3fb02af5 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/WithTraceExemplarFilter.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/WithTraceExemplarFilter.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import { Attributes } from '@opentelemetry/api-metrics-wip' -import { Context, HrTime, isSpanContextValid, trace, TraceFlags } from '@opentelemetry/api' +import { Attributes } from '@opentelemetry/api-metrics-wip'; +import { Context, HrTime, isSpanContextValid, trace, TraceFlags } from '@opentelemetry/api'; import { ExemplarFilter } from './ExemplarFilter'; export class WithTraceExemplarFilter implements ExemplarFilter { diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/export/MetricReader.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/export/MetricReader.ts index b67876c9b11..db0bc301b70 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/export/MetricReader.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/export/MetricReader.ts @@ -22,7 +22,7 @@ import { callWithTimeout } from '../utils'; export type ReaderOptions = { timeoutMillis?: number -} +}; export type ReaderCollectionOptions = ReaderOptions; diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/export/PeriodicExportingMetricReader.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/export/PeriodicExportingMetricReader.ts index f7e54530765..0e5861941af 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/export/PeriodicExportingMetricReader.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/export/PeriodicExportingMetricReader.ts @@ -23,7 +23,7 @@ export type PeriodicExportingMetricReaderOptions = { exporter: MetricExporter exportIntervalMillis?: number, exportTimeoutMillis?: number -} +}; /** * {@link MetricReader} which collects metrics based on a user-configurable time interval, and passes the metrics to diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/view/InstrumentSelector.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/view/InstrumentSelector.ts index 40aa4778a93..c7dc6fa28e5 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/view/InstrumentSelector.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/view/InstrumentSelector.ts @@ -32,7 +32,7 @@ export class InstrumentSelector { } getType() { - return this._type + return this._type; } getNameFilter() { diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/test/ExemplarFilter.test.ts b/experimental/packages/opentelemetry-sdk-metrics-base/test/ExemplarFilter.test.ts index 22b86639ec1..7365bbbd603 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/test/ExemplarFilter.test.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/test/ExemplarFilter.test.ts @@ -37,7 +37,7 @@ describe('ExemplarFilter', () => { describe('NeverSampleExemplarFilter', () => { it('should return false always for shouldSample', () => { - const filter = new NeverSampleExemplarFilter() + const filter = new NeverSampleExemplarFilter(); assert.strictEqual(filter.shouldSample(1, [0, 0], {}, ROOT_CONTEXT), false); }); }); @@ -50,7 +50,7 @@ describe('ExemplarFilter', () => { spanId: SPAN_ID, traceFlags: TraceFlags.NONE, }; - const ctx = trace.setSpanContext(ROOT_CONTEXT, spanContext) + const ctx = trace.setSpanContext(ROOT_CONTEXT, spanContext); assert.strictEqual(filter.shouldSample(5.3, [0, 0,], {}, ctx), false); }); @@ -61,7 +61,7 @@ describe('ExemplarFilter', () => { spanId: SPAN_ID, traceFlags: TraceFlags.SAMPLED, }; - const ctx = trace.setSpanContext(ROOT_CONTEXT, spanContext) + const ctx = trace.setSpanContext(ROOT_CONTEXT, spanContext); assert.strictEqual(filter.shouldSample(5.3, [0, 0,], {}, ctx), true); }); }); diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/test/ExemplarReservoir.test.ts b/experimental/packages/opentelemetry-sdk-metrics-base/test/ExemplarReservoir.test.ts index bfd2e5f4042..d6917c172f2 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/test/ExemplarReservoir.test.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/test/ExemplarReservoir.test.ts @@ -16,7 +16,7 @@ import { ROOT_CONTEXT, SpanContext, TraceFlags, trace } from '@opentelemetry/api'; import { hrTime } from '@opentelemetry/core'; -import * as assert from 'assert' +import * as assert from 'assert'; import { SimpleFixedSizeExemplarReservoir, @@ -41,8 +41,8 @@ describe('ExemplarReservoir', () => { spanId: SPAN_ID, traceFlags: TraceFlags.SAMPLED, }; - const ctx = trace.setSpanContext(ROOT_CONTEXT, spanContext) - + const ctx = trace.setSpanContext(ROOT_CONTEXT, spanContext); + reservoir.offer(1, hrTime(), {}, ctx); const exemplars = reservoir.collect({}); assert.strictEqual(exemplars.length, 1); diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/test/export/PeriodicExportingMetricReader.test.ts b/experimental/packages/opentelemetry-sdk-metrics-base/test/export/PeriodicExportingMetricReader.test.ts index ca426e29081..90962c8ca20 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/test/export/PeriodicExportingMetricReader.test.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/test/export/PeriodicExportingMetricReader.test.ts @@ -23,7 +23,7 @@ import * as sinon from 'sinon'; import { MetricProducer } from '../../src/export/MetricProducer'; import { TimeoutError } from '../../src/utils'; -const MAX_32_BIT_INT = 2 ** 31 - 1 +const MAX_32_BIT_INT = 2 ** 31 - 1; class TestMetricExporter extends MetricExporter { public exportTime = 0; @@ -94,7 +94,7 @@ describe('PeriodicExportingMetricReader', () => { } ); assert.strictEqual(reader.getPreferredAggregationTemporality(), exporter.getPreferredAggregationTemporality()); - }) + }); it('should throw when interval less or equal to 0', () => { const exporter = new TestDeltaMetricExporter(); @@ -103,7 +103,7 @@ describe('PeriodicExportingMetricReader', () => { exportIntervalMillis: 0, exportTimeoutMillis: 0 }), new Error('exportIntervalMillis must be greater than 0')); - }) + }); it('should throw when timeout less or equal to 0', () => { const exporter = new TestDeltaMetricExporter(); @@ -112,7 +112,7 @@ describe('PeriodicExportingMetricReader', () => { exportIntervalMillis: 1, exportTimeoutMillis: 0 }), new Error('exportTimeoutMillis must be greater than 0')); - }) + }); it('should throw when timeout less or equal to interval', () => { const exporter = new TestDeltaMetricExporter(); @@ -121,7 +121,7 @@ describe('PeriodicExportingMetricReader', () => { exportIntervalMillis: 100, exportTimeoutMillis: 200 }), new Error('exportIntervalMillis must be greater than or equal to exportTimeoutMillis')); - }) + }); it('should not start exporting', async () => { const exporter = new TestDeltaMetricExporter(); @@ -136,7 +136,7 @@ describe('PeriodicExportingMetricReader', () => { await new Promise(resolve => setTimeout(resolve, 50)); exporterMock.verify(); - }) + }); }); describe('setMetricProducer', () => { diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/test/state/MetricCollector.test.ts b/experimental/packages/opentelemetry-sdk-metrics-base/test/state/MetricCollector.test.ts index 4aba1f71463..ea263bdd25a 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/test/state/MetricCollector.test.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/test/state/MetricCollector.test.ts @@ -26,7 +26,7 @@ import { defaultInstrumentationLibrary, defaultResource, assertMetricData, asser import { TestMetricReader } from '../export/TestMetricReader'; class TestMetricExporter extends MetricExporter { - metricDataList: MetricData[] = [] + metricDataList: MetricData[] = []; async export(batch: MetricData[]): Promise { this.metricDataList.push(...batch); } @@ -47,7 +47,7 @@ class TestDeltaMetricExporter extends TestMetricExporter { describe('MetricCollector', () => { afterEach(() => { sinon.restore(); - }) + }); describe('constructor', () => { it('should construct MetricCollector without exceptions', () => { diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/test/state/MultiWritableMetricStorage.test.ts b/experimental/packages/opentelemetry-sdk-metrics-base/test/state/MultiWritableMetricStorage.test.ts index 64c8daaa6f5..174c12f7278 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/test/state/MultiWritableMetricStorage.test.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/test/state/MultiWritableMetricStorage.test.ts @@ -49,8 +49,8 @@ describe('MultiMetricStorage', () => { const expectedMeasurements: Measurement[] = []; for (const value of commonValues) { for (const attributes of commonAttributes) { - const context = api.context.active() - expectedMeasurements.push({ value, attributes, context }) + const context = api.context.active(); + expectedMeasurements.push({ value, attributes, context }); metricStorage.record(value, attributes, context); } } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/test/util.ts b/experimental/packages/opentelemetry-sdk-metrics-base/test/util.ts index 58e8bcbb6ce..301a2a9e447 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/test/util.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/test/util.ts @@ -45,7 +45,7 @@ export const defaultInstrumentationLibrary: InstrumentationLibrary = { export const commonValues: number[] = [1, -1, 1.0, Infinity, -Infinity, NaN]; export const commonAttributes: Attributes[] = [{}, {1: '1'}, {a: '2'}, new (class Foo{ -a = '1' +a = '1'; })]; export const sleep = (time: number) => diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/test/view/ViewRegistry.test.ts b/experimental/packages/opentelemetry-sdk-metrics-base/test/view/ViewRegistry.test.ts index e7185a18887..dd1321a400c 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/test/view/ViewRegistry.test.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/test/view/ViewRegistry.test.ts @@ -50,7 +50,7 @@ describe('ViewRegistry', () => { }, defaultInstrumentationLibrary); assert.strictEqual(views.length, 2); - assert.strictEqual(views[0].name, 'no-filter') + assert.strictEqual(views[0].name, 'no-filter'); assert.strictEqual(views[1].name, 'foo'); } @@ -83,7 +83,7 @@ describe('ViewRegistry', () => { }, defaultInstrumentationLibrary); assert.strictEqual(views.length, 2); - assert.strictEqual(views[0].name, 'no-filter') + assert.strictEqual(views[0].name, 'no-filter'); assert.strictEqual(views[1].name, 'counter'); } @@ -118,7 +118,7 @@ describe('ViewRegistry', () => { }); assert.strictEqual(views.length, 2); - assert.strictEqual(views[0].name, 'no-filter') + assert.strictEqual(views[0].name, 'no-filter'); assert.strictEqual(views[1].name, 'foo'); } diff --git a/packages/exporter-trace-otlp-grpc/src/OTLPExporterNodeBase.ts b/packages/exporter-trace-otlp-grpc/src/OTLPExporterNodeBase.ts index 0c516865bdd..a992a4f2599 100644 --- a/packages/exporter-trace-otlp-grpc/src/OTLPExporterNodeBase.ts +++ b/packages/exporter-trace-otlp-grpc/src/OTLPExporterNodeBase.ts @@ -52,7 +52,7 @@ export abstract class OTLPExporterNodeBase< const headers = baggageUtils.parseKeyPairsIntoRecord(getEnv().OTEL_EXPORTER_OTLP_HEADERS); this.metadata = config.metadata || new Metadata(); for (const [k, v] of Object.entries(headers)) { - this.metadata.set(k, v) + this.metadata.set(k, v); } } @@ -70,7 +70,7 @@ export abstract class OTLPExporterNodeBase< const popPromise = () => { const index = this._sendingPromises.indexOf(promise); this._sendingPromises.splice(index, 1); - } + }; promise.then(popPromise, popPromise); } diff --git a/packages/exporter-trace-otlp-grpc/src/OTLPTraceExporter.ts b/packages/exporter-trace-otlp-grpc/src/OTLPTraceExporter.ts index 252a752a6dc..871d3f31dbc 100644 --- a/packages/exporter-trace-otlp-grpc/src/OTLPTraceExporter.ts +++ b/packages/exporter-trace-otlp-grpc/src/OTLPTraceExporter.ts @@ -42,7 +42,7 @@ export class OTLPTraceExporter const headers = baggageUtils.parseKeyPairsIntoRecord(getEnv().OTEL_EXPORTER_OTLP_TRACES_HEADERS); this.metadata ||= new Metadata(); for (const [k, v] of Object.entries(headers)) { - this.metadata.set(k, v) + this.metadata.set(k, v); } } diff --git a/packages/exporter-trace-otlp-http/src/platform/browser/OTLPExporterBrowserBase.ts b/packages/exporter-trace-otlp-http/src/platform/browser/OTLPExporterBrowserBase.ts index 9e6ff101441..708702300b9 100644 --- a/packages/exporter-trace-otlp-http/src/platform/browser/OTLPExporterBrowserBase.ts +++ b/packages/exporter-trace-otlp-http/src/platform/browser/OTLPExporterBrowserBase.ts @@ -89,7 +89,7 @@ export abstract class OTLPExporterBrowserBase< const popPromise = () => { const index = this._sendingPromises.indexOf(promise); this._sendingPromises.splice(index, 1); - } + }; promise.then(popPromise, popPromise); } } diff --git a/packages/exporter-trace-otlp-http/src/platform/node/OTLPExporterNodeBase.ts b/packages/exporter-trace-otlp-http/src/platform/node/OTLPExporterNodeBase.ts index c48d49fc420..11f582a83ce 100644 --- a/packages/exporter-trace-otlp-http/src/platform/node/OTLPExporterNodeBase.ts +++ b/packages/exporter-trace-otlp-http/src/platform/node/OTLPExporterNodeBase.ts @@ -84,7 +84,7 @@ export abstract class OTLPExporterNodeBase< const popPromise = () => { const index = this._sendingPromises.indexOf(promise); this._sendingPromises.splice(index, 1); - } + }; promise.then(popPromise, popPromise); } diff --git a/packages/exporter-trace-otlp-http/test/browser/util.test.ts b/packages/exporter-trace-otlp-http/test/browser/util.test.ts index c4cb185da1b..3cb6aa44740 100644 --- a/packages/exporter-trace-otlp-http/test/browser/util.test.ts +++ b/packages/exporter-trace-otlp-http/test/browser/util.test.ts @@ -44,7 +44,7 @@ describe('util - browser', () => { // ;charset=utf-8 is applied by sinon.fakeServer 'Content-Type': 'application/json;charset=utf-8', 'Accept': 'application/json', - } + }; }); describe('and Content-Type header is set', () => { beforeEach(()=>{ diff --git a/packages/exporter-trace-otlp-http/test/traceHelper.ts b/packages/exporter-trace-otlp-http/test/traceHelper.ts index 9975f05f3c3..1ad9e891a7d 100644 --- a/packages/exporter-trace-otlp-http/test/traceHelper.ts +++ b/packages/exporter-trace-otlp-http/test/traceHelper.ts @@ -42,7 +42,7 @@ export const mockedReadableSpan: ReadableSpan = { traceId: '1f1008dc8e270e85c40a0d7c3939b278', spanId: '5e107261f64fa53e', traceFlags: TraceFlags.SAMPLED, - } + }; }, parentSpanId: '78a8915098864388', startTime: [1574120165, 429803070], diff --git a/packages/exporter-trace-otlp-proto/src/OTLPExporterNodeBase.ts b/packages/exporter-trace-otlp-proto/src/OTLPExporterNodeBase.ts index bebc831650a..19ddc423bf6 100644 --- a/packages/exporter-trace-otlp-proto/src/OTLPExporterNodeBase.ts +++ b/packages/exporter-trace-otlp-proto/src/OTLPExporterNodeBase.ts @@ -39,7 +39,7 @@ export abstract class OTLPExporterNodeBase< private _send!: SendFn; constructor(config: OTLPExporterNodeConfigBase = {}) { - super(config) + super(config); } private _sendPromise( @@ -56,7 +56,7 @@ export abstract class OTLPExporterNodeBase< const popPromise = () => { const index = this._sendingPromises.indexOf(promise); this._sendingPromises.splice(index, 1); - } + }; promise.then(popPromise, popPromise); } diff --git a/packages/exporter-trace-otlp-proto/src/util.ts b/packages/exporter-trace-otlp-proto/src/util.ts index 007b35b56ea..ea38e815d60 100644 --- a/packages/exporter-trace-otlp-proto/src/util.ts +++ b/packages/exporter-trace-otlp-proto/src/util.ts @@ -85,4 +85,4 @@ export function send( } else { onError(new otlpTypes.OTLPExporterError('No proto')); } -} \ No newline at end of file +} diff --git a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts index 3ae58807100..ec9634793e1 100644 --- a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts +++ b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts @@ -137,7 +137,7 @@ export class JaegerExporter implements SpanExporter { sender._client.unref(); } - const serviceNameTag = span.tags.find(t => t.key === SemanticResourceAttributes.SERVICE_NAME) + const serviceNameTag = span.tags.find(t => t.key === SemanticResourceAttributes.SERVICE_NAME); const serviceName = serviceNameTag?.vStr || 'unknown_service'; sender.setProcess({ diff --git a/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts b/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts index c51dd2b022c..6193796268b 100644 --- a/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts +++ b/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts @@ -69,7 +69,7 @@ describe('JaegerExporter', () => { const mockedEndpoint = 'http://testendpoint'; const scope =nock(mockedEndpoint) .post('/') - .reply(202) + .reply(202); const exporter = new JaegerExporter({ endpoint: mockedEndpoint, diff --git a/packages/opentelemetry-exporter-zipkin/src/zipkin.ts b/packages/opentelemetry-exporter-zipkin/src/zipkin.ts index 614d728cb5b..3b228b30073 100644 --- a/packages/opentelemetry-exporter-zipkin/src/zipkin.ts +++ b/packages/opentelemetry-exporter-zipkin/src/zipkin.ts @@ -92,7 +92,7 @@ export class ZipkinExporter implements SpanExporter { const popPromise = () => { const index = this._sendingPromises.indexOf(promise); this._sendingPromises.splice(index, 1); - } + }; promise.then(popPromise, popPromise); } diff --git a/packages/opentelemetry-exporter-zipkin/test/node/zipkin.test.ts b/packages/opentelemetry-exporter-zipkin/test/node/zipkin.test.ts index d78b46159c7..1b6465a656e 100644 --- a/packages/opentelemetry-exporter-zipkin/test/node/zipkin.test.ts +++ b/packages/opentelemetry-exporter-zipkin/test/node/zipkin.test.ts @@ -512,10 +512,10 @@ describe('Zipkin Exporter - node', () => { describe('when env.OTEL_EXPORTER_ZIPKIN_ENDPOINT is set', () => { before(() => { process.env.OTEL_EXPORTER_ZIPKIN_ENDPOINT = 'http://localhost:9412'; - }) + }); after(() => { - delete process.env.OTEL_EXPORTER_ZIPKIN_ENDPOINT - }) + delete process.env.OTEL_EXPORTER_ZIPKIN_ENDPOINT; + }); it('should use url from env', () => { const scope = nock('http://localhost:9412').post('/').reply(200); diff --git a/packages/opentelemetry-propagator-b3/test/B3Propagator.test.ts b/packages/opentelemetry-propagator-b3/test/B3Propagator.test.ts index 6e5a7b4a7c7..62d4643f457 100644 --- a/packages/opentelemetry-propagator-b3/test/B3Propagator.test.ts +++ b/packages/opentelemetry-propagator-b3/test/B3Propagator.test.ts @@ -163,7 +163,7 @@ describe('B3Propagator', () => { } return [carrier[key]]; }, - + keys: defaultTextMapGetter.keys } ); diff --git a/packages/opentelemetry-resources/src/Resource.ts b/packages/opentelemetry-resources/src/Resource.ts index f048ea3580a..ac368d812ee 100644 --- a/packages/opentelemetry-resources/src/Resource.ts +++ b/packages/opentelemetry-resources/src/Resource.ts @@ -45,7 +45,7 @@ export class Resource { SDK_INFO[SemanticResourceAttributes.TELEMETRY_SDK_NAME], [SemanticResourceAttributes.TELEMETRY_SDK_VERSION]: SDK_INFO[SemanticResourceAttributes.TELEMETRY_SDK_VERSION], - }) + }); } constructor( diff --git a/packages/opentelemetry-sdk-trace-base/src/platform/browser/export/BatchSpanProcessor.ts b/packages/opentelemetry-sdk-trace-base/src/platform/browser/export/BatchSpanProcessor.ts index 07156e7b90d..d5a87cc10d0 100644 --- a/packages/opentelemetry-sdk-trace-base/src/platform/browser/export/BatchSpanProcessor.ts +++ b/packages/opentelemetry-sdk-trace-base/src/platform/browser/export/BatchSpanProcessor.ts @@ -19,12 +19,12 @@ import { SpanExporter } from '../../../export/SpanExporter'; import { BatchSpanProcessorBrowserConfig } from '../../../types'; export class BatchSpanProcessor extends BatchSpanProcessorBase { - private _visibilityChangeListener?: () => void - private _pageHideListener?: () => void + private _visibilityChangeListener?: () => void; + private _pageHideListener?: () => void; constructor(_exporter: SpanExporter, config?: BatchSpanProcessorBrowserConfig) { - super(_exporter, config) - this.onInit(config) + super(_exporter, config); + this.onInit(config); } private onInit(config?: BatchSpanProcessorBrowserConfig): void { @@ -33,10 +33,10 @@ export class BatchSpanProcessor extends BatchSpanProcessorBase { - void this.forceFlush() - } + void this.forceFlush(); + }; document.addEventListener('visibilitychange', this._visibilityChangeListener); // use 'pagehide' event as a fallback for Safari; see https://bugs.webkit.org/show_bug.cgi?id=116769 diff --git a/packages/opentelemetry-sdk-trace-base/test/browser/export/BatchSpanProcessor.test.ts b/packages/opentelemetry-sdk-trace-base/test/browser/export/BatchSpanProcessor.test.ts index 9c422f2245a..210b59612c7 100644 --- a/packages/opentelemetry-sdk-trace-base/test/browser/export/BatchSpanProcessor.test.ts +++ b/packages/opentelemetry-sdk-trace-base/test/browser/export/BatchSpanProcessor.test.ts @@ -22,11 +22,11 @@ import { TestTracingSpanExporter } from '../../common/export/TestTracingSpanExpo describe('BatchSpanProcessor - web', () => { let visibilityState: VisibilityState = 'visible'; - let exporter: SpanExporter + let exporter: SpanExporter; let processor: BatchSpanProcessor; let forceFlushSpy: sinon.SinonStub; let visibilityChangeEvent: Event; - let pageHideEvent: Event + let pageHideEvent: Event; beforeEach(() => { sinon.replaceGetter(document, 'visibilityState', () => visibilityState); @@ -46,7 +46,7 @@ describe('BatchSpanProcessor - web', () => { const testDocumentHide = (hideDocument: () => void) => { it('should force flush spans', () => { assert.strictEqual(forceFlushSpy.callCount, 0); - hideDocument() + hideDocument(); assert.strictEqual(forceFlushSpy.callCount, 1); }); @@ -54,43 +54,43 @@ describe('BatchSpanProcessor - web', () => { it('should NOT force flush spans', async () => { assert.strictEqual(forceFlushSpy.callCount, 0); await processor.shutdown(); - hideDocument() + hideDocument(); assert.strictEqual(forceFlushSpy.callCount, 0); }); - }) + }); describe('AND disableAutoFlushOnDocumentHide configuration option', () => { it('set to false should force flush spans', () => { processor = new BatchSpanProcessor(exporter, { disableAutoFlushOnDocumentHide: false }); forceFlushSpy = sinon.stub(processor, 'forceFlush'); assert.strictEqual(forceFlushSpy.callCount, 0); - hideDocument() + hideDocument(); assert.strictEqual(forceFlushSpy.callCount, 1); - }) + }); it('set to true should NOT force flush spans', () => { processor = new BatchSpanProcessor(exporter, { disableAutoFlushOnDocumentHide: true }); forceFlushSpy = sinon.stub(processor, 'forceFlush'); assert.strictEqual(forceFlushSpy.callCount, 0); - hideDocument() + hideDocument(); assert.strictEqual(forceFlushSpy.callCount, 0); - }) - }) - } + }); + }); + }; describe('by the visibilitychange event', () => { testDocumentHide(() => { visibilityState = 'hidden'; document.dispatchEvent(visibilityChangeEvent); - }) - }) + }); + }); describe('by the pagehide event', () => { testDocumentHide(() => { document.dispatchEvent(pageHideEvent); - }) - }) - }) + }); + }); + }); describe('when document becomes visible', () => { it('should NOT force flush spans', () => { @@ -98,5 +98,5 @@ describe('BatchSpanProcessor - web', () => { document.dispatchEvent(visibilityChangeEvent); assert.strictEqual(forceFlushSpy.callCount, 0); }); - }) + }); }); diff --git a/packages/opentelemetry-sdk-trace-base/test/common/Tracer.test.ts b/packages/opentelemetry-sdk-trace-base/test/common/Tracer.test.ts index b0e56c21613..893f5219c66 100644 --- a/packages/opentelemetry-sdk-trace-base/test/common/Tracer.test.ts +++ b/packages/opentelemetry-sdk-trace-base/test/common/Tracer.test.ts @@ -242,9 +242,9 @@ describe('Tracer', () => { assert.strictEqual(tracer.startActiveSpan('my-span', span => { try { - assert(spy.calledWith('my-span')) - assert.strictEqual(getSpan(context.active()), span) - return 1 + assert(spy.calledWith('my-span')); + assert.strictEqual(getSpan(context.active()), span); + return 1; } finally { span.end(); } @@ -263,9 +263,9 @@ describe('Tracer', () => { assert.strictEqual(tracer.startActiveSpan('my-span', {attributes: {foo: 'bar'}}, span => { try { - assert(spy.calledWith('my-span', {attributes: {foo: 'bar'}})) - assert.strictEqual(getSpan(context.active()), span) - return 1 + assert(spy.calledWith('my-span', {attributes: {foo: 'bar'}})); + assert.strictEqual(getSpan(context.active()), span); + return 1; } finally { span.end(); } @@ -281,16 +281,16 @@ describe('Tracer', () => { const ctxKey = createContextKey('foo'); - const ctx = context.active().setValue(ctxKey, 'bar') + const ctx = context.active().setValue(ctxKey, 'bar'); const spy = sinon.spy(tracer, 'startSpan'); assert.strictEqual(tracer.startActiveSpan('my-span', {attributes: {foo: 'bar'}}, ctx, span => { try { - assert(spy.calledWith('my-span', {attributes: {foo: 'bar'}}, ctx)) - assert.strictEqual(getSpan(context.active()), span) - assert.strictEqual(ctx.getValue(ctxKey), 'bar') - return 1 + assert(spy.calledWith('my-span', {attributes: {foo: 'bar'}}, ctx)); + assert.strictEqual(getSpan(context.active()), span); + assert.strictEqual(ctx.getValue(ctxKey), 'bar'); + return 1; } finally { span.end(); } diff --git a/packages/opentelemetry-sdk-trace-web/test/registration.test.ts b/packages/opentelemetry-sdk-trace-web/test/registration.test.ts index e2c497883cd..e001b2b742b 100644 --- a/packages/opentelemetry-sdk-trace-web/test/registration.test.ts +++ b/packages/opentelemetry-sdk-trace-web/test/registration.test.ts @@ -84,7 +84,7 @@ describe('API registration', () => { propagator: null, }); - assert.strictEqual(propagation['_getGlobalPropagator'](), propagator, 'propagator should not change') + assert.strictEqual(propagation['_getGlobalPropagator'](), propagator, 'propagator should not change'); assert.ok(context['_getContextManager']() instanceof StackContextManager); const apiTracerProvider = trace.getTracerProvider() as ProxyTracerProvider; diff --git a/packages/opentelemetry-semantic-conventions/src/resource/SemanticResourceAttributes.ts b/packages/opentelemetry-semantic-conventions/src/resource/SemanticResourceAttributes.ts index 9e3a9d02aee..561a20c46c8 100644 --- a/packages/opentelemetry-semantic-conventions/src/resource/SemanticResourceAttributes.ts +++ b/packages/opentelemetry-semantic-conventions/src/resource/SemanticResourceAttributes.ts @@ -474,7 +474,7 @@ As an alternative, consider setting `faas.id` as a span attribute instead. * Additional description of the web engine (e.g. detailed version and edition information). */ WEBENGINE_DESCRIPTION: 'webengine.description', -} +}; export const CloudProviderValues = { @@ -486,8 +486,8 @@ export const CloudProviderValues = { AZURE: 'azure', /** Google Cloud Platform. */ GCP: 'gcp', -} as const -export type CloudProviderValues = typeof CloudProviderValues[keyof typeof CloudProviderValues] +} as const; +export type CloudProviderValues = typeof CloudProviderValues[keyof typeof CloudProviderValues]; @@ -527,8 +527,8 @@ export const CloudPlatformValues = { GCP_CLOUD_FUNCTIONS: 'gcp_cloud_functions', /** Google Cloud App Engine (GAE). */ GCP_APP_ENGINE: 'gcp_app_engine', -} as const -export type CloudPlatformValues = typeof CloudPlatformValues[keyof typeof CloudPlatformValues] +} as const; +export type CloudPlatformValues = typeof CloudPlatformValues[keyof typeof CloudPlatformValues]; @@ -538,8 +538,8 @@ export const AwsEcsLaunchtypeValues = { EC2: 'ec2', /** fargate. */ FARGATE: 'fargate', -} as const -export type AwsEcsLaunchtypeValues = typeof AwsEcsLaunchtypeValues[keyof typeof AwsEcsLaunchtypeValues] +} as const; +export type AwsEcsLaunchtypeValues = typeof AwsEcsLaunchtypeValues[keyof typeof AwsEcsLaunchtypeValues]; @@ -559,8 +559,8 @@ export const HostArchValues = { PPC64: 'ppc64', /** 32-bit x86. */ X86: 'x86', -} as const -export type HostArchValues = typeof HostArchValues[keyof typeof HostArchValues] +} as const; +export type HostArchValues = typeof HostArchValues[keyof typeof HostArchValues]; @@ -588,8 +588,8 @@ export const OsTypeValues = { SOLARIS: 'solaris', /** IBM z/OS. */ Z_OS: 'z_os', -} as const -export type OsTypeValues = typeof OsTypeValues[keyof typeof OsTypeValues] +} as const; +export type OsTypeValues = typeof OsTypeValues[keyof typeof OsTypeValues]; @@ -615,6 +615,6 @@ export const TelemetrySdkLanguageValues = { RUBY: 'ruby', /** webjs. */ WEBJS: 'webjs', -} as const -export type TelemetrySdkLanguageValues = typeof TelemetrySdkLanguageValues[keyof typeof TelemetrySdkLanguageValues] +} as const; +export type TelemetrySdkLanguageValues = typeof TelemetrySdkLanguageValues[keyof typeof TelemetrySdkLanguageValues]; diff --git a/packages/opentelemetry-semantic-conventions/src/trace/SemanticAttributes.ts b/packages/opentelemetry-semantic-conventions/src/trace/SemanticAttributes.ts index 052d36e4c08..4f653555ed2 100644 --- a/packages/opentelemetry-semantic-conventions/src/trace/SemanticAttributes.ts +++ b/packages/opentelemetry-semantic-conventions/src/trace/SemanticAttributes.ts @@ -721,7 +721,7 @@ the closest proxy. * Uncompressed size of the message in bytes. */ MESSAGE_UNCOMPRESSED_SIZE: 'message.uncompressed_size', -} +}; export const DbSystemValues = { @@ -819,8 +819,8 @@ export const DbSystemValues = { MEMCACHED: 'memcached', /** CockroachDB. */ COCKROACHDB: 'cockroachdb', -} as const -export type DbSystemValues = typeof DbSystemValues[keyof typeof DbSystemValues] +} as const; +export type DbSystemValues = typeof DbSystemValues[keyof typeof DbSystemValues]; @@ -848,8 +848,8 @@ export const DbCassandraConsistencyLevelValues = { SERIAL: 'serial', /** local_serial. */ LOCAL_SERIAL: 'local_serial', -} as const -export type DbCassandraConsistencyLevelValues = typeof DbCassandraConsistencyLevelValues[keyof typeof DbCassandraConsistencyLevelValues] +} as const; +export type DbCassandraConsistencyLevelValues = typeof DbCassandraConsistencyLevelValues[keyof typeof DbCassandraConsistencyLevelValues]; @@ -865,8 +865,8 @@ export const FaasTriggerValues = { TIMER: 'timer', /** If none of the others apply. */ OTHER: 'other', -} as const -export type FaasTriggerValues = typeof FaasTriggerValues[keyof typeof FaasTriggerValues] +} as const; +export type FaasTriggerValues = typeof FaasTriggerValues[keyof typeof FaasTriggerValues]; @@ -878,8 +878,8 @@ export const FaasDocumentOperationValues = { EDIT: 'edit', /** When an object is deleted. */ DELETE: 'delete', -} as const -export type FaasDocumentOperationValues = typeof FaasDocumentOperationValues[keyof typeof FaasDocumentOperationValues] +} as const; +export type FaasDocumentOperationValues = typeof FaasDocumentOperationValues[keyof typeof FaasDocumentOperationValues]; @@ -893,8 +893,8 @@ export const FaasInvokedProviderValues = { AZURE: 'azure', /** Google Cloud Platform. */ GCP: 'gcp', -} as const -export type FaasInvokedProviderValues = typeof FaasInvokedProviderValues[keyof typeof FaasInvokedProviderValues] +} as const; +export type FaasInvokedProviderValues = typeof FaasInvokedProviderValues[keyof typeof FaasInvokedProviderValues]; @@ -914,8 +914,8 @@ export const NetTransportValues = { INPROC: 'inproc', /** Something else (non IP-based). */ OTHER: 'other', -} as const -export type NetTransportValues = typeof NetTransportValues[keyof typeof NetTransportValues] +} as const; +export type NetTransportValues = typeof NetTransportValues[keyof typeof NetTransportValues]; @@ -931,8 +931,8 @@ export const NetHostConnectionTypeValues = { UNAVAILABLE: 'unavailable', /** unknown. */ UNKNOWN: 'unknown', -} as const -export type NetHostConnectionTypeValues = typeof NetHostConnectionTypeValues[keyof typeof NetHostConnectionTypeValues] +} as const; +export type NetHostConnectionTypeValues = typeof NetHostConnectionTypeValues[keyof typeof NetHostConnectionTypeValues]; @@ -980,8 +980,8 @@ export const NetHostConnectionSubtypeValues = { NRNSA: 'nrnsa', /** LTE CA. */ LTE_CA: 'lte_ca', -} as const -export type NetHostConnectionSubtypeValues = typeof NetHostConnectionSubtypeValues[keyof typeof NetHostConnectionSubtypeValues] +} as const; +export type NetHostConnectionSubtypeValues = typeof NetHostConnectionSubtypeValues[keyof typeof NetHostConnectionSubtypeValues]; @@ -997,8 +997,8 @@ export const HttpFlavorValues = { SPDY: 'SPDY', /** QUIC protocol. */ QUIC: 'QUIC', -} as const -export type HttpFlavorValues = typeof HttpFlavorValues[keyof typeof HttpFlavorValues] +} as const; +export type HttpFlavorValues = typeof HttpFlavorValues[keyof typeof HttpFlavorValues]; @@ -1008,8 +1008,8 @@ export const MessagingDestinationKindValues = { QUEUE: 'queue', /** A message sent to a topic. */ TOPIC: 'topic', -} as const -export type MessagingDestinationKindValues = typeof MessagingDestinationKindValues[keyof typeof MessagingDestinationKindValues] +} as const; +export type MessagingDestinationKindValues = typeof MessagingDestinationKindValues[keyof typeof MessagingDestinationKindValues]; @@ -1019,8 +1019,8 @@ export const MessagingOperationValues = { RECEIVE: 'receive', /** process. */ PROCESS: 'process', -} as const -export type MessagingOperationValues = typeof MessagingOperationValues[keyof typeof MessagingOperationValues] +} as const; +export type MessagingOperationValues = typeof MessagingOperationValues[keyof typeof MessagingOperationValues]; @@ -1060,8 +1060,8 @@ export const RpcGrpcStatusCodeValues = { DATA_LOSS: 15, /** UNAUTHENTICATED. */ UNAUTHENTICATED: 16, -} as const -export type RpcGrpcStatusCodeValues = typeof RpcGrpcStatusCodeValues[keyof typeof RpcGrpcStatusCodeValues] +} as const; +export type RpcGrpcStatusCodeValues = typeof RpcGrpcStatusCodeValues[keyof typeof RpcGrpcStatusCodeValues]; @@ -1071,6 +1071,6 @@ export const MessageTypeValues = { SENT: 'SENT', /** received. */ RECEIVED: 'RECEIVED', -} as const -export type MessageTypeValues = typeof MessageTypeValues[keyof typeof MessageTypeValues] +} as const; +export type MessageTypeValues = typeof MessageTypeValues[keyof typeof MessageTypeValues];