Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Span are not exported by the BatchSpanProcessor #852

Closed
jderusse opened this issue Nov 2, 2022 · 3 comments
Closed

Span are not exported by the BatchSpanProcessor #852

jderusse opened this issue Nov 2, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@jderusse
Copy link

jderusse commented Nov 2, 2022

Describe your environment

Since #788 spans are not all flushed.

  • in the onEnd methods, spans are pushed to the batch array buffer.
  • the batch buffer is moved to the queue stack by the enqueueBatch method
  • the enqueueBatch is called:
    • when the batch buffer has more than maxExportBatchSize traces
    • Or when shouldFlush return true and queue is empty => this requires autoFlush + $this->clock->now() > $this->nextScheduledRun

There are cases (less span than maxExportBatchSize and process finish in less than scheduledDelayNanos) Where spans are not moved from batch buffer to queue stack and thus not flushed / exported

possible solution

Adds if ($this->batch !== []) { $this->enqueueBatch();} in shutdown and forceFlush and ask people to call these methods (or call shutdown on __destruct)

@jderusse jderusse added the bug Something isn't working label Nov 2, 2022
@bobstrecansky bobstrecansky self-assigned this Nov 2, 2022
@bobstrecansky
Copy link
Collaborator

bobstrecansky commented Nov 2, 2022

@Nevay - wanted to check with you that you approve of this approach before we implemented it.

@Nevay
Copy link
Contributor

Nevay commented Nov 2, 2022

Calling ::shutdown() is necessary and should flush all enqueued spans (::shutdown() adds the current batch id to the $this->flush queue); do you have a reproducer that calls ::shutdown()?

It's important to run the tracer provider's shutdown() method when the PHP process ends, to enable flushing of any enqueued telemetry.

@jderusse
Copy link
Author

jderusse commented Nov 3, 2022

indeed, calling shutdown fixes the issue. Sorry for the noise

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

No branches or pull requests

3 participants