Skip to content

Commit 9b89800

Browse files
chore(renovate): Update dependency @biomejs/biome (#23)
* chore(renovate): Update dependency @biomejs/biome * refactor: fix biome upgrade issues --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Ivan Porto <iporto@adobe.com>
1 parent 335fd27 commit 9b89800

File tree

10 files changed

+94
-65
lines changed

10 files changed

+94
-65
lines changed

biome.jsonc

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.1.3/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.2.2/schema.json",
33
"extends": ["ultracite"],
44

55
"files": {
@@ -38,6 +38,19 @@
3838
}
3939
},
4040

41+
"overrides": [
42+
{
43+
"includes": ["tests/**/*"],
44+
"linter": {
45+
"rules": {
46+
"style": {
47+
"noMagicNumbers": "off"
48+
}
49+
}
50+
}
51+
}
52+
],
53+
4154
"assist": {
4255
"actions": {
4356
"source": {

package-lock.json

Lines changed: 36 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
"winston-transport": "^4.9.0"
9393
},
9494
"devDependencies": {
95-
"@biomejs/biome": "2.1.3",
95+
"@biomejs/biome": "2.2.0",
9696
"@changesets/changelog-github": "0.5.1",
9797
"@changesets/cli": "2.29.5",
9898
"@tsconfig/node-lts": "^22.0.2",

source/core/logging.ts

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,22 @@ import type { TelemetryDiagnosticsConfig } from "~/types";
2626
// If no log level is given, use [INFO].
2727
const DEFAULT_LOG_LEVEL = "info";
2828

29+
type GetLoggerInternalConfig = {
30+
name: string;
31+
config?: AioLoggerConfig;
32+
forceSDKInitialized?: boolean;
33+
addTransport?: boolean;
34+
telemetryTransportOptions?: Transport.TransportStreamOptions;
35+
};
36+
2937
/** @internal */
30-
function __getLoggerInternal(
31-
name: string,
32-
config?: AioLoggerConfig,
38+
function __getLoggerInternal({
39+
name,
40+
config,
3341
forceSDKInitialized = true,
3442
addTransport = true,
35-
telemetryTransportOptions: Transport.TransportStreamOptions = {},
36-
) {
43+
telemetryTransportOptions = {},
44+
}: GetLoggerInternalConfig) {
3745
if (forceSDKInitialized) {
3846
ensureSdkInitialized();
3947
}
@@ -76,7 +84,7 @@ function __getLoggerInternal(
7684
* ```
7785
*/
7886
export function getLogger(name: string, config?: AioLoggerConfig) {
79-
return __getLoggerInternal(name, config, true);
87+
return __getLoggerInternal({ name, config, forceSDKInitialized: true });
8088
}
8189

8290
/**
@@ -98,21 +106,23 @@ export function setOtelDiagLogger({
98106

99107
const aioLogLevel = logLevels[level] ?? level;
100108
const { actionName } = getRuntimeActionMetadata();
101-
const logger = __getLoggerInternal(
102-
loggerName ?? `${actionName}/otel-diagnostics`,
103-
{
109+
const logger = __getLoggerInternal({
110+
name: loggerName ?? `${actionName}/otel-diagnostics`,
111+
config: {
104112
level: aioLogLevel,
105113
logSourceAction: false,
106114
},
107-
false,
108-
exportLogs,
115+
forceSDKInitialized: false,
116+
addTransport: exportLogs,
117+
109118
// Only use the OpenTelemetry transport (i.e. export diagnostic logs) if the log level is
110119
// set to info, warn or error. The other levels are too verbose to be exported and may expose
111120
// irrelevant/sensitive information. All logs will still be visible via `aio rt activation logs <id>`.
112-
level === "info" || level === "warn" || level === "error"
113-
? { level }
114-
: { level: "info" },
115-
);
121+
telemetryTransportOptions:
122+
level === "info" || level === "warn" || level === "error"
123+
? { level }
124+
: { level: "info" },
125+
});
116126

117127
// Wrap the logger in a DiagLogger compatible interface.
118128
const logLevel = level.toUpperCase() as keyof typeof DiagLogLevel;

source/core/metrics.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export function defineMetrics<T extends Record<PropertyKey, MetricTypes>>(
5959
// This way we can defer the initialization of the metrics until the telemetry API (meter) is initialized.
6060
return new Proxy({} as T, {
6161
get(_, prop: PropertyKey) {
62+
// biome-ignore lint/nursery/noUnnecessaryConditions: False positive
6263
if (isInitializing) {
6364
// Would happen if using a metric inside the `defineMetrics` function.
6465
throw new Error(

source/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* governing permissions and limitations under the License.
1111
*/
1212

13+
/** biome-ignore-all lint/performance/noBarrelFile: This is the import entrypoint for the public API. */
1314
// This file collects and exports all the public API of the telemetry module.
1415

1516
export {

source/otel.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
// It provides core APIs, SDKs, exporters, and resources while omitting
1515
// specialized packages like individual instrumentations and similar utilities.
1616

17+
/** biome-ignore-all lint/performance/noBarrelFile: This is the import entrypoint for the public API. */
18+
1719
export * from "@opentelemetry/api";
1820
export * from "@opentelemetry/api-logs";
1921
export { OTLPLogExporter as OTLPLogExporterGrpc } from "@opentelemetry/exporter-logs-otlp-grpc";

source/types.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export type TelemetryInstrumentationPreset = "simple" | "full";
3838
* The configuration for the telemetry diagnostics.
3939
* @since 0.1.0
4040
*/
41-
export interface TelemetryDiagnosticsConfig {
41+
export type TelemetryDiagnosticsConfig = {
4242
/**
4343
* The log level to use for the diagnostics.
4444
* @since 0.1.0
@@ -61,13 +61,13 @@ export interface TelemetryDiagnosticsConfig {
6161
* @since 0.1.0
6262
*/
6363
exportLogs?: boolean;
64-
}
64+
};
6565

6666
/**
6767
* Configuration related to context propagation (for distributed tracing).
6868
* @since 0.1.0
6969
*/
70-
export interface TelemetryPropagationConfig {
70+
export type TelemetryPropagationConfig = {
7171
/**
7272
* By default, an instrumented entrypoint will try to automatically read (and use) the context from the incoming request.
7373
* Set to `true` if you want to skip this automatic context propagation.
@@ -90,13 +90,13 @@ export interface TelemetryPropagationConfig {
9090
carrier: Record<PropertyKey, string>;
9191
baseCtx?: Context;
9292
};
93-
}
93+
};
9494

9595
/**
9696
* The configuration for instrumentation.
9797
* @since 0.1.0
9898
*/
99-
export interface InstrumentationConfig<T extends AnyFunction> {
99+
export type InstrumentationConfig<T extends AnyFunction> = {
100100
/**
101101
* Configuration options related to the span started by the instrumented function.
102102
* See also the [SpanOptions](https://open-telemetry.github.io/opentelemetry-js/interfaces/_opentelemetry_api._opentelemetry_api.SpanOptions.html) interface.
@@ -158,7 +158,7 @@ export interface InstrumentationConfig<T extends AnyFunction> {
158158
*/
159159
onError?: (error: unknown, span: Span) => Error | undefined;
160160
};
161-
}
161+
};
162162

163163
/**
164164
* The configuration options for the telemetry module.
@@ -213,7 +213,7 @@ export interface EntrypointInstrumentationConfig
213213
* Defines the global telemetry API. These items should be set once per application.
214214
* @since 0.1.0
215215
*/
216-
export interface TelemetryApi {
216+
export type TelemetryApi = {
217217
/**
218218
* The tracer used to create spans.
219219
* @since 0.1.0
@@ -225,13 +225,13 @@ export interface TelemetryApi {
225225
* @since 0.1.0
226226
*/
227227
meter: Meter;
228-
}
228+
};
229229

230230
/**
231231
* The context for the current operation.
232232
* @since 0.1.0
233233
*/
234-
export interface InstrumentationContext {
234+
export type InstrumentationContext = {
235235
/**
236236
* The global (managed by the library) tracer instance used to create spans.
237237
* @since 0.1.0
@@ -261,4 +261,4 @@ export interface InstrumentationContext {
261261
* @since 0.1.0
262262
*/
263263
contextCarrier: Record<PropertyKey, string>;
264-
}
264+
};

tests/fixtures/environment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ export function setupProductionEnv() {
5858

5959
// The `__OW_DEADLINE` env var represents the timestamp (in ms)
6060
// by which the action execution must be completed.
61-
const oneMonthInMilliseconds = 30 * 24 * 60 * 60 * 1000;
61+
const oneMonthInMilliseconds = 2_592_000_000;
6262
vi.stubEnv("__OW_DEADLINE", `${Date.now() + oneMonthInMilliseconds}`);
6363
}

tests/unit/api/presets.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ describe("api/presets", () => {
2727
test("should return simple instrumentations for 'simple' preset", () => {
2828
const instrumentations = apiPresets.getPresetInstrumentations("simple");
2929
expect(Array.isArray(instrumentations)).toBe(true);
30-
expect(instrumentations).toHaveLength(3);
30+
31+
const expectedInstrumentations = 3;
32+
expect(instrumentations).toHaveLength(expectedInstrumentations);
3133

3234
const instrumentationNames = instrumentations.map(
3335
(i) => i.instrumentationName,

0 commit comments

Comments
 (0)