Top Description Methods
com.mysql.cj.telemetry

public Interface TelemetrySpan

extends AutoCloseable
Known Direct Implementers
com.mysql.cj.otel.OpenTelemetrySpan, com.mysql.cj.telemetry.NoopTelemetrySpan
Imports
java.util.function.Supplier

A telemetry span wrapper that hides all specific details from the underlying telemetry library. A default no-op implementation is provided so that telemetry may be turned off with minimal impact on the driver code.

Method Summary

Modifier and TypeMethod and Description
public default void
close()

Implements java.lang.AutoCloseable.close.

AutoCloseable#close() that can be used to end this span and, making it possible to create new span within the try-with-resources blocks.

public default void
end()

Marks the end of the execution of this span.

public TelemetryScope

Returns:

an AutoCloseable telemetry scope that represents the current telemetry context.
makeCurrent
()

Takes this telemetry span and makes it current in the global telemetry context.

public default void
setAttribute(TelemetryAttribute
the key for this attribute
key
,
String
the value for this attribute
value
)

Adds the specified String attribute to this telemetry span.

public default void
setAttribute(TelemetryAttribute
the key for this attribute
key
,
long
the value for this attribute
value
)

Adds the specified long attribute to this telemetry span.

public default <
the type of the attribute value
T
>
void
setAttribute(TelemetryAttribute
the key for this attribute
key
,
Supplier<T>
the supplier for the value for this attribute
valueSupplier
)

Adds the attribute given by the specified supplier to this telemetry span.

public default void
setError(Throwable
the cause for setting this span status code to ERROR
cause
)

Sets the status code of this telemetry span as ERROR and records the stack trace of the specified exception.

Method Detail

closeback to summary
public default void close()

Implements java.lang.AutoCloseable.close.

AutoCloseable#close() that can be used to end this span and, making it possible to create new span within the try-with-resources blocks.

Annotations
@Override
endback to summary
public default void end()

Marks the end of the execution of this span.

makeCurrentback to summary
public TelemetryScope makeCurrent()

Takes this telemetry span and makes it current in the global telemetry context.

Returns:TelemetryScope

an AutoCloseable telemetry scope that represents the current telemetry context.

setAttributeback to summary
public default void setAttribute(TelemetryAttribute key, String value)

Adds the specified String attribute to this telemetry span.

Parameters
key:TelemetryAttribute

the key for this attribute

value:String

the value for this attribute

setAttributeback to summary
public default void setAttribute(TelemetryAttribute key, long value)

Adds the specified long attribute to this telemetry span.

Parameters
key:TelemetryAttribute

the key for this attribute

value:long

the value for this attribute

setAttributeback to summary
public default <T> void setAttribute(TelemetryAttribute key, Supplier<T> valueSupplier)

Adds the attribute given by the specified supplier to this telemetry span.

Parameters
<T>
the type of the attribute value
key:TelemetryAttribute

the key for this attribute

valueSupplier:Supplier<T>

the supplier for the value for this attribute

setErrorback to summary
public default void setError(Throwable cause)

Sets the status code of this telemetry span as ERROR and records the stack trace of the specified exception.

Parameters
cause:Throwable

the cause for setting this span status code to ERROR