Skip to content

Commit c5efdb5

Browse files
committed
feat: Remove extension hello check as it's redundant
1 parent cb2656d commit c5efdb5

File tree

3 files changed

+0
-20
lines changed

3 files changed

+0
-20
lines changed

src/metrics/extension.spec.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,9 @@ describe("isAgentRunning", () => {
1111
mock({
1212
"/opt/extensions/datadog-agent": Buffer.from([0]),
1313
});
14-
const scope = nock(AGENT_URL).get("/lambda/hello").reply(200);
1514
const ran = await isAgentRunning();
16-
expect(scope.isDone()).toBeTruthy();
1715
expect(ran).toBeTruthy();
1816
});
19-
it("returns false when agent doesn't respond", async () => {
20-
mock({
21-
"/opt/extensions/datadog-agent": Buffer.from([0]),
22-
});
23-
const scope = nock(AGENT_URL).get("/lambda/hello").replyWithError("Unreachable");
24-
const ran = await isAgentRunning();
25-
expect(scope.isDone()).toBeTruthy();
26-
expect(ran).toBeFalsy();
27-
});
2817
it("returns false when agent doesn't exist", async () => {
2918
mock({});
3019
const scope = nock(AGENT_URL).get("/lambda/hello").replyWithError("Unreachable");

src/metrics/extension.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@ export async function isAgentRunning() {
1414
logDebug(`Agent isn't present in sandbox`);
1515
return false;
1616
}
17-
18-
const url = new URL(HELLO_PATH, AGENT_URL);
19-
const result = await get(url, { timeout: AGENT_TIMEOUT_MS });
20-
if (!result.success) {
21-
logDebug(`Could not connect to agent. ${result.errorMessage}`);
22-
return false;
23-
}
2417
return true;
2518
}
2619

src/metrics/listener.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ describe("MetricsListener", () => {
105105
expect(spy).toHaveBeenCalledWith(`{"e":1487076708,"m":"my-metric","t":["tag:a","tag:b"],"v":10}\n`);
106106
});
107107
it("always sends metrics to statsD when extension is enabled, ignoring logForwarding=true", async () => {
108-
const helloScope = nock(AGENT_URL).get("/lambda/hello").reply(200);
109108
const flushScope = nock(AGENT_URL).post("/lambda/flush", JSON.stringify({})).reply(200);
110109
mock({
111110
"/opt/extensions/datadog-agent": Buffer.from([0]),
@@ -135,7 +134,6 @@ describe("MetricsListener", () => {
135134
await listener.onStartInvocation({});
136135
listener.sendDistributionMetric("my-metric", 10, false, "tag:a", "tag:b");
137136
await listener.onCompleteInvocation();
138-
expect(helloScope.isDone()).toBeTruthy();
139137
expect(flushScope.isDone()).toBeTruthy();
140138
expect(distributionMock).toHaveBeenCalledWith("my-metric", 10, undefined, ["tag:a", "tag:b"]);
141139
});

0 commit comments

Comments
 (0)