Metrics 数据模型改进设计 #518
liuhaoyang
started this conversation in
Ideas
Replies: 3 comments 3 replies
-
type Meta struct { type Tags struct { type MetricMultiValue struct { |
Beta Was this translation helpful? Give feedback.
2 replies
-
|
Beta Was this translation helpful? Give feedback.
0 replies
-
与其自行定义数据结构符合各种协议,不如一步到位直接使用 otlp 规范来封装 自建信号结构体 import (
logs "go.opentelemetry.io/proto/otlp/logs/v1"
metrics "go.opentelemetry.io/proto/otlp/metrics/v1"
traces "go.opentelemetry.io/proto/otlp/trace/v1"
)
type OTLPSignal struct {
metric *metrics.ResourceMetrics
log *logs.ResourceLogs
span *traces.ResourceSpans
} Collector 增加 2 个信号的收集方法 当插件还是老的数据格式可以做一层数据适配逻辑,最终目标是吧所有插件都转换成 OTLPSignal 的数据格式 // https://github.com/alibaba/ilogtail/blob/main/collector.go
type Collector interface {
AddOTLPSignal(s *OTLPSignal)
AddOTLPSignalArray(s []*OTLPSignal)
AddData(tags map[string]string,
fields map[string]string,
t ...time.Time)
AddDataArray(tags map[string]string,
columns []string,
values []string,
t ...time.Time)
AddRawLog(log *protocol.Log)
AddDataWithContext(tags map[string]string,
fields map[string]string,
ctx map[string]interface{},
t ...time.Time)
AddDataArrayWithContext(tags map[string]string,
columns []string,
values []string,
ctx map[string]interface{},
t ...time.Time)
AddRawLogWithContext(log *protocol.Log, ctx map[string]interface{})
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
背景
在 iLogtail 中支持 Logs、Traces、Metrics 三种数据的收集和处理,在阅读源码和开发插件时,发现仍存在以下问题:
在 iLogtail 中设计新的可观测性数据模型
设计
如果我们把 Pipeline 中流动的每一条数据都看做一个event,那么 event 应该具备下面的这些特性
metrics trace log 都应该派生自event,具备上面event的通用字段,对于每种数据类型,还需要有一些独立的字段
我们还需要引入聚合的概念 event Group,来支持部分需要对数据进行分组的操作
数据模型定义
event 和 group 接口定义
Metrics Event 定义
MetricValue
接口和MetricSingleValue
和MetricMultiValue
两个不同的实现。通常情况下,对于 counter 、gauge 类型的 metric 会使用单值 ,Histogram 和 Summary 类型在不同的TSDB上可能使用单值或者多值,比如字节内部的 ByteTSD 2.0 原生支持多值Histogram/Summary 来节省存储空间。对于单值和多值的处理,可以使用下面的API
float64
,在一些 TSDB 中比如 influxdb,除了数值类型,还支持string
bool
等非数值类型 (influxdb field-value)[https://docs.influxdata.com/influxdb/v1.8/concepts/glossary/#field-value] 。为此,我们扩展了一个额外的TypedValue
字段用来存储非数值的 field 值。Beta Was this translation helpful? Give feedback.
All reactions