DatabaseInstrumentation
class DatabaseInstrumentation extends AbstractInstrumentation
Constants
| protected DURATION_BOUNDARIES |
|
| protected CONNECTION_ROLE_ATTRIBUTE |
|
| protected DB_SYSTEM_NAME_SQLITE |
|
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.
Determine whether the throwable is a direct coroutine cancellation.
Return the semantic conventions schema URL for Hypervel instrumentation scopes.
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 21
final void
register(array $options)
Register the instrumentation with normalized options.
at line 73
protected void
registerInstrumentation()
Register database listeners and instruments.
in
AbstractInstrumentation at line 35
protected bool
tracesEnabled()
Determine whether trace output is enabled.
in
AbstractInstrumentation at line 43
protected bool
metricEnabled(string $name)
Determine whether a metric is enabled.
in
AbstractInstrumentation at line 53
protected bool
isDirectCancellation(Throwable|null $exception)
Determine whether the throwable is a direct coroutine cancellation.
Ending an operation by direct cancellation is control flow, not a failure.
in
AbstractInstrumentation at line 64
protected string
schemaUrl()
Return the semantic conventions schema URL for Hypervel instrumentation scopes.
Every tracer, meter and logger obtained for one scope must pass the same URL.
in
AbstractInstrumentation at line 79
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 59
__construct(Dispatcher $events, TracerProviderInterface $tracerProvider, MeterProviderInterface $meterProvider, ClockInterface $clock, ExceptionContextRegistry $exceptionContexts, OperationOrigin $origins, ProcessIdentity $identity)
Create database instrumentation.
at line 109
protected void
queryExecuted(QueryExecuted $event)
Record a completed database query.
at line 126
protected void
queryFailed(QueryFailed $event)
Record a failed database query.
at line 140
protected void
recordQuery(string $query, float $elapsedMilliseconds, Connection $connection, string|null $connectionRole, Throwable|null $exception = null)
Record one completed database operation.
at line 205
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 228
protected string|null
operation(string $query)
Return the database operation when the query has one safe leading statement.
at line 248
protected string
queryText(string $query)
Return the bounded query template.
at line 258
protected string
systemName(string $driver)
Return the semantic database system name for a Hypervel driver.
at line 272
protected string|null
serverAddress(Connection $connection, string|null $connectionRole)
Return the configured server address when it identifies the queried endpoint.
at line 294
protected string
errorType(Throwable $exception)
Return the canonical error type for a failed operation.
at line 304
protected string
spanName(string|null $operation, array $attributes)
Return the semantic span name for a database operation.