Skip to content

Commit

Permalink
refactor(handler): at opentelemtry instrumentation (#125)
Browse files Browse the repository at this point in the history
# Goals

Gain insight into what's going on with freeway

# Implementation

When in doubt, instrument. This adds opentelemtry and a default
cloudflare open telemetry implementation, that at minimum tells you how
long fetch requests are taking. And it's.... very interesting...

![Screenshot 2024-11-01 at 1 35
23 AM](https://github.com/user-attachments/assets/98b558c7-d37b-4513-9ec3-3b24eee8b584)

This is a trace of about a 64mb file downloading. 

I dunno what to make of all it, except to say... ouch those CARPARK
downloads take a WHILE. I wonder if somehow accessing them through
public URLs is a lot slower?
  • Loading branch information
hannahhoward authored Nov 1, 2024
1 parent 90bb605 commit 894adfe
Show file tree
Hide file tree
Showing 5 changed files with 372 additions and 4 deletions.
338 changes: 338 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"prepare": "npm run build",
"start": "npm run dev",
"dev": "npm run build:debug && miniflare dist/worker.mjs --watch --debug -m --r2-persist --global-async-io --global-timers",
"build": "esbuild --bundle src/index.js --format=esm --sourcemap --minify --outfile=dist/worker.mjs && npm run build:tsc",
"build:debug": "esbuild --bundle src/index.js --format=esm --outfile=dist/worker.mjs",
"build": "esbuild --bundle src/index.js --format=esm --external:node:buffer --external:node:events --external:node:async_hooks --sourcemap --minify --outfile=dist/worker.mjs && npm run build:tsc",
"build:debug": "esbuild --bundle src/index.js --format=esm --external:node:buffer --external:node:events --external:node:async_hooks --outfile=dist/worker.mjs",
"build:tsc": "tsc --build",
"test:miniflare": "npm run build:debug && mocha --experimental-vm-modules --recursive test/miniflare/**/*.spec.js",
"test:unit": "npm run build:debug && mocha --experimental-vm-modules --recursive test/unit/**/*.spec.js",
Expand All @@ -35,6 +35,9 @@
"author": "Alan Shaw",
"license": "Apache-2.0 OR MIT",
"dependencies": {
"@microlabs/otel-cf-workers": "^1.0.0-rc.48",
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/sdk-trace-base": "^1.27.0",
"@web3-storage/blob-fetcher": "^2.3.1",
"@web3-storage/gateway-lib": "^5.1.2",
"dagula": "^8.0.0",
Expand Down
1 change: 1 addition & 0 deletions src/bindings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface Environment
VERSION: string
CONTENT_CLAIMS_SERVICE_URL?: string
ACCOUNTING_SERVICE_URL: string
HONEYCOMB_API_KEY: string
}

export interface AccountingService {
Expand Down
Loading

0 comments on commit 894adfe

Please sign in to comment.