Skip to content

Commit 6c40df6

Browse files
committed
feat: remove OT dependencies
1 parent cfdfbf5 commit 6c40df6

File tree

6 files changed

+2399
-1934
lines changed

6 files changed

+2399
-1934
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- name: Setup node
1111
uses: actions/setup-node@v4
1212
with:
13-
node-version: 20
13+
node-version: 24
1414
cache: yarn
1515
- run: yarn
1616
- run: yarn lint

.github/workflows/push.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Setup node
2323
uses: actions/setup-node@v4
2424
with:
25-
node-version: 20
25+
node-version: 24
2626
cache: yarn
2727

2828
- name: Install dependencies
@@ -37,6 +37,5 @@ jobs:
3737
- name: Release
3838
env:
3939
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
40-
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
4140
NPM_CONFIG_PROVENANCE: true
4241
run: yarn release

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- name: Setup node
1212
uses: actions/setup-node@v4
1313
with:
14-
node-version: 20
14+
node-version: 24
1515
cache: yarn
1616
- run: yarn
1717
- run: yarn test

package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,13 @@
2525
},
2626
"homepage": "https://github.com/includable/serverless-middleware#readme",
2727
"devDependencies": {
28-
"@types/jest": "^29.5.12",
29-
"jest": "^29.7.0",
30-
"lambda-sample-events": "^1.0.1",
31-
"prettier": "^3.2.5",
32-
"semantic-release": "^23.0.8"
28+
"@types/jest": "^30.0.0",
29+
"jest": "^30.3.0",
30+
"lambda-sample-events": "^1.1.0",
31+
"prettier": "^3.8.1",
32+
"semantic-release": "^25.0.3"
3333
},
3434
"dependencies": {
35-
"@opentelemetry/api": "^1.9.0",
36-
"@opentelemetry/semantic-conventions": "^1.28.0"
35+
"@opentelemetry/api": "^1.9.0"
3736
}
3837
}

src/lib/OpenTelemetry.js

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
11
const { trace } = require("@opentelemetry/api");
2-
const {
3-
ATTR_HTTP_ROUTE,
4-
ATTR_URL_FULL,
5-
ATTR_USER_AGENT_ORIGINAL,
6-
ATTR_HTTP_REQUEST_METHOD,
7-
ATTR_NETWORK_PROTOCOL_NAME,
8-
ATTR_NETWORK_PROTOCOL_VERSION,
9-
} = require("@opentelemetry/semantic-conventions");
10-
const {
11-
ATTR_HTTP_USER_AGENT,
12-
ATTR_HTTP_FLAVOR,
13-
ATTR_FAAS_TRIGGER,
14-
FAAS_TRIGGER_VALUE_HTTP,
15-
} = require("@opentelemetry/semantic-conventions/incubating");
162

173
const isApiGwEvent = (event) => {
184
return (
@@ -87,20 +73,20 @@ class OpenTelemetry {
8773

8874
if (isApiGwEvent(event)) {
8975
const fullUrl = getFullUrl(event);
90-
span.setAttribute(ATTR_FAAS_TRIGGER, FAAS_TRIGGER_VALUE_HTTP);
91-
span.setAttribute(ATTR_HTTP_ROUTE, event.routeKey?.split(" ")[1]);
92-
fullUrl && span.setAttribute(ATTR_URL_FULL, fullUrl);
76+
span.setAttribute("faas.trigger", "http");
77+
span.setAttribute("http.route", event.routeKey?.split(" ")[1]);
78+
fullUrl && span.setAttribute("url.full", fullUrl);
9379
span.setAttribute(
94-
ATTR_HTTP_REQUEST_METHOD,
80+
"http.request.method",
9581
event.requestContext?.http?.method,
9682
);
9783
span.setAttribute(
98-
ATTR_USER_AGENT_ORIGINAL,
84+
"http.user_agent.original",
9985
event.requestContext?.http?.userAgent,
10086
);
101-
span.setAttribute(ATTR_NETWORK_PROTOCOL_NAME, "http");
87+
span.setAttribute("network.protocol.name", "http");
10288
span.setAttribute(
103-
ATTR_NETWORK_PROTOCOL_VERSION,
89+
"network.protocol.version",
10490
event.requestContext?.http?.protocol?.split("/")?.[1],
10591
);
10692
span.setAttribute("http.request.id", event.requestContext?.requestId);

0 commit comments

Comments
 (0)