Skip to content

Commit 843811a

Browse files
chore: add cache-busting to e2e tests and improve mysql2 base connection support (#33)
* fixes * improve mysql2 version handling * fix script * fix integration test
1 parent 30601bc commit 843811a

24 files changed

Lines changed: 556 additions & 351 deletions

File tree

docs/nextjs-initialization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Next.js Initialization
1+
# Next.js Initialization (Beta)
22

33
This guide explains how to set up Tusk Drift in your Next.js application.
44

src/core/tracing/JsonSchemaHelper.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export class JsonSchemaHelper {
169169

170170
/**
171171
* Generate schema from data object using standardized types
172-
*
172+
*
173173
* Note: We properties always exists on JsonSchema because proto3 maps cannot be marked optional.
174174
* The JSON data is a bit inefficient because of this, but the easiest way to handle this is to keep it for now.
175175
*/
@@ -188,7 +188,10 @@ export class JsonSchemaHelper {
188188
if (Array.isArray(data) && data.length === 0) {
189189
return { type: JsonSchemaType.ORDERED_LIST, properties: {} };
190190
}
191-
const items = Array.isArray(data) && data.length > 0 ? JsonSchemaHelper.generateSchema(data[0]) : undefined;
191+
const items =
192+
Array.isArray(data) && data.length > 0
193+
? JsonSchemaHelper.generateSchema(data[0])
194+
: undefined;
192195
if (items !== undefined) {
193196
return {
194197
type: JsonSchemaType.ORDERED_LIST,

src/instrumentation/libraries/fetch/e2e-tests/cjs-fetch/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ COPY src/instrumentation/libraries/fetch/e2e-tests/cjs-fetch/tsconfig.json ./
99
# Install dependencies
1010
RUN npm install
1111

12+
# Add cache-busting argument to force fresh CLI download
13+
ARG CACHEBUST=1
1214
# Install Tusk Drift CLI
1315
RUN curl -fsSL https://raw.githubusercontent.com/Use-Tusk/tusk-drift-cli/main/install.sh | sh
1416

src/instrumentation/libraries/fetch/e2e-tests/esm-fetch/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ COPY src/instrumentation/libraries/fetch/e2e-tests/esm-fetch/tsconfig.json ./
99
# Install dependencies
1010
RUN npm install
1111

12+
# Add cache-busting argument to force fresh CLI download
13+
ARG CACHEBUST=1
1214
# Install Tusk Drift CLI
1315
RUN curl -fsSL https://raw.githubusercontent.com/Use-Tusk/tusk-drift-cli/main/install.sh | sh
1416

src/instrumentation/libraries/grpc/e2e-tests/cjs-grpc/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ COPY src/instrumentation/libraries/grpc/e2e-tests/cjs-grpc/tsconfig.json ./
99
# Install dependencies
1010
RUN npm install
1111

12+
# Add cache-busting argument to force fresh CLI download
13+
ARG CACHEBUST=1
1214
# Install Tusk Drift CLI
1315
RUN curl -fsSL https://raw.githubusercontent.com/Use-Tusk/tusk-drift-cli/main/install.sh | sh
1416

src/instrumentation/libraries/grpc/e2e-tests/esm-grpc/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ COPY src/instrumentation/libraries/grpc/e2e-tests/esm-grpc/tsconfig.json ./
99
# Install dependencies
1010
RUN npm install
1111

12+
# Add cache-busting argument to force fresh CLI download
13+
ARG CACHEBUST=1
1214
# Install Tusk Drift CLI
1315
RUN curl -fsSL https://raw.githubusercontent.com/Use-Tusk/tusk-drift-cli/main/install.sh | sh
1416

src/instrumentation/libraries/http/Instrumentation.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export class HttpInstrumentation extends TdInstrumentationBase {
9191
}
9292

9393
// ESM Support: Detect if this is an ESM module
94-
const isESM = (httpModule as any)[Symbol.toStringTag] === 'Module';
94+
const isESM = (httpModule as any)[Symbol.toStringTag] === "Module";
9595

9696
if (isESM) {
9797
// ESM Case: Also set wrapped methods on the default export
@@ -181,6 +181,8 @@ export class HttpInstrumentation extends TdInstrumentationBase {
181181
return originalHandler.call(this);
182182
}
183183

184+
logger.debug(`[HttpInstrumentation] Setting replay trace id`, replayTraceId);
185+
184186
// Set env vars for current trace
185187
const envVars = this.replayHooks.extractEnvVarsFromHeaders(req);
186188
if (envVars) {
@@ -933,7 +935,7 @@ export class HttpInstrumentation extends TdInstrumentationBase {
933935
complete: true,
934936
readable: false,
935937
// Add error-specific fields
936-
errorName: error.name || 'UNKNOWN',
938+
errorName: error.name || "UNKNOWN",
937939
errorMessage: error.message,
938940
};
939941

src/instrumentation/libraries/http/e2e-tests/cjs-http/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ COPY src/instrumentation/libraries/http/e2e-tests/cjs-http/tsconfig.json ./
99
# Install dependencies
1010
RUN npm install
1111

12+
# Add cache-busting argument to force fresh CLI download
13+
ARG CACHEBUST=1
1214
# Install Tusk Drift CLI
1315
RUN curl -fsSL https://raw.githubusercontent.com/Use-Tusk/tusk-drift-cli/main/install.sh | sh
1416

src/instrumentation/libraries/http/e2e-tests/esm-http/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ COPY src/instrumentation/libraries/http/e2e-tests/esm-http/tsconfig.json ./
99
# Install dependencies
1010
RUN npm install
1111

12+
# Add cache-busting argument to force fresh CLI download
13+
ARG CACHEBUST=1
1214
# Install Tusk Drift CLI
1315
RUN curl -fsSL https://raw.githubusercontent.com/Use-Tusk/tusk-drift-cli/main/install.sh | sh
1416

src/instrumentation/libraries/ioredis/Instrumentation.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ import {
1717
IORedisOutputValue,
1818
BufferMetadata,
1919
} from "./types";
20-
import {
21-
convertValueToJsonable,
22-
} from "./utils";
20+
import { convertValueToJsonable } from "./utils";
2321
import { PackageType } from "@use-tusk/drift-schemas/core/span";
2422
import { logger } from "../../../core/utils/logger";
2523

@@ -125,7 +123,7 @@ export class IORedisInstrumentation extends TdInstrumentationBase {
125123
const actualExports = isESM ? moduleExports.default : moduleExports;
126124

127125
if (!actualExports || !actualExports.prototype) {
128-
logger.error(`[IORedisInstrumentation] Invalid Pipeline module exports, cannot patch`);
126+
logger.debug(`[IORedisInstrumentation] Invalid Pipeline module exports, cannot patch`);
129127
return moduleExports;
130128
}
131129

@@ -550,7 +548,10 @@ export class IORedisInstrumentation extends TdInstrumentationBase {
550548
return promise;
551549
}
552550

553-
private async _handleReplayConnect(spanInfo: SpanInfo, thisContext: IORedisInterface): Promise<any> {
551+
private async _handleReplayConnect(
552+
spanInfo: SpanInfo,
553+
thisContext: IORedisInterface,
554+
): Promise<any> {
554555
logger.debug(`[IORedisInstrumentation] Replaying IORedis connect`);
555556

556557
// Connect operations typically don't have meaningful output to replay

0 commit comments

Comments
 (0)