Skip to content

Commit

Permalink
chore(deps): update prettier to v3 and prettier-plugin-eslint to v5 (o…
Browse files Browse the repository at this point in the history
…pen-telemetry#4075)

* chore(deps): update dependency prettier to v3

* chore: bump prettier-plugin-eslint and apply rules

---------

Co-authored-by: Mend Renovate <[email protected]>
Co-authored-by: Daniel Dyla <[email protected]>
  • Loading branch information
3 people authored Aug 23, 2023
1 parent 863c4d4 commit dfe9bdd
Show file tree
Hide file tree
Showing 25 changed files with 80 additions and 44 deletions.
12 changes: 6 additions & 6 deletions api/src/metrics/Meter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export interface Meter {
* @param [options] the metric options.
*/
createUpDownCounter<
AttributesTypes extends MetricAttributes = MetricAttributes
AttributesTypes extends MetricAttributes = MetricAttributes,
>(
name: string,
options?: MetricOptions
Expand All @@ -100,7 +100,7 @@ export interface Meter {
* @param [options] the metric options.
*/
createObservableGauge<
AttributesTypes extends MetricAttributes = MetricAttributes
AttributesTypes extends MetricAttributes = MetricAttributes,
>(
name: string,
options?: MetricOptions
Expand All @@ -115,7 +115,7 @@ export interface Meter {
* @param [options] the metric options.
*/
createObservableCounter<
AttributesTypes extends MetricAttributes = MetricAttributes
AttributesTypes extends MetricAttributes = MetricAttributes,
>(
name: string,
options?: MetricOptions
Expand All @@ -130,7 +130,7 @@ export interface Meter {
* @param [options] the metric options.
*/
createObservableUpDownCounter<
AttributesTypes extends MetricAttributes = MetricAttributes
AttributesTypes extends MetricAttributes = MetricAttributes,
>(
name: string,
options?: MetricOptions
Expand All @@ -151,7 +151,7 @@ export interface Meter {
* @param observables the observables associated with this batch observable callback
*/
addBatchObservableCallback<
AttributesTypes extends MetricAttributes = MetricAttributes
AttributesTypes extends MetricAttributes = MetricAttributes,
>(
callback: BatchObservableCallback<AttributesTypes>,
observables: Observable<AttributesTypes>[]
Expand All @@ -167,7 +167,7 @@ export interface Meter {
* @param observables the observables associated with this batch observable callback
*/
removeBatchObservableCallback<
AttributesTypes extends MetricAttributes = MetricAttributes
AttributesTypes extends MetricAttributes = MetricAttributes,
>(
callback: BatchObservableCallback<AttributesTypes>,
observables: Observable<AttributesTypes>[]
Expand Down
18 changes: 9 additions & 9 deletions api/src/metrics/Metric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export enum ValueType {
* <ol>
*/
export interface Counter<
AttributesTypes extends MetricAttributes = MetricAttributes
AttributesTypes extends MetricAttributes = MetricAttributes,
> {
/**
* Increment value of counter by the input. Inputs must not be negative.
Expand All @@ -72,7 +72,7 @@ export interface Counter<
}

export interface UpDownCounter<
AttributesTypes extends MetricAttributes = MetricAttributes
AttributesTypes extends MetricAttributes = MetricAttributes,
> {
/**
* Increment value of counter by the input. Inputs may be negative.
Expand All @@ -81,7 +81,7 @@ export interface UpDownCounter<
}

export interface Histogram<
AttributesTypes extends MetricAttributes = MetricAttributes
AttributesTypes extends MetricAttributes = MetricAttributes,
> {
/**
* Records a measurement. Value of the measurement must not be negative.
Expand All @@ -103,7 +103,7 @@ export type MetricAttributeValue = AttributeValue;
* The observable callback for Observable instruments.
*/
export type ObservableCallback<
AttributesTypes extends MetricAttributes = MetricAttributes
AttributesTypes extends MetricAttributes = MetricAttributes,
> = (
observableResult: ObservableResult<AttributesTypes>
) => void | Promise<void>;
Expand All @@ -112,13 +112,13 @@ export type ObservableCallback<
* The observable callback for a batch of Observable instruments.
*/
export type BatchObservableCallback<
AttributesTypes extends MetricAttributes = MetricAttributes
AttributesTypes extends MetricAttributes = MetricAttributes,
> = (
observableResult: BatchObservableResult<AttributesTypes>
) => void | Promise<void>;

export interface Observable<
AttributesTypes extends MetricAttributes = MetricAttributes
AttributesTypes extends MetricAttributes = MetricAttributes,
> {
/**
* Sets up a function that will be called whenever a metric collection is initiated.
Expand All @@ -134,11 +134,11 @@ export interface Observable<
}

export type ObservableCounter<
AttributesTypes extends MetricAttributes = MetricAttributes
AttributesTypes extends MetricAttributes = MetricAttributes,
> = Observable<AttributesTypes>;
export type ObservableUpDownCounter<
AttributesTypes extends MetricAttributes = MetricAttributes
AttributesTypes extends MetricAttributes = MetricAttributes,
> = Observable<AttributesTypes>;
export type ObservableGauge<
AttributesTypes extends MetricAttributes = MetricAttributes
AttributesTypes extends MetricAttributes = MetricAttributes,
> = Observable<AttributesTypes>;
4 changes: 2 additions & 2 deletions api/src/metrics/ObservableResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { MetricAttributes, Observable } from './Metric';
* Interface that is being used in callback function for Observable Metric.
*/
export interface ObservableResult<
AttributesTypes extends MetricAttributes = MetricAttributes
AttributesTypes extends MetricAttributes = MetricAttributes,
> {
/**
* Observe a measurement of the value associated with the given attributes.
Expand All @@ -41,7 +41,7 @@ export interface ObservableResult<
* Interface that is being used in batch observable callback function.
*/
export interface BatchObservableResult<
AttributesTypes extends MetricAttributes = MetricAttributes
AttributesTypes extends MetricAttributes = MetricAttributes,
> {
/**
* Observe a measurement of the value associated with the given attributes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ import { ExportResultCode } from '@opentelemetry/core';
let fakeRequest: PassThrough;

class MockedResponse extends Stream {
constructor(private _code: number, private _msg?: string) {
constructor(
private _code: number,
private _msg?: string
) {
super();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ export function ensureExportLogsServiceRequestIsSet(
}

export class MockedResponse extends Stream {
constructor(private _code: number, private _msg?: string) {
constructor(
private _code: number,
private _msg?: string
) {
super();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
import { Stream } from 'stream';

export class MockedResponse extends Stream {
constructor(private _code: number, private _msg?: string) {
constructor(
private _code: number,
private _msg?: string
) {
super();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,10 @@ export function ensureExportTraceServiceRequestIsSet(
}

export class MockedResponse extends Stream {
constructor(private _code: number, private _msg?: string) {
constructor(
private _code: number,
private _msg?: string
) {
super();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class OTLPMetricExporterBase<
OTLPMetricExporterOptions,
ResourceMetrics,
IExportMetricsServiceRequest
>
>,
> implements PushMetricExporter
{
public _otlpExporter: T;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
import { Stream } from 'stream';

export class MockedResponse extends Stream {
constructor(private _code: number, private _msg?: string) {
constructor(
private _code: number,
private _msg?: string
) {
super();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,10 @@ export function ensureExportMetricsServiceRequestIsSet(
}

export class MockedResponse extends Stream {
constructor(private _code: number, private _msg?: string) {
constructor(
private _code: number,
private _msg?: string
) {
super();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class HttpInstrumentation extends InstrumentationBase<Http> {

init(): [
InstrumentationNodeModuleDefinition<Https>,
InstrumentationNodeModuleDefinition<Http>
InstrumentationNodeModuleDefinition<Http>,
] {
return [this._getHttpsInstrumentation(), this._getHttpInstrumentation()];
}
Expand Down Expand Up @@ -237,7 +237,7 @@ export class HttpInstrumentation extends InstrumentationBase<Http> {
// https://nodejs.org/dist/latest/docs/api/http.html#http_http_get_options_callback
// https://github.com/googleapis/cloud-trace-nodejs/blob/master/src/instrumentations/instrumentation-http.ts#L198
return function outgoingGetRequest<
T extends http.RequestOptions | string | url.URL
T extends http.RequestOptions | string | url.URL,
>(options: T, ...args: HttpRequestArgs): http.ClientRequest {
const req = clientRequest(options, ...args);
req.end();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { configureExporterTimeout } from './util';
export abstract class OTLPExporterBase<
T extends OTLPExporterConfigBase,
ExportItem,
ServiceRequest
ServiceRequest,
> {
public readonly url: string;
public readonly hostname: string | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { getEnv, baggageUtils } from '@opentelemetry/core';
*/
export abstract class OTLPExporterBrowserBase<
ExportItem,
ServiceRequest
ServiceRequest,
> extends OTLPExporterBase<OTLPExporterConfigBase, ExportItem, ServiceRequest> {
protected _headers: Record<string, string>;
private _useXHR: boolean = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { getEnv, baggageUtils } from '@opentelemetry/core';
*/
export abstract class OTLPExporterNodeBase<
ExportItem,
ServiceRequest
ServiceRequest,
> extends OTLPExporterBase<
OTLPExporterNodeConfigBase,
ExportItem,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
*/
export abstract class OTLPGRPCExporterNodeBase<
ExportItem,
ServiceRequest
ServiceRequest,
> extends OTLPExporterBase<
OTLPGRPCExporterConfigNode,
ExportItem,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { getExportRequestProto } from '../util';
*/
export abstract class OTLPProtoExporterBrowserBase<
ExportItem,
ServiceRequest
ServiceRequest,
> extends OTLPExporterBaseMain<ExportItem, ServiceRequest> {
constructor(config: OTLPExporterConfigBase = {}) {
super(config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type SendFn = <ExportItem, ServiceRequest>(
*/
export abstract class OTLPProtoExporterNodeBase<
ExportItem,
ServiceRequest
ServiceRequest,
> extends OTLPExporterBaseMain<ExportItem, ServiceRequest> {
private _send!: SendFn;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ export abstract class BatchLogRecordProcessorBase<T extends BufferConfig>
private _timer: NodeJS.Timeout | undefined;
private _shutdownOnce: BindOnceFuture<void>;

constructor(private readonly _exporter: LogRecordExporter, config?: T) {
constructor(
private readonly _exporter: LogRecordExporter,
config?: T
) {
const env = getEnv();
this._maxExportBatchSize =
config?.maxExportBatchSize ?? env.OTEL_BLRP_MAX_EXPORT_BATCH_SIZE;
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@
"eslint-config-prettier": "8.5.0",
"eslint-plugin-header": "3.1.1",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-prettier": "5.0.0",
"gh-pages": "5.0.0",
"lerna": "7.1.4",
"@lerna/legacy-package-management": "7.1.4",
"linkinator": "5.0.1",
"markdownlint-cli": "0.35.0",
"prettier": "2.8.8",
"prettier": "3.0.2",
"semver": "7.5.4",
"typedoc": "0.22.18",
"typedoc-plugin-missing-exports": "1.0.0",
Expand Down
7 changes: 5 additions & 2 deletions packages/opentelemetry-core/src/utils/callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ import { Deferred } from './promise';
export class BindOnceFuture<
R,
This = unknown,
T extends (this: This, ...args: unknown[]) => R = () => R
T extends (this: This, ...args: unknown[]) => R = () => R,
> {
private _isCalled = false;
private _deferred = new Deferred<R>();
constructor(private _callback: T, private _that: This) {}
constructor(
private _callback: T,
private _that: This
) {}

get isCalled() {
return this._isCalled;
Expand Down
5 changes: 4 additions & 1 deletion packages/opentelemetry-core/test/utils/merge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,10 @@ class A {
}

class B extends A {
constructor(name = 'foo', private _ver = 1) {
constructor(
name = 'foo',
private _ver = 1
) {
super(name);
}
getVer() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ export abstract class BatchSpanProcessorBase<T extends BufferConfig>
private _shutdownOnce: BindOnceFuture<void>;
private _droppedSpansCount: number = 0;

constructor(private readonly _exporter: SpanExporter, config?: T) {
constructor(
private readonly _exporter: SpanExporter,
config?: T
) {
const env = getEnv();
this._maxExportBatchSize =
typeof config?.maxExportBatchSize === 'number'
Expand Down Expand Up @@ -200,8 +203,8 @@ export abstract class BatchSpanProcessorBase<T extends BufferConfig>
doExport();
} else {
Promise.all(
pendingResources.map(resource =>
resource.waitForAsyncAttributes?.()
pendingResources.map(
resource => resource.waitForAsyncAttributes?.()
)
).then(doExport, err => {
globalErrorHandler(err);
Expand Down
5 changes: 4 additions & 1 deletion packages/sdk-metrics/src/aggregator/ExponentialHistogram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ class HighLow {
static combine(h1: HighLow, h2: HighLow): HighLow {
return new HighLow(Math.min(h1.low, h2.low), Math.max(h1.high, h2.high));
}
constructor(public low: number, public high: number) {}
constructor(
public low: number,
public high: number
) {}
}

const MAX_SCALE = 20;
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-metrics/src/state/MeterSharedState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class MeterSharedState {

private _registerMetricStorage<
MetricStorageType extends MetricStorageConstructor,
R extends InstanceType<MetricStorageType>
R extends InstanceType<MetricStorageType>,
>(
descriptor: InstrumentDescriptor,
MetricStorageType: MetricStorageType
Expand Down
Loading

0 comments on commit dfe9bdd

Please sign in to comment.