class CacheFeature extends Feature

Traits

Track pushed scopes and spans using coroutine-local storage.

Constants

private FEATURE_KEY

Properties

bool internal $detectSessionKeyOnConsole

Indicates whether to attempt to detect the session key when running in the console.

Methods

__construct(Container $container)

Create a new feature instance.

from  Feature
bool
isApplicable()

Indicate if the feature is applicable to the current environment.

void
register()

Register the feature in the environment.

from  Feature
void
onBoot()

Set up the feature in the environment.

void
onBootInactive()

Set up the feature in the environment in an inactive state (when no DSN was set).

from  Feature
void
boot()

Initialize the feature.

from  Feature
void
bootInactive()

Initialize the feature in an inactive state (when no DSN was set).

from  Feature
array
getUserConfig()

Retrieve the user configuration.

from  Feature
bool
shouldSendDefaultPii()

Determine if default PII should be sent.

from  Feature
bool
isTracingFeatureEnabled(string $feature, bool $default = true)

Indicate if the given feature is enabled for tracing.

from  Feature
bool
isBreadcrumbFeatureEnabled(string $feature, bool $default = true)

Indicate if the given feature is enabled for breadcrumbs.

from  Feature
bool
canRecordSpans()

Determine if the active SDK client can record spans.

from  Feature
bool
canRecordBreadcrumbs()

Determine if the active SDK client can record breadcrumbs.

from  Feature
Span|null
getParentSpanIfSampled()

No description

void
withParentSpanIfSampled(callable $callback)

No description

void
pushSpan(Span $span)

Push a span onto the coroutine-local stack and set it as current on the hub.

Scope
pushScope()

Push a scope onto the hub and track the count in coroutine-local storage.

void
trackLocalSpan(string $key, Span $span)

Track an operation-local span without making it current on the Hub.

Span|null
maybePopSpan()

Pop a span from the coroutine-local stack and restore the parent span.

void
maybePopScope()

Pop a scope from the hub if one was pushed in this coroutine.

Span|null
maybeFinishSpan(SpanStatus|null $status = null)

Finish the current span if one exists on the coroutine-local stack.

Span|null
maybeFinishLocalSpan(string $key, SpanStatus|null $status = null)

Finish an operation-local span by key if one exists.

container()

Retrieve the application container.

array|null
resolveEventOrigin()

No description

string|null
resolveEventOriginAsString()

No description

void
void
handleCacheEventsForTracing(CacheEvent $event)

No description

bool

Details

in Feature at line 34
__construct(Container $container)

Create a new feature instance.

Parameters

Container $container

at line 50
bool isApplicable()

Indicate if the feature is applicable to the current environment.

Return Value

bool

in Feature at line 47
void register()

Register the feature in the environment.

Return Value

void

at line 56
void onBoot()

Set up the feature in the environment.

Return Value

void

in Feature at line 63
void onBootInactive()

Set up the feature in the environment in an inactive state (when no DSN was set).

Return Value

void

in Feature at line 70
void boot()

Initialize the feature.

Return Value

void

in Feature at line 80
void bootInactive()

Initialize the feature in an inactive state (when no DSN was set).

Return Value

void

in Feature at line 90
protected array getUserConfig()

Retrieve the user configuration.

Return Value

array

in Feature at line 98
protected bool shouldSendDefaultPii()

Determine if default PII should be sent.

Return Value

bool

in Feature at line 112
protected bool isTracingFeatureEnabled(string $feature, bool $default = true)

Indicate if the given feature is enabled for tracing.

Parameters

string $feature
bool $default

Return Value

bool

in Feature at line 125
protected bool isBreadcrumbFeatureEnabled(string $feature, bool $default = true)

Indicate if the given feature is enabled for breadcrumbs.

Parameters

string $feature
bool $default

Return Value

bool

in Feature at line 148
protected bool canRecordSpans()

Determine if the active SDK client can record spans.

Return Value

bool

in Feature at line 162
protected bool canRecordBreadcrumbs()

Determine if the active SDK client can record breadcrumbs.

Return Value

bool

in WorksWithSpans at line 12
protected Span|null getParentSpanIfSampled()

No description

Return Value

Span|null

in WorksWithSpans at line 25
protected void withParentSpanIfSampled(callable $callback)

No description

Parameters

callable $callback

Return Value

void

protected void pushSpan(Span $span)

Push a span onto the coroutine-local stack and set it as current on the hub.

Parameters

Span $span

Return Value

void

protected Scope pushScope()

Push a scope onto the hub and track the count in coroutine-local storage.

Return Value

Scope

protected void trackLocalSpan(string $key, Span $span)

Track an operation-local span without making it current on the Hub.

Parameters

string $key
Span $span

Return Value

void

protected Span|null maybePopSpan()

Pop a span from the coroutine-local stack and restore the parent span.

Return Value

Span|null

protected void maybePopScope()

Pop a scope from the hub if one was pushed in this coroutine.

Return Value

void

protected Span|null maybeFinishSpan(SpanStatus|null $status = null)

Finish the current span if one exists on the coroutine-local stack.

Parameters

SpanStatus|null $status

Return Value

Span|null

protected Span|null maybeFinishLocalSpan(string $key, SpanStatus|null $status = null)

Finish an operation-local span by key if one exists.

Parameters

string $key
SpanStatus|null $status

Return Value

Span|null

protected Container container()

Retrieve the application container.

Return Value

Container

protected array|null resolveEventOrigin()

No description

Return Value

array|null

protected string|null resolveEventOriginAsString()

No description

Return Value

string|null

at line 90
void handleCacheEventsForBreadcrumbs(CacheEvent $event)

No description

Parameters

CacheEvent $event

Return Value

void

at line 123
void handleCacheEventsForTracing(CacheEvent $event)

No description

Parameters

CacheEvent $event

Return Value

void

at line 186
protected bool maybeHandleCacheEventAsEndOfSpan(CacheEvent $event)

No description

Parameters

CacheEvent $event

Return Value

bool