CacheIntegration
class CacheIntegration extends Feature
Traits
Track pushed scopes and spans using coroutine-local storage.
Constants
| private FEATURE_KEY |
|
| private SESSION_KEY_RESOLUTION_CONTEXT_KEY |
|
| private SESSION_KEY_PLACEHOLDER |
|
Properties
| bool internal | $detectSessionKeyOnConsole | Indicates whether to attempt to detect the session key when running in the console. |
Methods
Indicate if the feature is applicable to the current environment.
Set up the feature in the environment.
Set up the feature in the environment in an inactive state (when no DSN was set).
Indicate if the given feature is enabled for tracing.
Indicate if the given feature is enabled for breadcrumbs.
Call the callback with the current span if it is sampled.
Get the status of an operation that cancellation stopped.
Push a span onto the coroutine-local stack and set it as current on the hub.
Push a scope onto the hub and track the count in coroutine-local storage.
Track an operation-local span without making it current on the Hub.
Pop a span from the coroutine-local stack and restore the parent span.
Pop a scope from the hub if one was pushed in this coroutine.
Finish the current span if one exists on the coroutine-local stack.
Finish an operation-local span by key if one exists.
Resolve the code location of the first application frame of the event.
Resolve the code location of the event as a "file:line" string.
Record a span for the given executed or failed Redis command.
Finish the span started for the given cache event, if the event ends one.
Details
at line 68
bool
isApplicable()
Indicate if the feature is applicable to the current environment.
in
Feature at line 48
void
register()
Register the feature in the environment.
at line 78
void
onBoot()
Set up the feature in the environment.
in
Feature at line 64
void
onBootInactive()
Set up the feature in the environment in an inactive state (when no DSN was set).
in
Feature at line 71
void
boot()
Initialize the feature.
in
Feature at line 81
void
bootInactive()
Initialize the feature in an inactive state (when no DSN was set).
in
Feature at line 91
protected array
getUserConfig()
Retrieve the user configuration.
in
Feature at line 99
protected bool
shouldSendDefaultPii()
Determine if default PII should be sent.
in
Feature at line 113
protected bool
shouldCollectGenAiInputs()
Determine whether AI inputs may be collected.
in
Feature at line 121
protected bool
shouldCollectGenAiOutputs()
Determine whether AI outputs may be collected.
in
Feature at line 146
protected bool
isTracingFeatureEnabled(string $feature, bool $default = true)
Indicate if the given feature is enabled for tracing.
in
Feature at line 159
protected bool
isBreadcrumbFeatureEnabled(string $feature, bool $default = true)
Indicate if the given feature is enabled for breadcrumbs.
in
Feature at line 182
protected bool
canRecordSpans()
Determine if the active SDK client can record spans.
in
Feature at line 196
protected bool
canRecordBreadcrumbs()
Determine if the active SDK client can record breadcrumbs.
in
WorksWithSpans at line 18
protected Span|null
getParentSpanIfSampled()
Get the current span if it is sampled.
in
WorksWithSpans at line 35
protected void
withParentSpanIfSampled(callable $callback)
Call the callback with the current span if it is sampled.
in
WorksWithSpans at line 53
protected SpanStatus|null
cancellationStatus(Throwable $cancellation, Throwable|null $exception = null)
Get the status of an operation that cancellation stopped.
A direct cancellation with no earlier failure leaves the status unset: it is control flow, and the SDK has no canceled status. A known failure, or a cleanup failure carrying the cancellation, is an error.
in
TracksPushedScopesAndSpans at line 26
protected void
pushSpan(Span $span)
Push a span onto the coroutine-local stack and set it as current on the hub.
in
TracksPushedScopesAndSpans at line 45
protected Scope
pushScope()
Push a scope onto the hub and track the count in coroutine-local storage.
in
TracksPushedScopesAndSpans at line 59
protected void
trackLocalSpan(string $key, Span $span)
Track an operation-local span without making it current on the Hub.
in
TracksPushedScopesAndSpans at line 70
protected Span|null
maybePopSpan()
Pop a span from the coroutine-local stack and restore the parent span.
in
TracksPushedScopesAndSpans at line 93
protected void
maybePopScope()
Pop a scope from the hub if one was pushed in this coroutine.
in
TracksPushedScopesAndSpans at line 109
protected Span|null
maybeFinishSpan(SpanStatus|null $status = null)
Finish the current span if one exists on the coroutine-local stack.
in
TracksPushedScopesAndSpans at line 129
protected Span|null
maybeFinishLocalSpan(string $key, SpanStatus|null $status = null)
Finish an operation-local span by key if one exists.
in
ResolvesEventOrigin at line 15
protected Container
container()
Retrieve the application container.
in
ResolvesEventOrigin at line 25
protected array|null
resolveEventOrigin(array|null $backtrace = null)
Resolve the code location of the first application frame of the event.
in
ResolvesEventOrigin at line 52
protected string|null
resolveEventOriginAsString()
Resolve the code location of the event as a "file:line" string.
at line 123
void
handleCacheEventsForBreadcrumbs(CacheEvent $event)
Record a breadcrumb for the given cache event.
at line 159
void
handleCacheEventsForTracing(CacheEvent $event)
Record a span for the given cache event.
at line 234
void
handleRedisCommands(CommandExecuted|CommandFailed $event)
Record a span for the given executed or failed Redis command.
at line 320
protected bool
maybeHandleCacheEventAsEndOfSpan(CacheEvent $event)
Finish the span started for the given cache event, if the event ends one.