Skip to content

fix: spans with conflicting names are not tracked - #20

Merged
Soner (shyim) merged 1 commit into
mainfrom
fix-duplicate-name-spans-not-displayed
Sep 17, 2025
Merged

Soner (shyim) merged 1 commit into
mainfrom
fix-duplicate-name-spans-not-displayed

Conversation

@h1k3r

@h1k3r Andrii Havryliuk (h1k3r) commented Sep 16, 2025 •

Copy link
Copy Markdown
Contributor

1. Why is this change necessary?

See shopware/shopware#12385

2. What does this change do, exactly?

Changes tracking of spans:

  • replaces array<string, SpanInterface> with array<string, SpanInterface[]> for spans stack
  • adds stack for scopes

3. Describe each step to reproduce the issue or behaviour.

  1. Configure shopware installation with OpenTelemetry (use Tempo to store traces and Grafana to view them)
  2. Add code that creates spans with conflicting names (easeast way - use code snippet bellow in some storefront controller)
    public function index(SalesChannelContext $context, Request $request): Response
    {
        $this->doSomething(9);
        return new Response('ok');
    }

    private function doSomething(int $n): void
    {
        if ($n < 1) {
            return;
        }
        Profiler::trace('doSomething', function () use ($n) {
            usleep(1000 * 100);
            $this->doSomething($n - 1);
        });
    }
  1. Call the page and check traces, result should be similar to screenshots

Before fix:
image

After:
image

4. Please link to the relevant issues (if any).

@h1k3r Andrii Havryliuk (h1k3r) added the bug Something isn't working label Sep 16, 2025
@shyim
Soner (shyim) merged commit accc069 into main Sep 17, 2025
4 checks passed
@shyim
Soner (shyim) deleted the fix-duplicate-name-spans-not-displayed branch September 17, 2025 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple spans with the same name overwrite each other

3 participants