Skip to content

Commit aee67bc

Browse files
authored
fix+feat: otel logger trace linking issue (pino) + support gRPC protocol (#193)
For loggers like Pino, the span context is attached to LogAttributes instead of the logger’s context. This PR adds a loadContext method to load the context from the attributes and set it to logRecord.context Ref: HDX-2584, HDX-2595
1 parent 2833fae commit aee67bc

37 files changed

+601
-1107
lines changed

.changeset/shiny-mails-exercise.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@hyperdx/node-opentelemetry': patch
3+
---
4+
5+
feat: support gRPC protocol

.changeset/stupid-pugs-type.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@hyperdx/node-opentelemetry': patch
3+
---
4+
5+
fix: pino trace linking issue

.dockerignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
node_modules
2+
dist
3+
.nx
4+
.git
5+
.github
6+
*.md
7+
.vscode
8+
.idea
9+
*.log
10+
coverage
11+
.eslintcache
12+
smoke-tests/collector/data.json
13+
smoke-tests/collector/data-results
14+
smoke-tests/report.*

.github/workflows/smoke.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ jobs:
1515
- name: Setup BATS
1616
uses: mig4/setup-bats@v1
1717
with:
18-
bats-version: 1.10.0
18+
bats-version: 1.12.0
1919
- name: Check out repository
2020
uses: actions/checkout@v4
21+
- name: Build smoke test images
22+
run: make build-smoke-images
2123
- name: Run smoke tests
2224
run: make smoke-sdk

Makefile

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,51 +6,46 @@ clean-smoke-tests:
66

77
#: cleans up TS build, smoke test output, and example app detritus
88
squeaky-clean: clean clean-smoke-tests
9-
rm -rf ./examples/dist
10-
rm -rf ./examples/node_modules
11-
rm -rf ./examples/hello-node/dist
12-
rm -rf ./examples/hello-node/node_modules
13-
rm -rf ./examples/hello-node-express/dist
14-
rm -rf ./examples/hello-node-express/node_modules
15-
rm -rf ./examples/hello-node-express-ts/dist
16-
rm -rf ./examples/hello-node-express-ts/node_modules
9+
rm -rf ./smoke-tests/hello-node-express-ts/dist
10+
rm -rf ./smoke-tests/hello-node-express-ts/node_modules
1711

1812
smoke-tests/collector/data.json:
1913
@echo ""
2014
@echo "+++ Zhuzhing smoke test's Collector data.json"
2115
@touch $@ && chmod o+w $@
2216

23-
smoke-sdk-grpc: smoke-tests/collector/data.json
17+
#: build Docker images for smoke tests (with caching)
18+
build-smoke-images:
2419
@echo ""
25-
@echo "+++ Running gRPC smoke tests."
20+
@echo "+++ Building smoke test Docker images (cached)"
2621
@echo ""
27-
cd smoke-tests && bats ./smoke-sdk-grpc.bats --report-formatter junit --output ./
22+
cd smoke-tests && docker compose build
2823

29-
smoke-sdk-grpc-ts: smoke-tests/collector/data.json
24+
smoke-sdk-grpc-ts: build-smoke-images smoke-tests/collector/data.json
3025
@echo ""
3126
@echo "+++ Running gRPC smoke tests for TypeScript."
3227
@echo ""
33-
cd smoke-tests && bats ./smoke-sdk-grpc-ts.bats --report-formatter junit --output ./
28+
cd smoke-tests && bats ./smoke-sdk-grpc-ts.bats --report-formatter junit --output ./ --verbose-run
3429

35-
smoke-sdk-http: smoke-tests/collector/data.json
30+
smoke-sdk-http-ts: build-smoke-images smoke-tests/collector/data.json
3631
@echo ""
37-
@echo "+++ Running HTTP smoke tests."
32+
@echo "+++ Running HTTP smoke tests for TypeScript."
3833
@echo ""
39-
cd smoke-tests && bats ./smoke-sdk-http.bats --report-formatter junit --output ./
34+
cd smoke-tests && bats ./smoke-sdk-http-ts.bats --report-formatter junit --output ./ --verbose-run
4035

41-
smoke-sdk-http-ts: smoke-tests/collector/data.json
36+
smoke-sdk-http-ts-programmaticImports: build-smoke-images smoke-tests/collector/data.json
4237
@echo ""
43-
@echo "+++ Running HTTP smoke tests for TypeScript."
38+
@echo "+++ Running HTTP programmatic imports smoke tests for TypeScript."
4439
@echo ""
45-
cd smoke-tests && bats ./smoke-sdk-http-ts.bats --report-formatter junit --output ./
40+
cd smoke-tests && bats ./smoke-sdk-http-ts-programmaticImports.bats --report-formatter junit --output ./ --verbose-run
4641

47-
smoke-sdk: smoke-sdk-http smoke-sdk-http-ts
42+
smoke-sdk: smoke-sdk-http-ts smoke-sdk-grpc-ts
4843

4944
smoke: docker_compose_present
5045
@echo ""
5146
@echo "+++ Smoking all the tests."
5247
@echo ""
53-
cd smoke-tests && bats . --report-formatter junit --output ./
48+
cd smoke-tests && bats . --report-formatter junit --output ./ --verbose-run
5449

5550
unsmoke: docker_compose_present
5651
@echo ""
@@ -61,7 +56,7 @@ unsmoke: docker_compose_present
6156
#: use this for local smoke testing
6257
resmoke: unsmoke smoke
6358

64-
.PHONY: clean-smoke-tests example smoke unsmoke resmoke smoke-sdk-grpc smoke-sdk-http smoke-sdk
59+
.PHONY: clean-smoke-tests build-smoke-images example smoke unsmoke resmoke smoke-sdk-grpc-ts smoke-sdk-http-ts smoke-sdk-http-ts-programmaticImports smoke-sdk
6560

6661
.PHONY: docker_compose_present
6762
docker_compose_present:

examples/hello-node-express-ts/instrumentation.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

examples/hello-node-express/Dockerfile

Lines changed: 0 additions & 19 deletions
This file was deleted.

examples/hello-node-express/README.md

Lines changed: 0 additions & 32 deletions
This file was deleted.

examples/hello-node-express/index.js

Lines changed: 0 additions & 52 deletions
This file was deleted.

examples/hello-node-express/package.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)