Skip to content

Commit

Permalink
refactor(open-telemetry-node): remove deprecated methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Strazz1337 committed Oct 3, 2024
1 parent 181ec01 commit 89f1c27
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ import { NodeSDK } from '@opentelemetry/sdk-node';
import { MeterProvider } from '@opentelemetry/sdk-metrics';

export interface IOpenTelemetryBuilder {
/**
* @deprecated - will be removed in v1.1, use {@link withDiagLogging} instead.
* for identical behaviour use `withDiagLogging(DiagLogLevel.DEBUG)`
*/
withDebugLogging(): this;

/**
* Enables diagnostic logging with the specified level.
* @param level
Expand Down Expand Up @@ -98,12 +92,6 @@ export class OpenTelemetryBuilder implements IOpenTelemetryBuilder {
return this;
}

/** @inheritdoc */
public withDebugLogging(): this {
this.diagLogLevel = DiagLogLevel.DEBUG;
return this;
}

public withLogging(
optionsBuilder: OptionsBuilderFn<IOpenTelemetryLoggingOptionsBuilder>
): this;
Expand Down
52 changes: 0 additions & 52 deletions packages/open-telemetry-node/src/metrics/metrics/gauge.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,58 +24,6 @@ describe('Gauge', () => {
jest.useFakeTimers().setSystemTime(currentDate.getTime());
});

describe('set', () => {
it('should set the correct count and attributes when set is called', async () => {
// Arrange
const value = 5;
const attributes = { test: 'test' };

// Act
gauge?.set(value, attributes);

// Assert
const metrics = await getMetrics();
const metricDescriptor = metrics?.descriptor;
expect(metricDescriptor?.name).toEqual(metricName);

const dataPoints = metrics?.dataPoints;
expect(dataPoints).toHaveLength(1);

const gaugeData = dataPoints?.[0];
expect(gaugeData?.value).toEqual(value);
expect(gaugeData?.attributes).toEqual(attributes);
});

it('should set multiple data points for the same metric when set is called multiple times with different attributes', async () => {
// Arrange
const attributes2 = { test: 'test' };
const attributes3 = { test: 'test2' };

// Act
gauge?.set(1);
gauge?.set(2, attributes2);
gauge?.set(3, attributes3);

// Assert
const metrics = await getMetrics();
const metricDescriptor = metrics?.descriptor;
expect(metricDescriptor?.name).toEqual(metricName);

const dataPoints = metrics?.dataPoints;
expect(dataPoints).toHaveLength(3);

const [gaugeData, gaugeData2, gaugeData3] = dataPoints ?? [];
expect(gaugeData?.value).toEqual(1);
expect(gaugeData?.attributes).toEqual({});

expect(gaugeData2?.value).toEqual(2);
expect(gaugeData2?.attributes).toEqual(attributes2);

expect(gaugeData3?.value).toEqual(3);
expect(gaugeData3?.attributes).toEqual(attributes3);
});
});

describe('record', () => {
it('should set the correct count and attributes when set is called', async () => {
// Arrange
Expand Down
7 changes: 0 additions & 7 deletions packages/open-telemetry-node/src/metrics/metrics/gauge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ export class Gauge {
this.record(Date.now() / 1000, attributes);
}

/**
* @deprecated use {@link record} instead. Will be removed in version 1.1.
*/
public set(value: number, attributes?: Attributes): void {
this.gauge.record(value, attributes);
}

/**
* Records the value to the gauge.
* @param value the value to record.
Expand Down

0 comments on commit 89f1c27

Please sign in to comment.