Skip to content

fix(memory): Skip same-service parents when building dependency links - #9090

Open
lopster568 wants to merge 1 commit into
jaegertracing:mainfrom
lopster568:fix/memory-self-dependency-links
Open

fix(memory): Skip same-service parents when building dependency links#9090
lopster568 wants to merge 1 commit into
jaegertracing:mainfrom
lopster568:fix/memory-self-dependency-links

Conversation

@lopster568

@lopster568 lopster568 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Which problem is this PR solving?

Description of the changes

Skip dependency links where the parent and child span belong to the same service, matching the Badger dependency store and the v1 memory store this code was ported from.

How was this change tested?

  • New TestGetDependencies_SameService: one trace with an internal parent/child pair in service-x plus a cross-service call to service-y, asserting only service-x -> service-y is returned. On main it also returns service-x -> service-x.
  • Existing TestGetDependencies* cases are unaffected.

Note: #8767 and #9003 also have open changes to getDependencies. Happy to rebase behind whichever lands first.

Checklist

AI Usage in this PR (choose one)

See AI Usage Policy.

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

Copilot AI review requested due to automatic review settings July 23, 2026 12:55
@lopster568
lopster568 requested a review from a team as a code owner July 23, 2026 12:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes the v2 in-memory dependency graph behavior to align with other Jaeger backends by skipping dependency links where the parent and child spans resolve to the same service (avoiding service -> service self-loops), addressing #9089.

Changes:

  • Skip dependency-link creation when parentSpanServiceName == spanServiceName in getDependencies.
  • Add TestGetDependencies_SameService to ensure same-service parent/child spans do not produce a self-dependency while cross-service relationships still do.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/storage/v2/memory/tenant.go Adds a guard to drop same-service parent/child dependency links during dependency extraction.
internal/storage/v2/memory/memory_test.go Adds a regression test covering same-service parent/child spans plus a cross-service call.

@dosubot dosubot Bot added the area/storage label Jul 23, 2026
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.43%. Comparing base (77f8feb) to head (092b7fc).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9090   +/-   ##
=======================================
  Coverage   97.43%   97.43%           
=======================================
  Files         377      377           
  Lines       19625    19625           
=======================================
  Hits        19121    19121           
  Misses        369      369           
  Partials      135      135           
Flag Coverage Δ
badger_direct 7.83% <0.00%> (ø)
badger_e2e 0.90% <0.00%> (ø)
cassandra-4.x-direct-manual 12.81% <0.00%> (ø)
cassandra-4.x-e2e-auto 0.89% <0.00%> (ø)
cassandra-4.x-e2e-manual 0.89% <0.00%> (ø)
cassandra-5.x-direct-manual 12.81% <0.00%> (ø)
cassandra-5.x-e2e-auto 0.89% <0.00%> (ø)
cassandra-5.x-e2e-manual 0.89% <0.00%> (ø)
clickhouse-direct 7.91% <0.00%> (ø)
clickhouse-e2e 1.02% <0.00%> (ø)
elasticsearch-7.x-direct 21.16% <0.00%> (ø)
elasticsearch-8.x-direct 21.19% <0.00%> (-0.21%) ⬇️
elasticsearch-8.x-e2e 2.14% <0.00%> (+0.04%) ⬆️
elasticsearch-9.x-direct 21.19% <0.00%> (ø)
elasticsearch-9.x-e2e 2.10% <0.00%> (-0.05%) ⬇️
grpc_direct 6.91% <0.00%> (ø)
grpc_e2e 0.91% <0.00%> (ø)
kafka-3.x-v2 0.90% <0.00%> (ø)
memory_v2 0.91% <0.00%> (ø)
opensearch-1.x-direct 21.18% <0.00%> (ø)
opensearch-2.x-direct 21.18% <0.00%> (ø)
opensearch-2.x-e2e 2.12% <0.00%> (ø)
opensearch-3.x-direct 21.18% <0.00%> (ø)
opensearch-3.x-e2e 2.16% <0.00%> (+0.04%) ⬆️
query 0.91% <0.00%> (ø)
tailsampling-processor 0.45% <0.00%> (ø)
unittests 96.48% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

The v2 in-memory store did not check whether a span's parent belonged to
the same service, so any service with nested internal spans produced a
service -> service self-loop in the System Architecture graph. Memory is
the default all-in-one backend, so this is the common local experience.

Both sibling implementations already skip these: the Badger dependency
store (whose comment notes it was copied from the memory plugin) and the
v1 in-memory store before it was removed.

Signed-off-by: Roshan <rosh.s568@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: v2 memory store emits service -> itself dependency links

2 participants