class HttpClientIntegration extends Feature

Instrument the requests of every Guzzle client: the HTTP client, directly constructed clients and third-party SDKs built on Guzzle.

A client or a single request opts out with the sentry_enabled option set to false.

Traits

Constants

private FEATURE_KEY

private MIDDLEWARE_NAME

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()

Instrument outgoing Guzzle requests.

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
shouldCollectGenAiInputs()

Determine whether AI inputs may be collected.

from  Feature
bool
shouldCollectGenAiOutputs()

Determine whether AI outputs may be collected.

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
container()

Retrieve the application container.

array|null
resolveEventOrigin(array|null $backtrace = null)

Resolve the code location of the first application frame of the event.

string|null
resolveEventOriginAsString()

Resolve the code location of the event as a "file:line" string.

callable
instrumentRequests(callable $handler)

Trace each request and record its completed transfer.

static void
flushState()

Flush all static state.

Details

in Feature at line 35
__construct(Container $container)

Create a new feature instance.

Parameters

Container $container

at line 57
bool isApplicable()

Indicate if the feature is applicable to the current environment.

Return Value

bool

in Feature at line 48
void register()

Register the feature in the environment.

Return Value

void

at line 68
void onBoot()

Instrument outgoing Guzzle requests.

The middleware persists for the worker lifetime and affects every Guzzle client.

Return Value

void

in Feature at line 64
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 71
void boot()

Initialize the feature.

Return Value

void

in Feature at line 81
void bootInactive()

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

Return Value

void

in Feature at line 91
protected array getUserConfig()

Retrieve the user configuration.

Return Value

array

in Feature at line 99
protected bool shouldSendDefaultPii()

Determine if default PII should be sent.

Return Value

bool

in Feature at line 113
protected bool shouldCollectGenAiInputs()

Determine whether AI inputs may be collected.

Return Value

bool

in Feature at line 121
protected bool shouldCollectGenAiOutputs()

Determine whether AI outputs may be collected.

Return Value

bool

in Feature at line 146
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 159
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 182
protected bool canRecordSpans()

Determine if the active SDK client can record spans.

Return Value

bool

in Feature at line 196
protected bool canRecordBreadcrumbs()

Determine if the active SDK client can record breadcrumbs.

Return Value

bool

protected Container container()

Retrieve the application container.

Return Value

Container

protected array|null resolveEventOrigin(array|null $backtrace = null)

Resolve the code location of the first application frame of the event.

Parameters

array|null $backtrace

a backtrace captured earlier, for an event whose origin is no longer on the stack

Return Value

array|null

protected string|null resolveEventOriginAsString()

Resolve the code location of the event as a "file:line" string.

Return Value

string|null

at line 84
protected callable instrumentRequests(callable $handler)

Trace each request and record its completed transfer.

Parameters

callable $handler

Return Value

callable

at line 293
static void flushState()

Flush all static state.

Return Value

void