Skip to content

Commit 369b07e

Browse files
authored
chore: enforce format with prettier (open-telemetry#3444)
1 parent b152497 commit 369b07e

File tree

318 files changed

+7696
-4737
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

318 files changed

+7696
-4737
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/
2727
### :house: (Internal)
2828

2929
* chore: automatically generate tsconfigs [#3432](https://github.com/open-telemetry/opentelemetry-js/pull/3432) @legendecas
30+
* chore: enforce format with prettier [#3444](https://github.com/open-telemetry/opentelemetry-js/pull/3444) @legendecas
3031

3132
## 1.8.0
3233

api/src/api/diag.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export class DiagAPI implements DiagLogger, DiagLoggerApi {
6868

6969
const setLogger: DiagLoggerApi['setLogger'] = (
7070
logger,
71-
optionsOrLogLevel = { logLevel: DiagLogLevel.INFO },
71+
optionsOrLogLevel = { logLevel: DiagLogLevel.INFO }
7272
) => {
7373
if (logger === self) {
7474
// There isn't much we can do here.
@@ -88,7 +88,10 @@ export class DiagAPI implements DiagLogger, DiagLoggerApi {
8888
}
8989

9090
const oldLogger = getGlobal('diag');
91-
const newLogger = createLogLevelDiagLogger(optionsOrLogLevel.logLevel ?? DiagLogLevel.INFO, logger);
91+
const newLogger = createLogLevelDiagLogger(
92+
optionsOrLogLevel.logLevel ?? DiagLogLevel.INFO,
93+
logger
94+
);
9295
// There already is an logger registered. We'll let it know before overwriting it.
9396
if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
9497
const stack = new Error().stack ?? '<failed to generate stacktrace>';

api/src/api/metrics.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
import { Meter, MeterOptions } from '../metrics/Meter';
1818
import { MeterProvider } from '../metrics/MeterProvider';
1919
import { NOOP_METER_PROVIDER } from '../metrics/NoopMeterProvider';
20-
import { getGlobal, registerGlobal, unregisterGlobal } from '../internal/global-utils';
20+
import {
21+
getGlobal,
22+
registerGlobal,
23+
unregisterGlobal,
24+
} from '../internal/global-utils';
2125
import { DiagAPI } from './diag';
2226

2327
const API_NAME = 'metrics';
@@ -58,7 +62,11 @@ export class MetricsAPI {
5862
/**
5963
* Returns a meter from the global meter provider.
6064
*/
61-
public getMeter(name: string, version?: string, options?: MeterOptions): Meter {
65+
public getMeter(
66+
name: string,
67+
version?: string,
68+
options?: MeterOptions
69+
): Meter {
6270
return this.getMeterProvider().getMeter(name, version, options);
6371
}
6472

api/src/common/Attributes.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* Note: only the own enumerable keys are counted as valid attribute keys.
2121
*/
2222
export interface Attributes {
23-
[attributeKey: string]: AttributeValue | undefined;
23+
[attributeKey: string]: AttributeValue | undefined;
2424
}
2525

2626
/**
@@ -29,9 +29,9 @@ export interface Attributes {
2929
* null or undefined attribute values are invalid and will result in undefined behavior.
3030
*/
3131
export type AttributeValue =
32-
| string
33-
| number
34-
| boolean
35-
| Array<null | undefined | string>
36-
| Array<null | undefined | number>
37-
| Array<null | undefined | boolean>;
32+
| string
33+
| number
34+
| boolean
35+
| Array<null | undefined | string>
36+
| Array<null | undefined | number>
37+
| Array<null | undefined | boolean>;

api/src/diag/types.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,13 @@ export interface LoggerOptions {
113113

114114
export interface DiagLoggerApi {
115115
/**
116-
* Set the global DiagLogger and DiagLogLevel.
117-
* If a global diag logger is already set, this will override it.
118-
*
119-
* @param logger - The {@link DiagLogger} instance to set as the default logger.
120-
* @param options - A {@link LoggerOptions} object. If not provided, default values will be set.
121-
* @returns `true` if the logger was successfully registered, else `false`
122-
*/
116+
* Set the global DiagLogger and DiagLogLevel.
117+
* If a global diag logger is already set, this will override it.
118+
*
119+
* @param logger - The {@link DiagLogger} instance to set as the default logger.
120+
* @param options - A {@link LoggerOptions} object. If not provided, default values will be set.
121+
* @returns `true` if the logger was successfully registered, else `false`
122+
*/
123123
setLogger(logger: DiagLogger, options?: LoggerOptions): boolean;
124124

125125
/**

api/src/index.ts

+8-34
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,15 @@
1414
* limitations under the License.
1515
*/
1616

17-
export {
18-
BaggageEntry,
19-
BaggageEntryMetadata,
20-
Baggage,
21-
} from './baggage/types';
17+
export { BaggageEntry, BaggageEntryMetadata, Baggage } from './baggage/types';
2218
export { baggageEntryMetadataFromString } from './baggage/utils';
2319
export { Exception } from './common/Exception';
2420
export { HrTime, TimeInput } from './common/Time';
2521
export { Attributes, AttributeValue } from './common/Attributes';
2622

2723
// Context APIs
28-
export {
29-
createContextKey,
30-
ROOT_CONTEXT,
31-
} from './context/context';
32-
export {
33-
Context,
34-
ContextManager,
35-
} from './context/types';
24+
export { createContextKey, ROOT_CONTEXT } from './context/context';
25+
export { Context, ContextManager } from './context/types';
3626
export type { ContextAPI } from './api/context';
3727

3828
// Diag APIs
@@ -46,16 +36,9 @@ export {
4636
export type { DiagAPI } from './api/diag';
4737

4838
// Metrics APIs
49-
export {
50-
createNoopMeter,
51-
} from './metrics/NoopMeter';
52-
export {
53-
MeterOptions,
54-
Meter,
55-
} from './metrics/Meter';
56-
export {
57-
MeterProvider,
58-
} from './metrics/MeterProvider';
39+
export { createNoopMeter } from './metrics/NoopMeter';
40+
export { MeterOptions, Meter } from './metrics/Meter';
41+
export { MeterProvider } from './metrics/MeterProvider';
5942
export {
6043
ValueType,
6144
Counter,
@@ -87,10 +70,7 @@ export {
8770
export type { PropagationAPI } from './api/propagation';
8871

8972
// Trace APIs
90-
export {
91-
SpanAttributes,
92-
SpanAttributeValue,
93-
} from './trace/attributes';
73+
export { SpanAttributes, SpanAttributeValue } from './trace/attributes';
9474
export { Link } from './trace/link';
9575
export { ProxyTracer, TracerDelegator } from './trace/ProxyTracer';
9676
export { ProxyTracerProvider } from './trace/ProxyTracerProvider';
@@ -128,13 +108,7 @@ import { propagation } from './propagation-api';
128108
import { trace } from './trace-api';
129109

130110
// Named export.
131-
export {
132-
context,
133-
diag,
134-
metrics,
135-
propagation,
136-
trace,
137-
};
111+
export { context, diag, metrics, propagation, trace };
138112
// Default export.
139113
export default {
140114
context,

api/src/metrics/Meter.ts

+21-6
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,12 @@ export interface Meter {
8484
* @param name the name of the metric.
8585
* @param [options] the metric options.
8686
*/
87-
createUpDownCounter<AttributesTypes extends MetricAttributes = MetricAttributes>(name: string, options?: MetricOptions): UpDownCounter<AttributesTypes>;
87+
createUpDownCounter<
88+
AttributesTypes extends MetricAttributes = MetricAttributes
89+
>(
90+
name: string,
91+
options?: MetricOptions
92+
): UpDownCounter<AttributesTypes>;
8893

8994
/**
9095
* Creates a new `ObservableGauge` metric.
@@ -94,7 +99,9 @@ export interface Meter {
9499
* @param name the name of the metric.
95100
* @param [options] the metric options.
96101
*/
97-
createObservableGauge<AttributesTypes extends MetricAttributes = MetricAttributes>(
102+
createObservableGauge<
103+
AttributesTypes extends MetricAttributes = MetricAttributes
104+
>(
98105
name: string,
99106
options?: MetricOptions
100107
): ObservableGauge<AttributesTypes>;
@@ -107,7 +114,9 @@ export interface Meter {
107114
* @param name the name of the metric.
108115
* @param [options] the metric options.
109116
*/
110-
createObservableCounter<AttributesTypes extends MetricAttributes = MetricAttributes>(
117+
createObservableCounter<
118+
AttributesTypes extends MetricAttributes = MetricAttributes
119+
>(
111120
name: string,
112121
options?: MetricOptions
113122
): ObservableCounter<AttributesTypes>;
@@ -120,7 +129,9 @@ export interface Meter {
120129
* @param name the name of the metric.
121130
* @param [options] the metric options.
122131
*/
123-
createObservableUpDownCounter<AttributesTypes extends MetricAttributes = MetricAttributes>(
132+
createObservableUpDownCounter<
133+
AttributesTypes extends MetricAttributes = MetricAttributes
134+
>(
124135
name: string,
125136
options?: MetricOptions
126137
): ObservableUpDownCounter<AttributesTypes>;
@@ -139,7 +150,9 @@ export interface Meter {
139150
* @param callback the batch observable callback
140151
* @param observables the observables associated with this batch observable callback
141152
*/
142-
addBatchObservableCallback<AttributesTypes extends MetricAttributes = MetricAttributes>(
153+
addBatchObservableCallback<
154+
AttributesTypes extends MetricAttributes = MetricAttributes
155+
>(
143156
callback: BatchObservableCallback<AttributesTypes>,
144157
observables: Observable<AttributesTypes>[]
145158
): void;
@@ -153,7 +166,9 @@ export interface Meter {
153166
* @param callback the batch observable callback
154167
* @param observables the observables associated with this batch observable callback
155168
*/
156-
removeBatchObservableCallback<AttributesTypes extends MetricAttributes = MetricAttributes>(
169+
removeBatchObservableCallback<
170+
AttributesTypes extends MetricAttributes = MetricAttributes
171+
>(
157172
callback: BatchObservableCallback<AttributesTypes>,
158173
observables: Observable<AttributesTypes>[]
159174
): void;

api/src/metrics/Metric.ts

+31-11
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,27 @@ export enum ValueType {
6262
* <li> count the number of 5xx errors. </li>
6363
* <ol>
6464
*/
65-
export interface Counter<AttributesTypes extends MetricAttributes = MetricAttributes> {
65+
export interface Counter<
66+
AttributesTypes extends MetricAttributes = MetricAttributes
67+
> {
6668
/**
6769
* Increment value of counter by the input. Inputs must not be negative.
6870
*/
6971
add(value: number, attributes?: AttributesTypes, context?: Context): void;
7072
}
7173

72-
export interface UpDownCounter<AttributesTypes extends MetricAttributes = MetricAttributes> {
74+
export interface UpDownCounter<
75+
AttributesTypes extends MetricAttributes = MetricAttributes
76+
> {
7377
/**
7478
* Increment value of counter by the input. Inputs may be negative.
7579
*/
7680
add(value: number, attributes?: AttributesTypes, context?: Context): void;
7781
}
7882

79-
export interface Histogram<AttributesTypes extends MetricAttributes = MetricAttributes> {
83+
export interface Histogram<
84+
AttributesTypes extends MetricAttributes = MetricAttributes
85+
> {
8086
/**
8187
* Records a measurement. Value of the measurement must not be negative.
8288
*/
@@ -96,16 +102,24 @@ export type MetricAttributeValue = AttributeValue;
96102
/**
97103
* The observable callback for Observable instruments.
98104
*/
99-
export type ObservableCallback<AttributesTypes extends MetricAttributes = MetricAttributes> =
100-
(observableResult: ObservableResult<AttributesTypes>) => void | Promise<void>;
105+
export type ObservableCallback<
106+
AttributesTypes extends MetricAttributes = MetricAttributes
107+
> = (
108+
observableResult: ObservableResult<AttributesTypes>
109+
) => void | Promise<void>;
101110

102111
/**
103112
* The observable callback for a batch of Observable instruments.
104113
*/
105-
export type BatchObservableCallback<AttributesTypes extends MetricAttributes = MetricAttributes> =
106-
(observableResult: BatchObservableResult<AttributesTypes>) => void | Promise<void>;
114+
export type BatchObservableCallback<
115+
AttributesTypes extends MetricAttributes = MetricAttributes
116+
> = (
117+
observableResult: BatchObservableResult<AttributesTypes>
118+
) => void | Promise<void>;
107119

108-
export interface Observable<AttributesTypes extends MetricAttributes = MetricAttributes> {
120+
export interface Observable<
121+
AttributesTypes extends MetricAttributes = MetricAttributes
122+
> {
109123
/**
110124
* Sets up a function that will be called whenever a metric collection is initiated.
111125
*
@@ -119,6 +133,12 @@ export interface Observable<AttributesTypes extends MetricAttributes = MetricAtt
119133
removeCallback(callback: ObservableCallback<AttributesTypes>): void;
120134
}
121135

122-
export type ObservableCounter<AttributesTypes extends MetricAttributes=MetricAttributes> = Observable<AttributesTypes>;
123-
export type ObservableUpDownCounter<AttributesTypes extends MetricAttributes=MetricAttributes> = Observable<AttributesTypes>;
124-
export type ObservableGauge<AttributesTypes extends MetricAttributes=MetricAttributes> = Observable<AttributesTypes>;
136+
export type ObservableCounter<
137+
AttributesTypes extends MetricAttributes = MetricAttributes
138+
> = Observable<AttributesTypes>;
139+
export type ObservableUpDownCounter<
140+
AttributesTypes extends MetricAttributes = MetricAttributes
141+
> = Observable<AttributesTypes>;
142+
export type ObservableGauge<
143+
AttributesTypes extends MetricAttributes = MetricAttributes
144+
> = Observable<AttributesTypes>;

0 commit comments

Comments
 (0)