Class DbServerTarget
java.lang.Object
io.opentelemetry.instrumentation.api.incubator.semconv.db.internal.DbServerTarget
A database endpoint set rendered as an address and a port.
A target usually names the logical server a database client was configured to talk to,
rendered as server.address and server.port. Such a target stays the same across
routing, node selection, and retries, so it is derived from client configuration rather than from
the endpoint that served an individual operation.
An instrumentation that knows which endpoint served an individual operation renders that one
endpoint the same way and reports it as network.peer.address and
network.peer.port.
This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
-
Method Summary
Modifier and TypeMethodDescriptionstatic DbServerTargetBuilderbuilder()Returns a builder for a target whose default port is unknown.static DbServerTargetBuilderbuilder(int defaultPort) Returns a builder for a target whose endpoints listen ondefaultPortunless they are configured otherwise.static DbServerTargetCreates a target from already parsed and sanitized attribute values without further normalization.abstract StringReturns the value forserver.address, or fornetwork.peer.address.abstract IntegergetPort()Returns the value forserver.port, or fornetwork.peer.port, ornullwhen no separate port is reported.static DbServerTargetunixSocket(String path) Returns a target for an already-extracted Unix socket path, ornullwhen the path is invalid.
-
Method Details
-
create
Creates a target from already parsed and sanitized attribute values without further normalization. Usebuilder()when collecting raw endpoints. -
builder
Returns a builder for a target whose endpoints listen ondefaultPortunless they are configured otherwise. -
builder
Returns a builder for a target whose default port is unknown. Endpoints without configured ports are kept without ports. -
unixSocket
Returns a target for an already-extracted Unix socket path, ornullwhen the path is invalid. Accepted paths are preserved verbatim and are not parsed as URIs or connection strings. -
getAddress
Returns the value forserver.address, or fornetwork.peer.address. -
getPort
Returns the value forserver.port, or fornetwork.peer.port, ornullwhen no separate port is reported. Targets built withDbServerTargetBuilderomit default ports and ports already carried insidegetAddress().
-