Skip to content

Commit 109a081

Browse files
authored
feat(tracing): integrate OpenTelemetry for request tracing (#237)
* feat(tracing): integrate OpenTelemetry for request tracing with middleware to handle tracing of HTTP requests * chore(workflow): simplify deno formatting workflow by removing auto-format and PR creation steps * fix(docker): remove commented fallback entrypoint and ensure proper `deno compile` command * fix(release-drafter): add 'feat' branch pattern to feature label for autolabeling
1 parent 0a645b4 commit 109a081

File tree

13 files changed

+1322
-60
lines changed

13 files changed

+1322
-60
lines changed

.env.defaults

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ SPOTIFY_SECRET="SPOTIFY_SECRET"
3737
PORT=9800
3838

3939
OTEL_DENO=true
40-
OTEL_SERVICE_NAME="on-the-edge"
41-
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=""
42-
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=""
43-
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=""
40+
OTEL_DENO_SERVICE_NAME="on-the-edge"
41+
OTEL_EXPORTER_OTLP_ENDPOINT="http://otel-collector:4318"
42+
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT="http://otel-collector:4318/v1/metrics"
43+
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="http://otel-collector:4318/v1/traces"
44+
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT="http://otel-collector:4318/v1/logs"
45+
46+
DENO_ENV=development

.github/release-drafter-config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ autolabeler:
3737
- label: ':star2: feature'
3838
branch:
3939
- '/feature\/.+/'
40+
- '/feat\/.+/'
4041
- label: ':wrench: enhancement'
4142
branch:
4243
- '/enhancement\/.+/'

.github/workflows/deno-format.yml

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,16 @@ permissions:
99

1010
jobs:
1111
format:
12-
permissions:
13-
contents: write
14-
pull-requests: write
1512
runs-on: ubuntu-latest
1613
steps:
17-
- uses: actions/create-github-app-token@v2
18-
id: app-token
19-
with:
20-
app-id: ${{ secrets.APP_ID }}
21-
private-key: ${{ secrets.APP_PRIVATE_KEY }}
2214
- name: Checkout code
2315
uses: actions/checkout@v4
24-
with:
25-
token: ${{ steps.app-token.outputs.token }}
26-
# Make sure the value of GITHUB_TOKEN will not be persisted in repo's config
27-
persist-credentials: false
2816

2917
- name: setup deno
3018
uses: denoland/setup-deno@v2
3119
with:
3220
cache: true
3321

34-
- name: auto-format code
35-
run: deno fmt
36-
37-
- name: check for file changes
38-
id: git_status
39-
run: |
40-
echo "::set-output name=status::$(git status -s)"
22+
- name: check code format
23+
run: deno fmt --check
4124

42-
- name: create pull request with formatting corrections
43-
if: ${{contains(steps.git_status.outputs.status, ' ')}}
44-
uses: stefanzweifel/git-auto-commit-action@v6
45-
with:
46-
commit_message: "chore(automation): auto format code using deno fmt"
47-
commit_options: '--no-verify --signoff'
48-
file_pattern: '*.ts'
49-
repository: .

Dockerfile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,9 @@ RUN apt-get install unzip
1010
FROM scaffold AS cache
1111
RUN deno cache src/server.ts
1212

13-
# Fallback and compilation has broken in some instances
14-
#ENTRYPOINT ["deno", "run", "--allow-net", "--allow-env", "--allow-read", "--allow-sys", "src/server.ts"]
15-
1613
FROM cache AS build
1714
RUN deno check src/server.ts
18-
RUN deno compile --unstable-otel --allow-net --allow-env --allow-read --allow-sys --output=/usr/on-the-edge src/server.ts
15+
RUN deno compile --unstable-otel --allow-net --allow-env --allow-read --allow-sys --allow-run --output=/usr/on-the-edge src/server.ts
1916

2017
FROM build AS final
2118
RUN rm -r /usr/app

deno.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"tasks": {
2121
"check": "deno check src/server.ts",
2222
"test": "deno test --allow-read --allow-env --allow-net",
23-
"start": "deno run --unstable-otel --allow-read --allow-env --allow-net --allow-sys ./src/server.ts",
23+
"start": "deno run --unstable-otel --allow-read --allow-env --allow-net --allow-sys --allow-run ./src/server.ts",
2424
"check-deps": "deno run -A jsr:@check/deps"
25-
}
25+
},
26+
"nodeModulesDir": "auto"
2627
}

0 commit comments

Comments
 (0)