diff --git a/src/guide/develop/client_design.md b/src/guide/develop/client_design.md index ec4c2370..ded545b8 100644 --- a/src/guide/develop/client_design.md +++ b/src/guide/develop/client_design.md @@ -245,6 +245,37 @@ classDiagram SeriesResult "1" *-- "0..*" Series: contains ``` +# OpenTelemetry integration design +To enhance the observability of the OpenGemini Go client and facilitate tracking of performance metrics, errors, and other information related to query and write operations, this solution adopts the interceptor pattern to integrate OpenTelemetry, enabling full-link tracing. The design supports non-intrusive extensions, allowing coexistence with other interceptors (such as logging and authentication interceptors) while minimizing modifications to the original client. + +## Interceptor design + +```mermaid +interface Interceptor { + void QueryBefore(context.Context, string) + void QueryAfter(context.Context, string, error) + void WriteBefore(context.Context, []byte) + void WriteAfter(context.Context, []byte, error) +} +``` + +## Define the base client class,associated with the Interceptor interface + +```mermaid +class Client { +- []Interceptor interceptors + +} +``` + +## Define the interceptor implementation class integrating OpenTelemetry,implementing the Interceptor interface + +```mermaid +class OtelClient { + Interceptor +} +``` + # QueryBuilder design ```mermaid diff --git a/src/zh/guide/develop/client_design.md b/src/zh/guide/develop/client_design.md index f657ee90..e8fbf19f 100644 --- a/src/zh/guide/develop/client_design.md +++ b/src/zh/guide/develop/client_design.md @@ -230,6 +230,36 @@ classDiagram SeriesResult "1" *-- "0..*" Series: contains ``` +# OpenTelemetry 集成设计 +为提升OpenGemini Go客户端的可观测性,便于追踪查询与写入操作的性能、错误等信息,本方案采用拦截器模式集成OpenTelemetry,实现全链路追踪。该设计支持非侵入式扩展,可与其他拦截器(如日志、认证)共存,同时保持对原生客户端的最小修改。 + +## 拦截器设计 + +```mermaid +interface Interceptor { + void QueryBefore(context.Context, string) + void QueryAfter(context.Context, string, error) + void WriteBefore(context.Context, []byte) + void WriteAfter(context.Context, []byte, error) +} +``` + +## 定义基础客户端类,关联拦截器接口 + +```mermaid +class Client { +- []Interceptor interceptors + +} +``` + +## 定义集成 OpenTelemetry 的拦截器实现类,实现 Interceptor 接口 + +```mermaid +class OtelClient { + Interceptor +``` + # 查询构造器设计 ```mermaid