(spanAttributes: ReadonlyArray<readonly [string, unknown]>)
| 1380 | * @since 4.0.1 |
| 1381 | */ |
| 1382 | export 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 |
no test coverage detected