Skip to content

Commit 4360286

Browse files
github-actions[bot]DarcyRaynerDDhghotra
authored
Update Dependencies (#93)
* Update dependencies * Run latest prettier version for src dir Co-authored-by: DarcyRaynerDD <[email protected]> Co-authored-by: hghotra <[email protected]>
1 parent 69adaa9 commit 4360286

12 files changed

+1361
-1192
lines changed

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,25 @@
1515
"check-formatting": "prettier --check src/**"
1616
},
1717
"devDependencies": {
18-
"@types/aws-lambda": "^8.10.46",
18+
"@types/aws-lambda": "^8.10.61",
1919
"@types/aws-sdk": "^2.7.0",
20-
"@types/jest": "^25.1.4",
20+
"@types/jest": "^26.0.10",
2121
"@types/nock": "^11.1.0",
22-
"@types/node": "^13.9.1",
22+
"@types/node": "^14.6.0",
2323
"@types/promise-retry": "^1.1.3",
2424
"@types/shimmer": "^1.0.1",
25-
"dd-trace": "0.23.2",
26-
"jest": "^25.1.0",
27-
"nock": "12.0.2",
28-
"prettier": "^1.19.1",
29-
"ts-jest": "^25.2.1",
30-
"tslint": "^6.1.0",
31-
"typescript": "^3.8.3"
25+
"dd-trace": "0.24.1",
26+
"jest": "^26.4.1",
27+
"nock": "13.0.4",
28+
"prettier": "^2.0.5",
29+
"ts-jest": "^26.2.0",
30+
"tslint": "^6.1.3",
31+
"typescript": "^3.9.7"
3232
},
3333
"dependencies": {
34-
"aws-xray-sdk-core": "^3.0.0",
34+
"aws-xray-sdk-core": "^3.1.0",
3535
"bignumber.js": "^9.0.0",
36-
"promise-retry": "^1.1.1",
36+
"promise-retry": "^2.0.1",
3737
"serialize-error": "^7.0.1",
3838
"shimmer": "^1.2.1"
3939
},

src/index.spec.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ describe("datadog", () => {
5858
});
5959

