In today's world of distributed systems, achieving reliability depends on various factors, one of which is effective observability. OpenTelemetry

OpenTelemetry context propagation in FerretDB

submited by
Style Pass
2024-09-19 11:30:06

In today's world of distributed systems, achieving reliability depends on various factors, one of which is effective observability. OpenTelemetry (OTel) has emerged as a standard for distributed tracing, but passing tracing data to databases remains a significant challenge, particularly with document databases like MongoDB. At FerretDB, we're committed to addressing this challenge.

Context propagation, a concept that enables the tracking of requests as they move through different services, is explained by OpenTelemetry here. This context typically includes request-related data, such as trace identifiers, which are passed across service boundaries, allowing you to link different parts of a distributed request together. The most common approach to implement context propagation is by using trace context HTTP headers to pass this information between services, but this method is not always feasible.

Obviously, most databases don't support such HTTP headers or other native ways to pass tracing-related context. Approaches like SQLCommenter have been developed to bridge this gap, enabling the connection between current trace data and database queries. In these cases, trace information is injected at the ORM level and passed to the database via SQL comments. Database operators can then enable query logs to link specific queries with the corresponding application requests.

Leave a Comment