Flare by Spatie
  • Features
  • Pricing
  • Docs
  • Blog
  • LOG IN
  • START TRACKING
  • Home
  • Features
  • Pricing
  • Docs
  • Blog
    • Try Flare for free
    • Sign in
Flare Flare Laravel Laravel PHP PHP JavaScript JavaScript
  • General
  • Introduction
  • Installation
  • Censoring collected data
  • Ignoring collected data
  • Laravel Octane
  • Errors
  • Adding custom context
  • Customising error grouping
  • Handling errors
  • Linking to errors
  • Reporting errors
  • Sending logs to Flare
  • Performance
  • Introduction
  • Sampling
  • Limits
  • Modify spans and span events
  • Data Collection
  • Application info
  • Cache events
  • Console commands
  • Customise error report
  • Database transactions
  • Dumps
  • Errors when tracing
  • Exception context
  • External http requests
  • Filesystem operations
  • Git information
  • Glows
  • Identifying users
  • Jobs and queues
  • Laravel context
  • Livewire
  • Logs
  • Queries
  • Redis commands
  • Requests
  • Server info
  • Solutions
  • Spans
  • Stacktrace arguments
  • Views
  • Older Packages
  • Laravel Flare V1
  • Ignition

Modify spans and span events

It is possible to modify spans as such:

Flare::tracer()->configureSpans(fn(Span $span) => $span->addAttribute('key', 'value'));

The following closure will be called each time a span (which ended) is added to the trace or when a span already present in the trace ends. The closure should return void or the span itself.

Span events

It is also possible to modify span events using a closure:

Flare::tracer()->configureSpanEvents(fn(SpanEvent $spanEvent) => $spanEvent->addAttribute('key', 'value'));

The following closure will be called after the configureSpans closure.

It is possible to return null as a value from the closure, which will remove the span event from the span. Deleting spans is technically not possible since spans have a child-parent relation, which could break when deleting one of them.

Limits Application info
  • On this page
  • Span events

Monitor your web apps and sites from errors to slowdowns with Flare, the easiest application monitoring platform for Laravel, PHP & Javascript.

  • Platform
  • Error Tracking
  • Performance Monitoring
  • Pricing
  • Support
  • Resources
  • Blog
  • Changelog
  • Documentation
  • Affiliate program
  • Service status
  • Terms of use
  • DPA
  • Privacy & Cookie Policy
Flare