Skip to content

Commit 94b8800

Browse files
committed
Remove low-value comments
1 parent 615d1a5 commit 94b8800

3 files changed

Lines changed: 2 additions & 29 deletions

File tree

integration-tests/tests/on-demand.test.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,8 @@ describe('On-Demand Integration Tests', () => {
1818
runtime,
1919
}));
2020

21-
// Force cold starts
2221
await Promise.all(functions.map(fn => forceColdStart(fn.functionName)));
2322

24-
// Add 5s delay between invocations to ensure warm container is reused
25-
// Required because there is post-runtime processing with 'end' flush strategy
26-
// invokeAndCollectTelemetry now returns DatadogTelemetry with metrics included
2723
telemetry = await invokeAndCollectTelemetry(functions, 2, 1, 5000);
2824

2925
console.log('All invocations and data fetching completed');
@@ -76,7 +72,6 @@ describe('On-Demand Integration Tests', () => {
7672
});
7773
});
7874

79-
// Python has known issues with cold_start spans - mark as failing
8075
if (runtime === 'python') {
8176
it.failing('[failing] should have aws.lambda.cold_start span', () => {
8277
const result = getFirstInvocation();
@@ -154,8 +149,6 @@ describe('On-Demand Integration Tests', () => {
154149
});
155150
});
156151

157-
// All duration metrics tests are skipped - metrics indexing is unreliable
158-
// TODO: Investigate why Datadog metrics API returns inconsistent results
159152
describe.skip('duration metrics', () => {
160153
it('should emit aws.lambda.enhanced.runtime_duration', () => {
161154
const points = getTelemetry().metrics.duration['runtime_duration'];
@@ -181,7 +174,6 @@ describe('On-Demand Integration Tests', () => {
181174
expect(points[points.length - 1].value).toBeGreaterThanOrEqual(0);
182175
});
183176

184-
// First invocation is a forced cold start, so init_duration should be emitted
185177
it('should emit aws.lambda.enhanced.init_duration for cold start', () => {
186178
const points = getTelemetry().metrics.duration['init_duration'];
187179
expect(points.length).toBeGreaterThan(0);

integration-tests/tests/utils/datadog.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,14 @@ export async function getTraces(
133133
requestId: string,
134134
): Promise<DatadogTrace[]> {
135135
const now = Date.now();
136-
const fromTime = now - (1 * 60 * 60 * 1000); // 1 hour ago
136+
const fromTime = now - (1 * 60 * 60 * 1000);
137137
const toTime = now;
138-
// Convert service name to lowercase as Datadog stores it that way
139138
const serviceNameLower = serviceName.toLowerCase();
140139
const query = `service:${serviceNameLower} @request_id:${requestId}`;
141140

142141
try {
143142
console.log(`Searching for traces: ${query}`);
144143

145-
// First, find spans matching the request_id to get trace IDs
146144
const initialResponse = await datadogClient.post('/api/v2/spans/events/search', {
147145
data: {
148146
type: 'search_request',
@@ -163,7 +161,6 @@ export async function getTraces(
163161
const initialSpans = initialResponse.data.data || [];
164162
console.log(`Found ${initialSpans.length} initial span(s)`);
165163

166-
// Extract unique trace IDs
167164
const traceIds = new Set<string>();
168165
for (const spanData of initialSpans) {
169166
const traceId = spanData.attributes?.trace_id;
@@ -174,7 +171,6 @@ export async function getTraces(
174171

175172
console.log(`Found ${traceIds.size} unique trace(s)`);
176173

177-
// Now fetch all spans for each trace ID
178174
const allSpans: any[] = [];
179175
for (const traceId of traceIds) {
180176
const traceResponse = await datadogClient.post('/api/v2/spans/events/search', {
@@ -197,7 +193,6 @@ export async function getTraces(
197193
allSpans.push(...traceSpans);
198194
}
199195

200-
// Group spans by trace_id to reconstruct traces
201196
const traceMap = new Map<string, DatadogSpan[]>();
202197

203198
for (const spanData of allSpans) {
@@ -216,7 +211,6 @@ export async function getTraces(
216211
}
217212
}
218213

219-
// Convert map to array of traces
220214
const traces: DatadogTrace[] = [];
221215
for (const [traceId, spans] of traceMap.entries()) {
222216
traces.push({
@@ -242,7 +236,7 @@ export async function getLogs(
242236
requestId: string,
243237
): Promise<DatadogLog[]> {
244238
const now = Date.now();
245-
const fromTime = now - (2 * 60 * 60 * 1000); // 2 hours ago
239+
const fromTime = now - (2 * 60 * 60 * 1000);
246240
const toTime = now;
247241
const query = `service:${serviceName} @lambda.request_id:${requestId}`;
248242

@@ -263,7 +257,6 @@ export async function getLogs(
263257
const rawLogs = response.data.data || [];
264258
console.log(`Found ${rawLogs.length} log(s)`);
265259

266-
// Transform raw logs to DatadogLog format
267260
const logs: DatadogLog[] = rawLogs.map((logData: any) => {
268261
const attrs = logData.attributes || {};
269262
return {
@@ -292,7 +285,6 @@ export async function getEnhancedMetrics(
292285
): Promise<EnhancedMetrics> {
293286
const result: Partial<EnhancedMetrics> = {};
294287

295-
// Fetch all categories in parallel
296288
const categoryPromises = Object.entries(ENHANCED_METRICS_CONFIG).map(
297289
async ([category, metricNames]) => {
298290
const categoryMetrics = await fetchMetricCategory(
@@ -325,7 +317,6 @@ async function fetchMetricCategory(
325317
): Promise<Record<string, MetricPoint[]>> {
326318
const promises = metricNames.map(async (metricName) => {
327319
const points = await getMetrics(metricName, functionName, fromTime, toTime);
328-
// Use short name (last part after the last dot)
329320
const shortName = metricName.split('.').pop()!;
330321
return { shortName, points };
331322
});
@@ -350,7 +341,6 @@ async function getMetrics(
350341
fromTime: number,
351342
toTime: number
352343
): Promise<MetricPoint[]> {
353-
// Strip alias/version from function name - metrics are tagged with base name only
354344
const baseFunctionName = getServiceName(functionName).toLowerCase();
355345
const query = `avg:${metricName}{functionname:${baseFunctionName}}`;
356346

@@ -371,7 +361,6 @@ async function getMetrics(
371361
return [];
372362
}
373363

374-
// Return points from first series
375364
return (series[0].pointlist || []).map((p: [number, number]) => ({
376365
timestamp: p[0],
377366
value: p[1],

integration-tests/tests/utils/default.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ async function invokeThread(
3131
const result = await invokeLambda(functionName, payload);
3232
results.push(result);
3333

34-
// Delay between requests (but not after the last one)
3534
if (delayBetweenRequestsMs > 0 && i < numInvocations - 1) {
3635
await sleep(delayBetweenRequestsMs);
3736
}
@@ -58,10 +57,8 @@ export async function invokeAndCollectTelemetry(
5857
payload: any = {},
5958
datadogIndexingWaitMs: number = DEFAULT_DATADOG_INDEXING_WAIT_MS,
6059
): Promise<Record<string, DatadogTelemetry>> {
61-
// Capture start time for metrics query
6260
const invocationStartTime = Date.now();
6361

64-
// Start all threads for all functions in parallel
6562
const allPromises: { runtime: string; functionName: string; promise: Promise<InvocationResult[]> }[] = [];
6663

6764
for (const fn of functions) {
@@ -74,7 +71,6 @@ export async function invokeAndCollectTelemetry(
7471
}
7572
}
7673

77-
// Wait for all invocations to complete
7874
const resolvedResults = await Promise.all(
7975
allPromises.map(async (p) => ({
8076
runtime: p.runtime,
@@ -83,12 +79,10 @@ export async function invokeAndCollectTelemetry(
8379
}))
8480
);
8581

86-
// Wait for Datadog indexing
8782
await sleep(datadogIndexingWaitMs);
8883

8984
const metricsEndTime = Date.now();
9085

91-
// Fetch telemetry (traces/logs) and organize by runtime
9286
const telemetryByRuntime: Record<string, InvocationTracesLogs[][]> = {};
9387

9488
for (const { runtime, functionName, results } of resolvedResults) {
@@ -117,7 +111,6 @@ export async function invokeAndCollectTelemetry(
117111
telemetryByRuntime[runtime].push(threadTelemetry);
118112
}
119113

120-
// Fetch metrics for each runtime (errors propagate - test will fail)
121114
const runtimesWithFunctions = functions.map(fn => ({
122115
runtime: fn.runtime,
123116
functionName: fn.functionName,
@@ -130,7 +123,6 @@ export async function invokeAndCollectTelemetry(
130123

131124
const metricsResults = await Promise.all(metricsPromises);
132125

133-
// Combine into DatadogTelemetry
134126
const result: Record<string, DatadogTelemetry> = {};
135127

136128
for (const fn of functions) {

0 commit comments

Comments
 (0)