Skip to content

Comments

Enhancement/2026 01 metrics api integration#634

Merged
takapi327 merged 49 commits intoseries/0.6.xfrom
enhancement/2026-01-Metrics-API-Integration
Feb 21, 2026
Merged

Enhancement/2026 01 metrics api integration#634
takapi327 merged 49 commits intoseries/0.6.xfrom
enhancement/2026-01-Metrics-API-Integration

Conversation

@takapi327
Copy link
Owner

@takapi327 takapi327 commented Jan 25, 2026

Implementation Details

Integrate OpenTelemetry Semantic Conventions v1.39.0 compliant Metrics API, enabling measurement of database operation duration, returned row counts, and connection pool state. Internally uses otel4s and works on all platforms: JVM, JS, and Native.

When no OpenTelemetry backend is connected, metrics automatically become no-ops with zero performance impact.

Operation Metrics

Metric Name Type Description
db.client.operation.duration Histogram (s) Duration of database query execution
db.client.response.returned_rows Histogram ({row}) Number of rows returned by a query

Connection Pool Metrics

Metric Name Type Description
db.client.connection.create_time Histogram (s) Time to create a new physical connection
db.client.connection.wait_time Histogram (s) Time waiting to acquire a connection from the pool
db.client.connection.use_time Histogram (s) Time between borrowing and returning a connection
db.client.connection.timeouts Counter Number of connection acquisition timeouts
db.client.connection.count Gauge Current number of connections (idle/used)
db.client.connection.idle.max Gauge Maximum number of idle connections allowed
db.client.connection.idle.min Gauge Minimum number of idle connections maintained
db.client.connection.max Gauge Maximum number of connections allowed
db.client.connection.pending_requests Gauge Number of requests waiting for a connection

Tracing Enhancements

  • Span name generation compliant with OpenTelemetry Semantic Conventions (db.query.summary{operation} {target} → fallback)
  • Automatic sanitization of non-parameterized queries (replacing literal values with ?)
  • IN clause collapsing (IN (?, ?, ?)IN (?)) for cardinality control
  • Error recording with error.type attribute and stack traces via recordException
  • Customizable telemetry behavior through TelemetryConfig

Pull Request Checklist

  • Wrote unit and integration tests
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code formatting by scalafmt (sbt scalafmtAll command execution)
  • Add copyright headers to new files

References

@takapi327 takapi327 added this to the 0.6.0 milestone Jan 25, 2026
@takapi327 takapi327 self-assigned this Jan 25, 2026
@takapi327 takapi327 added 💪 enhancement Functional enhancement ldbc:connector Addition and modification of functionality to Connector projects labels Jan 25, 2026
takapi327 and others added 2 commits January 25, 2026 20:24
@takapi327 takapi327 mentioned this pull request Feb 8, 2026
10 tasks
…ons' of github.com:takapi327/ldbc into enhancement/2026-01-Metrics-API-Integration
Base automatically changed from refactor/2026-01-Fully-compliant-with-semantic-conventions to series/0.6.x February 10, 2026 16:14
@takapi327 takapi327 merged commit 4d8e749 into series/0.6.x Feb 21, 2026
37 checks passed
@takapi327 takapi327 deleted the enhancement/2026-01-Metrics-API-Integration branch February 21, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💪 enhancement Functional enhancement ldbc:connector Addition and modification of functionality to Connector projects

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant