DatabaseInstrumentation
class DatabaseInstrumentation extends AbstractInstrumentation
Constants
| protected DURATION_BOUNDARIES |
|
| protected CONNECTION_ROLE_ATTRIBUTE |
|
Properties
| protected InstrumentationOptions | $options | from AbstractInstrumentation | |
| protected TracerInterface|null | $tracer | ||
| protected HistogramInterface|null | $duration | ||
| protected bool | $queryText | ||
| protected int|null | $queryTextMaxLength |
Methods
Register the instrumentation with normalized options.
Register database listeners and instruments.
Determine whether a metric is enabled.
Index callback observers by their matching instrument name.
Create database instrumentation.
Record one completed database operation.
Return low-cardinality attributes shared by spans and metrics.
Return the database operation when the query has one safe leading statement.
Return the bounded query template.
Return the semantic database system name for a Hypervel driver.
Return the configured server address when it identifies the queried endpoint.
Return the semantic span name for a database operation.
Details
in
AbstractInstrumentation at line 18
final void
register(array $options)
Register the instrumentation with normalized options.
at line 70
protected void
registerInstrumentation()
Register database listeners and instruments.
in
AbstractInstrumentation at line 32
protected bool
tracesEnabled()
Determine whether trace output is enabled.
in
AbstractInstrumentation at line 40
protected bool
metricEnabled(string $name)
Determine whether a metric is enabled.
in
AbstractInstrumentation at line 55
protected array
indexObservers(array $names, array $observers)
Index callback observers by their matching instrument name.
The SDK supplies observers in the same order as the instruments passed to batchObserve(), so the unchanged name order is the mapping contract.
at line 56
__construct(Dispatcher $events, TracerProviderInterface $tracerProvider, MeterProviderInterface $meterProvider, ClockInterface $clock, ExceptionContextRegistry $exceptionContexts, OperationOrigin $origins, ProcessIdentity $identity)
Create database instrumentation.
at line 106
protected void
queryExecuted(QueryExecuted $event)
Record a completed database query.
at line 123
protected void
queryFailed(QueryFailed $event)
Record a failed database query.
at line 137
protected void
recordQuery(string $query, float $elapsedMilliseconds, Connection $connection, string|null $connectionRole, Throwable|null $exception = null)
Record one completed database operation.
at line 202
protected array
attributes(Connection $connection, string|null $connectionRole, string|null $operation, string|null $errorType)
Return low-cardinality attributes shared by spans and metrics.
at line 225
protected string|null
operation(string $query)
Return the database operation when the query has one safe leading statement.
at line 245
protected string
queryText(string $query)
Return the bounded query template.
at line 255
protected string
systemName(string $driver)
Return the semantic database system name for a Hypervel driver.
at line 269
protected string|null
serverAddress(Connection $connection, string|null $connectionRole)
Return the configured server address when it identifies the queried endpoint.
at line 291
protected string
errorType(Throwable $exception)
Return the canonical error type for a failed operation.
at line 301
protected string
spanName(string|null $operation, array $attributes)
Return the semantic span name for a database operation.