MCPcopy Create free account
hub / github.com/Effect-TS/effect / spanTarget

Function spanTarget

packages/effect/src/sql/Statement.ts:1382–1393  ·  view source on GitHub ↗
(spanAttributes: ReadonlyArray<readonly [string, unknown]>)

Source from the content-addressed store, hash-verified

1380 * @since 4.0.1
1381 */
1382export const spanTarget = (spanAttributes: ReadonlyArray<readonly [string, unknown]>): string | undefined => {
1383 const namespace = spanAttribute(spanAttributes, "db.namespace")
1384 if (isNonEmptyString(namespace)) {
1385 return namespace
1386 }
1387 const address = spanAttribute(spanAttributes, "server.address")
1388 if (isNonEmptyString(address)) {
1389 const port = spanAttribute(spanAttributes, "server.port")
1390 return port === undefined ? address : `${address}:${port}`
1391 }
1392 return undefined
1393}
1394
1395/**
1396 * Returns the span name for statements run by a client with the given span

Callers 2

spanNameFunction · 0.85
executeBatchFunction · 0.85

Calls 2

spanAttributeFunction · 0.85
isNonEmptyStringFunction · 0.70

Tested by

no test coverage detected