Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/guide/develop/client_design.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 30 additions & 0 deletions src/zh/guide/develop/client_design.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down