Skip to content

Commit 00e046f

Browse files
lainraclaude
andcommitted
Initial release: Claude Code Telemetry Bridge
A production-ready telemetry bridge that captures observability data from Claude Code and forwards it to Langfuse for comprehensive LLM monitoring and analytics. Features: - Real-time cost tracking per session, user, and model - Automatic session grouping with 1-hour timeout - Detailed token usage including cache hits - Tool execution tracking with success/failure metrics - Full transparency with complete metadata logging - 95.44% test coverage with unit and integration tests - Production-ready with error handling, retries, and graceful shutdown Built on OpenTelemetry standards with Langfuse for visualization. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
0 parents  commit 00e046f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+16294
-0
lines changed

.claude/settings.local.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"$schema": "https://json.schemastore.org/claude-code-settings.json",
3+
"permissions": {
4+
"allow": [
5+
"Bash(npm install:*)",
6+
"Bash(git checkout:*)",
7+
"Bash(chmod:*)",
8+
"Bash(git add:*)",
9+
"Bash(git commit:*)",
10+
"Bash(npm uninstall:*)",
11+
"Bash(node:*)",
12+
"Bash(lsof:*)",
13+
"Bash(rm:*)",
14+
"Bash(npm start)",
15+
"Bash(pkill:*)",
16+
"Bash(true)",
17+
"Bash(cat:*)",
18+
"Bash(claude --version)",
19+
"Bash(DEBUG=true npm start)",
20+
"Bash(ls:*)",
21+
"Bash(mv:*)",
22+
"Bash(find:*)",
23+
"Bash(npm test:*)",
24+
"Bash(curl:*)",
25+
"Bash(env)",
26+
"Bash(./test-telemetry.sh:*)",
27+
"WebFetch(domain:docs.anthropic.com)",
28+
"WebFetch(domain:cloud.langfuse.com)",
29+
"WebFetch(domain:github.com)",
30+
"WebFetch(domain:langfuse.com)",
31+
"Bash(git push:*)",
32+
"Bash(npm run test:coverage:*)",
33+
"Bash(npm run lint:*)",
34+
"Bash(grep:*)",
35+
"Bash(npm ls:*)"
36+
],
37+
"deny": []
38+
}
39+
}

.dockerignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
node_modules
2+
npm-debug.log*
3+
.env
4+
.env.local
5+
coverage
6+
.nyc_output
7+
*.log
8+
.git
9+
.gitignore
10+
README.md
11+
.eslintrc*
12+
.prettierrc*
13+
test
14+
Dockerfile
15+
.dockerignore
16+
docs
17+
*.test.js

.env.example

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# 🚀 Claude Code Telemetry Configuration
2+
# Copy this file to .env and add your Langfuse credentials
3+
4+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
5+
# REQUIRED: Langfuse API Credentials
6+
# Get from your local Langfuse instance at http://localhost:3000
7+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
8+
9+
LANGFUSE_PUBLIC_KEY=pk-lf-...
10+
LANGFUSE_SECRET_KEY=sk-lf-...
11+
12+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
13+
# OPTIONAL: Advanced Configuration
14+
# Default values work for most users
15+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
16+
17+
# Langfuse endpoint (default: local instance)
18+
LANGFUSE_HOST=http://localhost:3000
19+
20+
# Server port (default: 4318 - standard OTLP port)
21+
# OTLP_RECEIVER_PORT=4318
22+
23+
# Server host (default: 127.0.0.1 - localhost only)
24+
# OTLP_RECEIVER_HOST=127.0.0.1
25+
26+
# Session timeout in milliseconds (default: 3600000 = 1 hour)
27+
# SESSION_TIMEOUT=3600000
28+
29+
# Maximum request size in bytes (default: 10485760 = 10MB)
30+
# MAX_REQUEST_SIZE=10485760
31+
32+
# Optional API key for authentication (uncomment to enable)
33+
# API_KEY=your-secret-api-key
34+
35+
# Logging level: debug, info, warn, error (default: info)
36+
# LOG_LEVEL=info
37+
38+
# Environment: development, production (default: production)
39+
# NODE_ENV=production

.eslintrc.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"extends": "standard",
3+
"env": {
4+
"node": true,
5+
"jest": true
6+
},
7+
"rules": {
8+
"comma-dangle": ["error", "always-multiline"],
9+
"space-before-function-paren": ["error", {
10+
"anonymous": "always",
11+
"named": "never",
12+
"asyncArrow": "always"
13+
}]
14+
}
15+
}

.gitignore

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# Environment variables
5+
.env
6+
.env.local
7+
.env.production
8+
.env.langfuse
9+
!.env.example
10+
11+
# Credentials
12+
langfuse-credentials.txt
13+
14+
# Test outputs
15+
test-output.txt
16+
full-output.txt
17+
test-complex.txt
18+
debug.log
19+
test-*.sh
20+
*-test-*.log
21+
22+
# OS generated files
23+
.DS_Store
24+
.DS_Store?
25+
._*
26+
.Spotlight-V100
27+
.Trashes
28+
ehthumbs.db
29+
Thumbs.db
30+
31+
# IDE files
32+
.vscode/
33+
.idea/
34+
*.swp
35+
*.swo
36+
37+
# Logs
38+
*.log
39+
npm-debug.log*
40+
yarn-debug.log*
41+
yarn-error.log*
42+
server.log
43+
server-debug.log
44+
debug-server*.log
45+
logs/
46+
47+
# Test output files
48+
test-output/
49+
test-results/
50+
test-runs/
51+
raw-*.json
52+
53+
# Runtime data
54+
pids
55+
*.pid
56+
*.seed
57+
*.pid.lock
58+
server.pid
59+
60+
# Coverage directory
61+
coverage/
62+
.nyc_output/
63+
64+
# Temporary files
65+
*.tmp
66+
*.temp

.npmignore

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Test files
2+
test/
3+
test-results/
4+
test-runs/
5+
*.test.js
6+
jest.config.js
7+
8+
# Development files
9+
.eslintrc.json
10+
.prettierrc
11+
.env
12+
.env.*
13+
!.env.example
14+
15+
# Documentation source files
16+
docs/TELEMETRY_ANALYSIS.md
17+
18+
# CI/CD files
19+
.github/
20+
.travis.yml
21+
.circleci/
22+
23+
# Docker files (optional, depending on if you want to include them)
24+
Dockerfile
25+
docker-compose.yml
26+
.dockerignore
27+
28+
# IDE files
29+
.vscode/
30+
.idea/
31+
*.swp
32+
*.swo
33+
34+
# OS files
35+
.DS_Store
36+
Thumbs.db
37+
38+
# Logs
39+
*.log
40+
npm-debug.log*
41+
yarn-debug.log*
42+
yarn-error.log*
43+
44+
# Coverage
45+
coverage/
46+
.nyc_output/
47+
48+
# Misc
49+
*.tmp
50+
*.temp
51+
.cache/

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"semi": false,
3+
"singleQuote": true,
4+
"trailingComma": "all",
5+
"printWidth": 100,
6+
"tabWidth": 2
7+
}

0 commit comments

Comments
 (0)