Skip to content

Commit 92e7913

Browse files
fixed wording
1 parent 9157312 commit 92e7913

File tree

3 files changed

+25
-45
lines changed

3 files changed

+25
-45
lines changed

apps/items-service/src/html.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function getRootPageHtml(): string {
4444
<article class="profile-content">
4545
<h1>Items Service</h1>
4646
47-
<p>A simple REST API service for managing items, built with Bun and PostgreSQL.</p>
47+
<p>A simple REST API service for managing items, built with Bun and PostgreSQL, Jaeger and OpenTelemetry.</p>
4848
4949
<p><a href="/items/docs" target="_blank">Swagger Docs</a></p>
5050

apps/items-service/src/index.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
// src/index.ts
1+
/**
2+
*
3+
* Environment Variables:
4+
* - PORT - Server port (default: 8080)
5+
* - DB_HOST, DB_PORT, DB_USER - Database connection
6+
* - DB_PASSWORD, DB_NAME
7+
* - OTEL_ENABLED - Enable tracing (default: true)
8+
* - OTEL_EXPORTER_OTLP_ENDPOINT - OTLP endpoint (default: http://localhost:4318)
9+
* - OTEL_SERVICE_NAME - Service name (default: items-service)
10+
* - OTEL_LOG_LEVEL - Log level (default: info)
11+
*/
12+
213
// Initialize OpenTelemetry first, before any other imports
314
import { initTelemetry } from "./telemetry";
415
initTelemetry();

docs/OPENTELEMETRY_GUIDE.md

Lines changed: 12 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -109,71 +109,40 @@ curl -X POST http://localhost:8081/v1/items \
109109
- Cascading failures
110110
- Slow database queries (> 1s)
111111

112-
## 🔧 Troubleshooting
112+
## Troubleshooting
113113

114-
### No Traces Appearing
114+
**No Traces Appearing:**
115115

116-
1. **Check if OpenTelemetry is enabled:**
116+
1. Check OpenTelemetry is enabled:
117117
```bash
118118
kubectl get deployment items-service -o yaml | grep OTEL_ENABLED
119119
```
120-
Should show `value: "true"`
121120

122-
2. **Check items-service logs:**
123-
Look for "📊 OpenTelemetry initialized" message
121+
2. Check items-service logs for "OpenTelemetry initialized"
124122

125-
3. **Check Jaeger is running:**
123+
3. Verify Jaeger is running:
126124
```bash
127125
kubectl get pods | grep jaeger
128126
```
129127

130-
4. **Check connectivity:**
128+
4. Test connectivity:
131129
```bash
132130
kubectl exec -it <items-service-pod> -- curl http://jaeger:4318
133131
```
134132

135-
### Traces Missing Information
133+
**Missing Information:**
136134

137-
1. **Check OTEL_LOG_LEVEL:**
138-
Set to "debug" to see detailed logs:
139-
```yaml
140-
- name: OTEL_LOG_LEVEL
141-
value: "debug"
142-
```
143-
144-
2. **Check auto-instrumentation:**
145-
Some libraries may not be auto-instrumented
146-
May need manual instrumentation
135+
Set `OTEL_LOG_LEVEL=debug` for detailed logs
147136

148-
### Performance Impact
137+
**Performance Impact:**
149138

150-
OpenTelemetry has minimal overhead:
151-
- ~1-5ms per request
152-
- Sampling can reduce overhead further
153-
- Can be disabled in production if needed
139+
- ~1-5ms overhead per request
140+
- Minimal impact on production
154141

155-
## 📚 Additional Resources
142+
## Resources
156143

157144
- [OpenTelemetry Documentation](https://opentelemetry.io/docs/)
158145
- [Jaeger Documentation](https://www.jaegertracing.io/docs/)
159146
- [OpenTelemetry JavaScript SDK](https://opentelemetry.io/docs/instrumentation/js/)
160-
- [Distributed Tracing Best Practices](https://opentelemetry.io/docs/concepts/observability-primer/)
161-
162-
## 🎯 Next Steps
163-
164-
1. **Run the test script** to validate your setup:
165-
```bash
166-
./scripts/test-otel.sh
167-
```
168-
169-
2. **Explore Jaeger UI** at http://localhost:16686
170-
171-
3. **Make some requests** and watch the traces appear
172-
173-
4. **Try the use cases** above to get familiar with the UI
174-
175-
5. **Consider adding custom spans** for important business operations
176-
177-
6. **Set up alerts** based on trace data (requires additional setup)
178147

179148

0 commit comments

Comments
 (0)