Skip to content

fix(tracing-openobserve): use correct parent_span_id field name#78

Open
yehia2amer wants to merge 1 commit into
openchoreo:mainfrom
yehia2amer:fix/parent-span-id-field-name
Open

fix(tracing-openobserve): use correct parent_span_id field name#78
yehia2amer wants to merge 1 commit into
openchoreo:mainfrom
yehia2amer:fix/parent-span-id-field-name

Conversation

@yehia2amer
Copy link
Copy Markdown

@yehia2amer yehia2amer commented Apr 19, 2026

Summary

  • Replace reference_parent_span_id with parent_span_id in SQL queries and hit parsing
  • OpenObserve OTLP ingestion stores parent span ID as parent_span_id, not reference_parent_span_id
  • Fixes Search field not found: reference_parent_span_id errors when querying traces

Changes

  • queries.go: 2 SQL query updates (generateTracesListQuery, generateSpansListQuery)
  • client.go: 3 hit-parsing updates + removed from internalFields
  • client_test.go: Updated test fixtures
  • handlers_test.go: Updated test fixtures

Testing

  • go test ./... passes
  • Verified against live OpenObserve instance with OTLP trace data on GKE
  • Built and deployed custom image (ghcr.io/yehia2amer/observability-tracing-openobserve-adapter:fix-parent-span) — tracing adapter logs clean after fix

Summary by CodeRabbit

  • Bug Fixes

    • Updated span parent relationship tracking to correctly identify root and child spans in trace queries and span details.
  • Tests

    • Updated test fixtures and assertions to reflect revised parent span field handling.

Replace reference_parent_span_id with parent_span_id in SQL queries
and hit parsing. OpenObserve OTLP ingestion stores parent span ID
as parent_span_id, not reference_parent_span_id.

This fixes "Search field not found: reference_parent_span_id" errors
when the tracing adapter queries OpenObserve for trace data.

Changes:
- queries.go: 2 occurrences in generateTracesListQuery and generateSpansListQuery
- client.go: 3 occurrences in hit parsing, removed from internalFields
- client_test.go: 14 test fixture updates
- handlers_test.go: test fixture updates
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3dd0510d-5f26-4066-bee0-f43f51cccae8

📥 Commits

Reviewing files that changed from the base of the PR and between f212eac and bd0f70a.

📒 Files selected for processing (4)
  • observability-tracing-openobserve/internal/handlers_test.go
  • observability-tracing-openobserve/internal/openobserve/client.go
  • observability-tracing-openobserve/internal/openobserve/client_test.go
  • observability-tracing-openobserve/internal/openobserve/queries.go

📝 Walkthrough

Walkthrough

This PR migrates the OpenObserve integration from using reference_parent_span_id to parent_span_id across SQL queries, span parsing logic, and all associated test fixtures. No control flow or API signatures are modified.

Changes

Cohort / File(s) Summary
SQL Query Updates
observability-tracing-openobserve/internal/openobserve/queries.go
Updated trace and span list query generators to select parent_span_id instead of reference_parent_span_id from OpenObserve responses.
Client Parsing Logic
observability-tracing-openobserve/internal/openobserve/client.go
Modified span parsing (parseSpanEntry, parseSpanDetail), trace root detection (GetTraces), and internal field exclusion to reference parent_span_id instead of reference_parent_span_id.
Test Fixtures & Assertions
observability-tracing-openobserve/internal/.../handlers_test.go, observability-tracing-openobserve/internal/openobserve/client_test.go
Updated mock OpenObserve response payloads and test assertions across three test cases to expect and validate parent_span_id field instead of reference_parent_span_id.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A hop, skip, and field-name refactor!
From "reference" to "parent"—a simpler porter,
Traces now flow through the cleaner path,
No logic bent, just field name's wrath,
Spans dance together, hierarchies clear! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: replacing the incorrect field name with the correct one for parent span identification in OpenObserve tracing.
Description check ✅ Passed The description covers the problem, solution, and testing verification, but lacks some template sections like explicit Related Issues and Remarks.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.11.4)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@LakshanSS LakshanSS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @yehia2amer, welcome to OpenChoreo, and thank you so much for your very first contribution!

We need to use below format to fix the DCO check
git commit -s -m "your message"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants