[DOCS] Observability - #3096
Conversation
…umentation and partner spec
|
Client V2 CoverageCoverage Report
Class Coverage
|
JDBC V2 CoverageCoverage Report
Class Coverage
|
JDBC V1 CoverageCoverage Report
Class Coverage
|
Client V1 CoverageCoverage Report
Class Coverage
|
|
|
||
| For a complete production-style Spring Boot application demonstrating Client V2 configuration, connection pooling, trace context propagation across `@Async` boundaries, and full telemetry integration, see the `examples/demo-spring-service` module in this repository. | ||
|
|
||
| ### Client Builder Observability API |
There was a problem hiding this comment.
This overlaps with docs/clickhouse-docs/client.mdx with similar content. I suggest consolidating it into a single document and referencing other pages. I’m concerned about content discrepancies over time
There was a problem hiding this comment.
@mshustov
I agree with you. Initially I was thinking this will be good to have some duplication so no context is mixed.
Will put here specific part and reference to the client document.
| .setUsername("default") | ||
| .setPassword("secret") | ||
| .setMaxConnections(50) | ||
| .setConnectionRequestTimeout(5, TimeUnit.SECONDS) |
There was a problem hiding this comment.
not ChronoUnit? as per
|
|
||
| ### HTTP Connection Pooling (`client-v2`) | ||
|
|
||
| The `Client` instance owns an internal Apache HttpClient 5 connection pool. It manages persistent HTTP connections to ClickHouse endpoints. |
There was a problem hiding this comment.
should we add a link to Apache HttpClient 5 docs? one time is enough
There was a problem hiding this comment.
Why not.
I still think it will overflow context in some way and LLM will anyway search documentation by name but we will prune while testing.
|
|
||
| - **Layering:** HikariCP manages JDBC `Connection` instances, while each JDBC connection wraps a `Client` instance with its own internal HTTP socket pool. | ||
| - **Sizing Alignment:** Avoid over-allocating HikariCP connections. Because ClickHouse processes HTTP requests concurrently over pooled sockets, a smaller HikariCP pool (e.g., 10–20 connections) paired with a properly sized `Client` HTTP pool is typically optimal. | ||
| - **Connection Lifecycle:** Configure HikariCP's `maxLifetime` slightly shorter than any network or load-balancer idle timeout to prevent stale socket exceptions. |
There was a problem hiding this comment.
than any network or load-balancer idle timeout to prevent stale socket exceptions.
Do we have any anecdotal values to recommend?
There was a problem hiding this comment.
good point. I will compose some example.
|
|
||
| ### 2. Correlating Application Traces with ClickHouse Server Logs (`system.query_log`) | ||
|
|
||
| **Symptom:** Need to trace an expensive or failing query from APM traces down to ClickHouse server execution logs. |
There was a problem hiding this comment.
not only APM traces - any query, no?
|
|
||
| Tracing in Client V2 produces two types of spans arranged in a parent-child hierarchy: | ||
|
|
||
| 1. **Operation Span**: Represents a high-level client operation (`query <database>` or `insert <database>.<table_name>`). Started under the current thread's trace context (`Context.current()`) so that database operations join the caller's active trace span. |
There was a problem hiding this comment.
(
query <database>orinsert <database>.<table_name>)
not related to this PR: there is inconsistency across language clients that we need to address. see ClickHouse/clickhouse-rs#390
There was a problem hiding this comment.
This is very related to this PR because we need to fix it right now to avoid changing names in the future.
We can easily fix insert and make it like in RS client.
The problem is with query because [10] db.operation.name: The operation name SHOULD NOT be extracted from db.query.text. and on the client it is problematic.
In RS client query seems has no value https://github.com/ClickHouse/clickhouse-rs/pull/390/changes#diff-f0c63cae3ed0328ebbe14ac22d86b43bc8a40146944b03c8326681e4f3802443R177
So we can remove it from our code also - in Java client user can customize observability attributes if needed



Summary
examples/demo-spring-serviceas showcase for observabilitydocs/integration-ops.mdas part of partner spec for operationsCloses: #2147
Checklist
Delete items not relevant to your PR: