refactor: adopt OTel semconv v1.40.0 for datastore and external spans#23
refactor: adopt OTel semconv v1.40.0 for datastore and external spans#23
Conversation
Datastore spans (NewDatastoreSpan, SetQuery): - store → db.system.name - collection → db.collection.name - operation → db.operation.name - query → db.query.text External spans (buildExternalSpan): - url → url.full - added server.address attribute
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 17 minutes and 27 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 WalkthroughWalkthroughThis PR updates tracing attribute handling to use OpenTelemetry semantic convention helpers in Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Refactors span attribute emission to align datastore and external HTTP spans with OpenTelemetry semantic conventions (semconv) v1.40.0, and updates generated docs accordingly.
Changes:
- Switch datastore span attributes to
db.system.name,db.collection.name,db.operation.name,db.query.text. - Switch external span attributes to
url.fullandserver.address. - Regenerate
README.mdto reflect updated line references.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tracing.go | Replaces custom span attribute keys with OTel semconv v1.40.0 attributes for datastore and external spans. |
| README.md | Updates generated gomarkdoc links/line numbers after code changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tracing.go`:
- Around line 177-181: Replace the invalid semconv usage inside
otelSpan.SetAttributes: change semconv.DBSystemNameKey.String(datastore) to the
function form semconv.DBSystem(datastore) so all DB attributes use the
consistent function patterns; keep or ensure
semconv.DBCollectionName(collection) and semconv.DBOperationName(operation) are
used together in otelSpan.SetAttributes to match semconv v1.40.0 API.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
…from URL - SetQuery: only set db.query.text for datastore spans; use generic "query" attribute for non-datastore spans to avoid semantic mismatch - buildExternalSpan: parse server.address from URL hostname when an absolute URL is provided, instead of always using the name parameter
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
db.system.name,db.collection.name,db.operation.name,db.query.textper DB semconv specurl.fullandserver.addressper HTTP client semconv spec; parse hostname from absolute URLs for accurateserver.addressdb.query.textbehind datastore span check — non-datastore spans use genericqueryattribute to avoid semantic mismatchTest plan
make testpasses with-racemake buildcompiles cleanly