6060
it("patches http request when autoPatch enabled", async () => {
61-
nock("http://www.example.com")
62-
.get("/")
63-
.reply(200, {});
61+
nock("http://www.example.com").get("/").reply(200, {});
6462
const wrapped = datadog(handler, { forceWrap: true });
6563
await wrapped(
6664
{
@@ -81,9 +79,7 @@ describe("datadog", () => {
8179
expect(sampled).toEqual("2");
8280
});
8381
it("doesn't patch http requests when autoPatch is disabled", async () => {
84-
nock("http://www.example.com")
85-
.get("/")
86-
.reply(200, {});
82+
nock("http://www.example.com").get("/").reply(200, {});
8783
const wrapped = datadog(handler, { autoPatchHTTP: false, forceWrap: true });
8884
await wrapped(
8985
{

src/metrics/api.spec.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,21 @@ describe("APIClient", () => {
1010
const input: APIMetric[] = [
1111
{
1212
metric: "a-metric",
13-
points: [[1, [2]], [3, [4]], [5, [6]]],
13+
points: [
14+
[1, [2]],
15+
[3, [4]],
16+
[5, [6]],
17+
],
1418
tags: ["a", "b", "c"],
1519
type: "distribution",
1620
},
1721
{
1822
metric: "b-metric",
19-
points: [[1, [2]], [3, [4]], [5, [6]]],
23+
points: [
24+
[1, [2]],
25+
[3, [4]],
26+
[5, [6]],
27+
],
2028
tags: ["a", "b", "c"],
2129
type: "distribution",
2230
},

src/metrics/batcher.spec.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ describe("Batcher", () => {
77
const timestamp = new Date(1559928315000);
88
const distribution1 = new Distribution(
99
"my-dist",
10-
[{ timestamp, value: 1 }, { timestamp, value: 2 }],
10+
[
11+
{ timestamp, value: 1 },
12+
{ timestamp, value: 2 },
13+
],
1114
"tag:a",
1215
"tag:b",
1316
"tag:c",
@@ -20,7 +23,11 @@ describe("Batcher", () => {
2023
expect(metrics).toEqual([
2124
{
2225
metric: "my-dist",
23-
points: [[1559928315, [1]], [1559928315, [2]], [1559928315, [3]]],
26+
points: [
27+
[1559928315, [1]],
28+
[1559928315, [2]],
29+
[1559928315, [3]],
30+
],
2431
tags: ["tag:a", "tag:b", "tag:c"],
2532
type: "distribution",
2633
},
@@ -32,7 +39,10 @@ describe("Batcher", () => {
3239
const timestamp = new Date(1559928315000);
3340
const distribution1 = new Distribution(
3441
"my-dist",
35-
[{ timestamp, value: 1 }, { timestamp, value: 2 }],
42+
[
43+
{ timestamp, value: 1 },
44+
{ timestamp, value: 2 },
45+
],
3646
"tag:a",
3747
"tag:b",
3848
"tag:c",
@@ -45,7 +55,10 @@ describe("Batcher", () => {
4555
expect(metrics).toEqual([
4656
{
4757
metric: "my-dist",
48-
points: [[1559928315, [1]], [1559928315, [2]]],
58+
points: [
59+
[1559928315, [1]],
60+
[1559928315, [2]],
61+
],
4962
tags: ["tag:a", "tag:b", "tag:c"],
5063
type: "distribution",
5164
},

src/metrics/listener.spec.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ describe("MetricsListener", () => {
2323
});
2424

2525
it("uses unencrypted api key by default", async () => {
26-
nock("https://api.example.com")
27-
.post("/api/v1/distribution_points?api_key=api-key")
28-
.reply(200, {});
26+
nock("https://api.example.com").post("/api/v1/distribution_points?api_key=api-key").reply(200, {});
2927

3028
const kms = new MockKMS("kms-api-key-decrypted");
3129
const listener = new MetricsListener(kms as any, {
@@ -44,9 +42,7 @@ describe("MetricsListener", () => {
4442
expect(nock.isDone()).toBeTruthy();
4543
});
4644
it("uses encrypted kms key if it's the only value available", async () => {
47-
nock("https://api.example.com")
48-
.post("/api/v1/distribution_points?api_key=kms-api-key-decrypted")
49-
.reply(200, {});
45+
nock("https://api.example.com").post("/api/v1/distribution_points?api_key=kms-api-key-decrypted").reply(200, {});
5046

5147
const kms = new MockKMS("kms-api-key-decrypted");
5248
const listener = new MetricsListener(kms as any, {

src/metrics/metric-log.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ describe("buildMetricLog", () => {
77
);
88
});
99
it("writes timestamp in Unix seconds", () => {
10-
expect(buildMetricLog("my.test.metric", 1337, new Date(1487076708123), ["region:us", "account:dev", "team:serverless"])).toStrictEqual(
10+
expect(
11+
buildMetricLog("my.test.metric", 1337, new Date(1487076708123), ["region:us", "account:dev", "team:serverless"]),
12+
).toStrictEqual(
1113
'{"e":1487076708.123,"m":"my.test.metric","t":["region:us","account:dev","team:serverless"],"v":1337}\n',
1214
);
1315
});

src/metrics/model.spec.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ describe("Distribution", () => {
66

77
const distribution = new Distribution(
88
"my-dist",
9-
[{ timestamp, value: 1 }, { timestamp, value: 2 }, { timestamp, value: 3 }],
9+
[
10+
{ timestamp, value: 1 },
11+
{ timestamp, value: 2 },
12+
{ timestamp, value: 3 },
13+
],
1014
"tag:a",
1115
"tag:b",
1216
"tag:c",
@@ -16,7 +20,11 @@ describe("Distribution", () => {
1620
expect(result).toEqual([
1721
{
1822
metric: "my-dist",
19-
points: [[1559928315, [1]], [1559928315, [2]], [1559928315, [3]]],
23+
points: [
24+
[1559928315, [1]],
25+
[1559928315, [2]],
26+
[1559928315, [3]],
27+
],
2028
tags: ["tag:a", "tag:b", "tag:c"],
2129
type: "distribution",
2230
},
@@ -27,14 +35,21 @@ describe("Distribution", () => {
2735

2836
const distribution1 = new Distribution(
2937
"my-dist",
30-
[{ timestamp, value: 1 }, { timestamp, value: 2 }],
38+
[
39+
{ timestamp, value: 1 },
40+
{ timestamp, value: 2 },
41+
],
3142
"tag:a",
3243
"tag:b",
3344
"tag:c",
3445
);
3546
const distribution2 = new Distribution("my-dist", [{ timestamp, value: 3 }], "tag:a", "tag:b", "tag:c");
3647
const distribution3 = distribution1.union(distribution2);
3748

38-
expect(distribution3.points).toEqual([{ timestamp, value: 1 }, { timestamp, value: 2 }, { timestamp, value: 3 }]);
49+
expect(distribution3.points).toEqual([
50+
{ timestamp, value: 1 },
51+
{ timestamp, value: 2 },
52+
{ timestamp, value: 3 },
53+
]);
3954
});
4055
});

src/metrics/processor.spec.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ describe("Processor", () => {
5353
[
5454
{
5555
metric: "my-metric",
56-
points: [[1559941498, [1]], [1559941498, [2]]],
56+
points: [
57+
[1559941498, [1]],
58+
[1559941498, [2]],
59+
],
5760
tags: ["tag:a", "tag:b"],
5861
type: "distribution",
5962
},
@@ -83,7 +86,10 @@ describe("Processor", () => {
8386
[
8487
{
8588
metric: "my-metric",
86-
points: [[1559941498, [1]], [1559941498, [2]]],
89+
points: [
90+
[1559941498, [1]],
91+
[1559941498, [2]],
92+
],
8793
tags: ["tag:a", "tag:b"],
8894
type: "distribution",
8995
},
@@ -104,7 +110,10 @@ describe("Processor", () => {
104110
[
105111
{
106112
metric: "my-metric",
107-
points: [[1559941498, [1]], [1559941498, [2]]],
113+
points: [
114+
[1559941498, [1]],
115+
[1559941498, [2]],
116+
],
108117
tags: ["tag:a", "tag:b"],
109118
type: "distribution",
110119
},
@@ -133,7 +142,11 @@ describe("Processor", () => {
133142
[
134143
{
135144
metric: "my-metric",
136-
points: [[1559941498, [1]], [1559941498, [2]], [1559941498, [3]]],
145+
points: [
146+
[1559941498, [1]],
147+
[1559941498, [2]],
148+
[1559941498, [3]],
149+
],
137150
tags: ["tag:a", "tag:b"],
138151
type: "distribution",
139152
},

src/trace/listener.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ describe("TraceListener", () => {
150150
function_arn: "arn:aws:lambda:us-east-1:123456789101:function:my-lambda",
151151
function_version: "$LATEST",
152152
request_id: "1234",
153-
resource_names: "my-lambda"
153+
resource_names: "my-lambda",
154154
},
155155
type: "serverless",
156156
},

src/trace/patch-http.spec.ts

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ import { patchHttp, unpatchHttp } from "./patch-http";
99
import { TraceContextService } from "./trace-context-service";
1010

1111
describe("patchHttp", () => {
12-
1312
let traceWrapper = {
1413
isTracerAvailable: false,
1514
extract: () => null,
1615
wrap: (fn: any) => fn,
17-
traceContext: () => undefined
16+
traceContext: () => undefined,
1817
};
1918

2019
let contextService: TraceContextService;
@@ -42,43 +41,33 @@ describe("patchHttp", () => {
4241
});
4342

4443
it("injects tracing headers into requests", () => {
45-
nock("http://www.example.com")
46-
.get("/")
47-
.reply(200, {});
44+
nock("http://www.example.com").get("/").reply(200, {});
4845

4946
patchHttp(contextService);
5047
const req = http.request("http://www.example.com");
5148
expectHeaders(req);
5249
});
5350
it("injects tracing headers into get requests", () => {
54-
nock("http://www.example.com")
55-
.get("/")
56-
.reply(200, {});
51+
nock("http://www.example.com").get("/").reply(200, {});
5752
patchHttp(contextService);
5853
const req = http.get("http://www.example.com");
5954
expectHeaders(req);
6055
});
6156
it("injects tracing headers into https requests", () => {
62-
nock("https://www.example.com")
63-
.get("/")
64-
.reply(200, {});
57+
nock("https://www.example.com").get("/").reply(200, {});
6558
patchHttp(contextService);
6659
const req = https.request("https://www.example.com");
6760
expectHeaders(req);
6861
});
6962
it("injects tracing headers into https get requests", () => {
70-
nock("https://www.example.com")
71-
.get("/")
72-
.reply(200, {});
63+
nock("https://www.example.com").get("/").reply(200, {});
7364
patchHttp(contextService);
7465
const req = https.get("https://www.example.com");
7566
expectHeaders(req);
7667
});
7768

7869
it("injects tracing headers when using request options", () => {
79-
nock("http://www.example.com")
80-
.get("/")
81-
.reply(200, {});
70+
nock("http://www.example.com").get("/").reply(200, {});
8271
patchHttp(contextService);
8372
const opt: RequestOptions = {
8473
headers: { "some-header": "some-value" },
@@ -91,9 +80,7 @@ describe("patchHttp", () => {
9180
expect(headers["some-header"]).toEqual("some-value");
9281
});
9382
it("injects tracing headers when using request options and path", () => {
94-
nock("http://www.example.com")
95-
.get("/")
96-
.reply(200, {});
83+
nock("http://www.example.com").get("/").reply(200, {});
9784
patchHttp(contextService);
9885
const opt: RequestOptions = {
9986
headers: { "some-header": "some-value" },
@@ -104,18 +91,14 @@ describe("patchHttp", () => {
10491
expect(headers["some-header"]).toEqual("some-value");
10592
});
10693
it("injects tracing headers when using URL", () => {
107-
nock("http://www.example.com")
108-
.get("/")
109-
.reply(200, {});
94+
nock("http://www.example.com").get("/").reply(200, {});
11095
patchHttp(contextService);
11196
const url = parse("http://www.example.com");
11297
const req = http.request(url);
11398
expectHeaders(req);
11499
});
115100
it("passes callback through to request", (done) => {
116-
nock("http://www.example.com")
117-
.get("/")
118-
.reply(200, {});
101+
nock("http://www.example.com").get("/").reply(200, {});
119102
patchHttp(contextService);
120103
const req = http.request("http://www.example.com", () => {
121104
done();
@@ -124,9 +107,7 @@ describe("patchHttp", () => {
124107
expectHeaders(req);
125108
});
126109
it("passes callback through to request with request options", (done) => {
127-
nock("http://www.example.com")
128-
.get("/")
129-
.reply(200, {});
110+
nock("http://www.example.com").get("/").reply(200, {});
130111
patchHttp(contextService);
131112
const options = {
132113
headers: { "some-header": "a-value" },
@@ -140,9 +121,7 @@ describe("patchHttp", () => {
140121
expect(headers["some-header"]).toEqual("a-value");
141122
});
142123
it("doesn't inject tracing headers when context is empty", () => {
143-
nock("http://www.example.com")
144-
.get("/")
145-
.reply(200, {});
124+
nock("http://www.example.com").get("/").reply(200, {});
146125

147126
contextService.rootTraceContext = undefined;
148127
patchHttp(contextService);

0 commit comments

Comments
 (0)