Skip to content

Add immediate span publishing#4

Open
ChiragAgg5k wants to merge 1 commit intoutopia-php:mainfrom
ChiragAgg5k:feature/span-publish
Open

Add immediate span publishing#4
ChiragAgg5k wants to merge 1 commit intoutopia-php:mainfrom
ChiragAgg5k:feature/span-publish

Conversation

@ChiragAgg5k
Copy link
Copy Markdown
Member

Summary

  • Add Span::publish() for immediate storage-free publishing to configured exporters.
  • Share completion/export logic between publish() and finish() so timestamps, level defaults, samplers, and exporter exception handling stay consistent.
  • Document immediate publishing and cover storage isolation, errors, samplers, levels, and validation in tests.

Testing

  • composer test
  • composer format
  • composer analyze

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 30, 2026

Greptile Summary

This PR adds Span::publish() for fire-and-forget event export without storage interaction, and refactors finish() into two private helpers — complete() for timestamp/level computation and exportSpan() for exporter dispatch — keeping the two call paths consistent. The implementation is clean, attribute validation silently skips invalid keys and values (consistent with the "never break the application" philosophy), and the ten new tests cover all specified behaviors.

Confidence Score: 5/5

Safe to merge — no correctness, security, or behavioral regressions found.

No P0 or P1 issues identified. The refactoring correctly preserves existing finish() semantics, publish() is well-scoped and thoroughly tested, and attribute validation is intentionally lenient rather than throwing.

No files require special attention.

Important Files Changed

Filename Overview
src/Span/Span.php Adds publish() static method for storage-free immediate export; refactors finish() by extracting complete() and exportSpan() helpers with no behavioral regressions.
tests/SpanTest.php Adds 10 focused tests for publish() covering exporters, storage isolation, error handling, level defaults/overrides, sampler filtering, and invalid attribute key/value skipping.
README.md Adds documentation for Span::publish() with usage examples and adds the method signature to the static API reference table.

Reviews (2): Last reviewed commit: "Add immediate span publishing" | Re-trigger Greptile

Comment thread src/Span/Span.php
@ChiragAgg5k ChiragAgg5k force-pushed the feature/span-publish branch from eb73522 to ed34a3e Compare April 30, 2026 12:03
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.

1 participant