Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ For notes on migrating to 2.x / 0.200.x see [the upgrade guide](doc/upgrade-to-2
* refactor(sdk-metrics): remove isNotNullish() utility function [#6151](https://github.com/open-telemetry/opentelemetry-js/pull/6151) @cjihrig
* refactor(sdk-metrics): remove FlatMap() utility function [#6154](https://github.com/open-telemetry/opentelemetry-js/pull/6154) @cjihrig
* refactor(sdk-metrics): simplify AllowList and DenyList processors [#6159](https://github.com/open-telemetry/opentelemetry-js/pull/6159) @cjihrig
* chore: disallow constructor parameter property syntax [#6187](https://github.com/open-telemetry/opentelemetry-js/pull/6187) @legendecas

## 2.2.0

Expand Down
1 change: 1 addition & 0 deletions api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ fix(api): prioritize `esnext` export condition as it is more specific [#5458](ht

* refactor(api): remove "export *" in favor of explicit named exports [#4880](https://github.com/open-telemetry/opentelemetry-js/pull/4880) @robbkidd
* chore: enable tsconfig isolatedModules [#5697](https://github.com/open-telemetry/opentelemetry-js/pull/5697) @legendecas
* chore: disallow constructor parameter property syntax [#6187](https://github.com/open-telemetry/opentelemetry-js/pull/6187) @legendecas

## 1.9.0

Expand Down
8 changes: 5 additions & 3 deletions api/src/trace/NonRecordingSpan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ import { Link } from './link';
* propagation.
*/
export class NonRecordingSpan implements Span {
constructor(
private readonly _spanContext: SpanContext = INVALID_SPAN_CONTEXT
) {}
private readonly _spanContext: SpanContext;

constructor(spanContext: SpanContext = INVALID_SPAN_CONTEXT) {
this._spanContext = spanContext;
}

// Returns a SpanContext.
spanContext(): SpanContext {
Expand Down
19 changes: 14 additions & 5 deletions api/src/trace/ProxyTracer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,22 @@ const NOOP_TRACER = new NoopTracer();
export class ProxyTracer implements Tracer {
// When a real implementation is provided, this will be it
private _delegate?: Tracer;
private _provider: TracerDelegator;
public readonly name: string;
public readonly version?: string;
public readonly options?: TracerOptions;

constructor(
private _provider: TracerDelegator,
public readonly name: string,
public readonly version?: string,
public readonly options?: TracerOptions
) {}
provider: TracerDelegator,
name: string,
version?: string,
options?: TracerOptions
) {
this._provider = provider;
this.name = name;
this.version = version;
this.options = options;
}

startSpan(name: string, options?: SpanOptions, context?: Context): Span {
return this._getTracer().startSpan(name, options, context);
Expand Down
1 change: 1 addition & 0 deletions eslint.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ module.exports = {
"@typescript-eslint/no-empty-function": ["off"],
"@typescript-eslint/no-unsafe-function-type": ["warn"],
"@typescript-eslint/no-shadow": ["warn"],
"@typescript-eslint/parameter-properties": "error",
"no-restricted-syntax": ["error", "ExportAllDeclaration"],
"prefer-rest-params": "off",
}
Expand Down
1 change: 1 addition & 0 deletions experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ For notes on migrating to 2.x / 0.200.x see [the upgrade guide](doc/upgrade-to-2
* refactor(opentelemetry-sdk-node): simplify calculation of validPropagators [#6143](https://github.com/open-telemetry/opentelemetry-js/pull/6143) @cjihrig
* test(instrumentation-http): replace uses of deprecated abort() [#6149](https://github.com/open-telemetry/opentelemetry-js/pull/6149) @cjihrig
* refactor(configuration): simplify boolean check [#6158](https://github.com/open-telemetry/opentelemetry-js/pull/6158) @cjihrig
* chore: disallow constructor parameter property syntax [#6187](https://github.com/open-telemetry/opentelemetry-js/pull/6187) @legendecas
* refactor(otlp-transformer): migrate from protobufjs to protobuf-es [#6179](https://github.com/open-telemetry/opentelemetry-js/pull/6179) @overbalance
* chore(otlp-transformer, sampler-composite): clean up tsconfig after protobuf-es migration [#6192](https://github.com/open-telemetry/opentelemetry-js/pull/6192) @overbalance

Expand Down
19 changes: 14 additions & 5 deletions experimental/packages/api-logs/src/ProxyLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,22 @@ import { LogRecord } from './types/LogRecord';
export class ProxyLogger implements Logger {
// When a real implementation is provided, this will be it
private _delegate?: Logger;
private _provider: LoggerDelegator;
public readonly name: string;
public readonly version?: string | undefined;
public readonly options?: LoggerOptions | undefined;

constructor(
private _provider: LoggerDelegator,
public readonly name: string,
public readonly version?: string | undefined,
public readonly options?: LoggerOptions | undefined
) {}
provider: LoggerDelegator,
name: string,
version?: string | undefined,
options?: LoggerOptions | undefined
) {
this._provider = provider;
this.name = name;
this.version = version;
this.options = options;
}

/**
* Emit a log record. This method should only be used by log appenders.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,10 @@ describe('PrometheusExporter', () => {
});

class RequestStatusError extends Error {
constructor(public statusCode: number | undefined) {
public statusCode: number | undefined;
constructor(statusCode: number | undefined) {
super('request failed with non-200 code');
this.statusCode = statusCode;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
import { MetricReader, PushMetricExporter } from '@opentelemetry/sdk-metrics';

export class TestMetricReader extends MetricReader {
constructor(private _exporter: PushMetricExporter) {
private _exporter: PushMetricExporter;
constructor(exporter: PushMetricExporter) {
super({
aggregationTemporalitySelector:
_exporter.selectAggregationTemporality?.bind(_exporter),
exporter.selectAggregationTemporality?.bind(exporter),
});
this._exporter = exporter;
}

protected onForceFlush(): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,10 @@ function createMainResource(resource = {}): PerformanceResourceTiming {

function createFakePerformanceObs(url: string) {
class FakePerfObs implements PerformanceObserver {
constructor(private readonly cb: PerformanceObserverCallback) {}
private readonly cb: PerformanceObserverCallback;
constructor(cb: PerformanceObserverCallback) {
this.cb = cb;
}

observe() {
const absoluteUrl = url.startsWith('http') ? url : location.origin + url;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,17 @@ export abstract class InstrumentationAbstract<
private _meter: Meter;
private _logger: Logger;
protected _diag: DiagLogger;
public readonly instrumentationName: string;
public readonly instrumentationVersion: string;

constructor(
public readonly instrumentationName: string,
public readonly instrumentationVersion: string,
instrumentationName: string,
instrumentationVersion: string,
config: ConfigType
) {
this.instrumentationName = instrumentationName;
this.instrumentationVersion = instrumentationVersion;

this.setConfig(config);

this._diag = diag.createComponentLogger({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,23 @@ export class InstrumentationNodeModuleDefinition
implements InstrumentationModuleDefinition
{
files: InstrumentationModuleFile[];
public name: string;
public supportedVersions: string[];
public patch;
public unpatch;
constructor(
public name: string,
public supportedVersions: string[],
name: string,
supportedVersions: string[],
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public patch?: (exports: any, moduleVersion?: string) => any,
patch?: (exports: any, moduleVersion?: string) => any,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public unpatch?: (exports: any, moduleVersion?: string) => void,
unpatch?: (exports: any, moduleVersion?: string) => void,
files?: InstrumentationModuleFile[]
) {
this.files = files || [];
this.name = name;
this.supportedVersions = supportedVersions;
this.patch = patch;
this.unpatch = unpatch;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,21 @@ export class InstrumentationNodeModuleFile
implements InstrumentationModuleFile
{
public name: string;
public supportedVersions: string[];
public patch;
public unpatch;

constructor(
name: string,
public supportedVersions: string[],
supportedVersions: string[],
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public patch: (moduleExports: any, moduleVersion?: string) => any,
patch: (moduleExports: any, moduleVersion?: string) => any,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public unpatch: (moduleExports?: any, moduleVersion?: string) => void
unpatch: (moduleExports?: any, moduleVersion?: string) => void
) {
this.name = normalize(name);
this.supportedVersions = supportedVersions;
this.patch = patch;
this.unpatch = unpatch;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ import { ExportResult } from '@opentelemetry/core';
import { IOtlpExportDelegate } from './otlp-export-delegate';

export class OTLPExporterBase<Internal> {
constructor(private _delegate: IOtlpExportDelegate<Internal>) {}
private _delegate: IOtlpExportDelegate<Internal>;
constructor(delegate: IOtlpExportDelegate<Internal>) {
this._delegate = delegate;
}

/**
* Export items.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,24 @@ class OTLPExportDelegate<Internal, Response>
implements IOtlpExportDelegate<Internal>
{
private _diagLogger: DiagLogger;
private _transport: IExporterTransport;
private _serializer: ISerializer<Internal, Response>;
private _responseHandler: IOtlpResponseHandler<Response>;
private _promiseQueue: IExportPromiseHandler;
private _timeout: number;

constructor(
private _transport: IExporterTransport,
private _serializer: ISerializer<Internal, Response>,
private _responseHandler: IOtlpResponseHandler<Response>,
private _promiseQueue: IExportPromiseHandler,
private _timeout: number
transport: IExporterTransport,
serializer: ISerializer<Internal, Response>,
responseHandler: IOtlpResponseHandler<Response>,
promiseQueue: IExportPromiseHandler,
timeout: number
) {
this._transport = transport;
this._serializer = serializer;
this._responseHandler = responseHandler;
this._promiseQueue = promiseQueue;
this._timeout = timeout;
this._diagLogger = diag.createComponentLogger({
namespace: 'OTLPExportDelegate',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ function getJitter() {
}

class RetryingTransport implements IExporterTransport {
constructor(private _transport: IExporterTransport) {}
private _transport: IExporterTransport;

constructor(transport: IExporterTransport) {
this._transport = transport;
}

private retry(
data: Uint8Array,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ export interface FetchTransportParameters {
}

class FetchTransport implements IExporterTransport {
constructor(private _parameters: FetchTransportParameters) {}
private _parameters: FetchTransportParameters;

constructor(parameters: FetchTransportParameters) {
this._parameters = parameters;
}

async send(data: Uint8Array, timeoutMillis: number): Promise<ExportResponse> {
const abortController = new AbortController();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ interface Utils {

class HttpExporterTransport implements IExporterTransport {
private _utils: Utils | null = null;
private _parameters: NodeHttpRequestParameters;

constructor(private _parameters: NodeHttpRequestParameters) {}
constructor(parameters: NodeHttpRequestParameters) {
this._parameters = parameters;
}

async send(data: Uint8Array, timeoutMillis: number): Promise<ExportResponse> {
const { agent, request } = await this._loadUtils();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ export interface SendBeaconParameters {
}

class SendBeaconTransport implements IExporterTransport {
constructor(private _params: SendBeaconParameters) {}
private _params: SendBeaconParameters;
constructor(params: SendBeaconParameters) {
this._params = params;
}

async send(data: Uint8Array): Promise<ExportResponse> {
const blobType = (await this._params.headers())['Content-Type'];
return new Promise<ExportResponse>(resolve => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ export interface XhrRequestParameters {
}

class XhrTransport implements IExporterTransport {
constructor(private _parameters: XhrRequestParameters) {}
private _parameters: XhrRequestParameters;

constructor(parameters: XhrRequestParameters) {
this._parameters = parameters;
}

async send(data: Uint8Array, timeoutMillis: number): Promise<ExportResponse> {
const headers = await this._parameters.headers();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,11 @@ export interface GrpcExporterTransportParameters {
export class GrpcExporterTransport implements IExporterTransport {
private _client?: Client;
private _metadata?: Metadata;
private _parameters: GrpcExporterTransportParameters;

constructor(private _parameters: GrpcExporterTransportParameters) {}
constructor(parameters: GrpcExporterTransportParameters) {
this._parameters = parameters;
}

shutdown() {
this._client?.close();
Expand Down
6 changes: 5 additions & 1 deletion experimental/packages/sampler-composite/src/composite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ import {
} from './util';

class CompositeSampler implements Sampler {
constructor(private readonly delegate: ComposableSampler) {}
private readonly delegate: ComposableSampler;

constructor(delegate: ComposableSampler) {
this.delegate = delegate;
}

shouldSample(
context: Context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ import { INVALID_THRESHOLD, isValidThreshold, MIN_THRESHOLD } from './util';

class ComposableParentThresholdSampler implements ComposableSampler {
private readonly description: string;
private readonly rootSampler: ComposableSampler;

constructor(private readonly rootSampler: ComposableSampler) {
constructor(rootSampler: ComposableSampler) {
this.rootSampler = rootSampler;
this.description = `ComposableParentThresholdSampler(rootSampler=${rootSampler})`;
}

Expand Down
12 changes: 9 additions & 3 deletions experimental/packages/sdk-logs/src/Logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@ import { LogRecordImpl } from './LogRecordImpl';
import { LoggerProviderSharedState } from './internal/LoggerProviderSharedState';

export class Logger implements logsAPI.Logger {
public readonly instrumentationScope: InstrumentationScope;
private _sharedState: LoggerProviderSharedState;

constructor(
public readonly instrumentationScope: InstrumentationScope,
private _sharedState: LoggerProviderSharedState
) {}
instrumentationScope: InstrumentationScope,
sharedState: LoggerProviderSharedState
) {
this.instrumentationScope = instrumentationScope;
this._sharedState = sharedState;
}

public emit(logRecord: logsAPI.LogRecord): void {
const currentContext = logRecord.context || context.active();
Expand Down
11 changes: 8 additions & 3 deletions experimental/packages/sdk-logs/src/MultiLogRecordProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,15 @@ import type { SdkLogRecord } from './export/SdkLogRecord';
* received events to a list of {@link LogRecordProcessor}s.
*/
export class MultiLogRecordProcessor implements LogRecordProcessor {
public readonly processors: LogRecordProcessor[];
public readonly forceFlushTimeoutMillis: number;
constructor(
public readonly processors: LogRecordProcessor[],
public readonly forceFlushTimeoutMillis: number
) {}
processors: LogRecordProcessor[],
forceFlushTimeoutMillis: number
) {
this.processors = processors;
this.forceFlushTimeoutMillis = forceFlushTimeoutMillis;
}

public async forceFlush(): Promise<void> {
const timeout = this.forceFlushTimeoutMillis;
Expand Down
Loading