Skip to content

Conversation

@shunjiazhu
Copy link
Contributor

@shunjiazhu shunjiazhu commented Jun 24, 2025

  1. 增加一个GlobalMetricsRecord,用来记录一些和插件流水线及插件无关的指标
  2. 支持将Go单个MetricVector级别的静态Label和动态可变Label Value序列化后转出给c++,原先这部分信息丢失。

Change-Id: I0ed79c684700adfd35d0ec67385e1b5abc22aaa6
Change-Id: I7dbb706bb72494d5aff7d0be6c1732a56fe421fd
// A metric may have three levels of labels
// 1. MetricsRecord Level Const Labels, like PluginType=flusher_http, PluginId=1
// 2. Metric Level Const Labels, for example, flusher_http may have a const label: RemoteURL=http://aliyun.com/write
// 3. Metric Level Dynamic Labels, like status_code=200, status_code=204
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是不是可以这样理解:

  1. MetricsRecord级别有一些label,也有一些没有自己label的metrics,他们会输出一个metric记录,也就是Line45这一条
  2. 每个Metric会有自己的一些const和Dynamic label,当有这些label时,一个metric会变成一条单独的metric记录被暴露出来,例如上面的http_flusher_status_code_count * 2,http_flusher_error_count * 3?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

指标是有类型的,go这边key是metric_category,value是agent、runner、这些。https://observability.cn/project/loongcollector/internal-metrics-description/#_top

具有单独label的Metric,是不是需要定义为plugin_source级?这块有考虑过吗

// 1. MetricsRecord Level Const Labels, like PluginType=flusher_http, PluginId=1
// 2. Metric Level Const Labels, for example, flusher_http may have a const label: RemoteURL=http://aliyun.com/write
// 3. Metric Level Dynamic Labels, like status_code=200, status_code=204
func (m *MetricsRecord) ExportMetricRecords() []map[string]string {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

方便给一个前后对比吗?先前有问题的指标和修改之后的样子

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我晚点补一下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants