MCPcopy Create free account
hub / github.com/effect-app/libs / annotateCosmosResponse

Function annotateCosmosResponse

packages/infra/src/otel.ts:84–95  ·  view source on GitHub ↗
(m: {
  readonly requestCharge?: number | undefined
  readonly returnedRows?: number | undefined
  readonly responseBytes?: number | undefined
  readonly statusCode?: number | undefined
})

Source from the content-addressed store, hash-verified

82 `${a.operation} ${a.collection}`,
83 { attributes: dbAttributes(a), kind: "client" as const },
84 { captureStackTrace: false }
85 )
86
87/**
88 * Annotate the current span with OTel-semconv database attributes.
89 *
90 * Use when the caller already owns the span (e.g. a repository) and the
91 * adapter should only contribute db.* semconv attrs without opening a child.
92 * Annotates before running so attrs persist even on failure.
93 * No-op if there is no current span.
94 */
95export const annotateDb = (a: DbSpanOptions) => <A, E, R>(self: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> =>
96 Effect.flatMap(Effect.annotateCurrentSpan(dbAttributes(a)), () => self.pipe(timeDbOperation(a)))
97
98/** Annotate the current span with response metrics from a DB call. */

Callers 7

annotateItemFunction · 0.90
annotateFeedFunction · 0.90
readExecFunction · 0.90
replaceExecFunction · 0.90
upsertFunction · 0.90
annotateFeedFunction · 0.90
annotateItemFunction · 0.90

Calls 1

StringInterface · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…