Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update parser to parse from prometheus txt metrics data #1421

Merged
merged 3 commits into from
Dec 15, 2023
Merged

Conversation

tomsun28
Copy link
Contributor

What's changed?

Checklist

  • I hereby agree to the terms of the HertzBeat CLA
  • I have read the Contributing Guide
  • I have written the necessary doc or comment.
  • I have added the necessary unit tests and all cases have passed.

Add or update API

  • I have added the necessary e2e tests and all cases have passed.

Signed-off-by: tomsun28 <tomsun28@outlook.com>
@tomsun28 tomsun28 added the enhancement New feature or request label Dec 14, 2023
} else {
valueRowBuilder.addColumns(CommonConstants.NULL_VALUE);
}
valueRowBuilder.addColumns(String.valueOf(metric.getValue()));
Copy link
Contributor

Choose a reason for hiding this comment

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

这个为什么改了?

@tomsun28
Copy link
Contributor Author

@Ceilzcx 参考了下 victoriametrics 的指标存储结构,

# TYPE jvm_gc_pause_seconds summary
jvm_gc_pause_seconds{action="end of minor GC",cause="Metadata GC Threshold",quantile="0.0",} 0.0
jvm_gc_pause_seconds{action="end of minor GC",cause="Metadata GC Threshold",quantile="0.25",} 0.0
jvm_gc_pause_seconds{action="end of minor GC",cause="Metadata GC Threshold",quantile="0.5",} 0.0
jvm_gc_pause_seconds{action="end of minor GC",cause="Metadata GC Threshold",quantile="0.75",} 0.0
jvm_gc_pause_seconds{action="end of minor GC",cause="Metadata GC Threshold",quantile="1.0",} 0.0

类似这种 summary 类型的指标也把quantile这种看成普通标签,不做特殊处理,在插入 victoriametrics 或其它数据库的格式也就统一类似如下,标签+指标值:

{
  // metric contans metric name plus labels for a particular time series
  "metric":{
    "__name__": "metric_name",  // <- this is metric name

    // Other labels for the time series

    "label1": "value1",
    "label2": "value2",
    ...
    "labelN": "valueN"
  },

  // values contains raw sample values for the given time series
  "values": [1, 2.345, -678],

  // timestamps contains raw sample UNIX timestamps in milliseconds for the given time series
  // every timestamp is associated with the value at the corresponding position
  "timestamps": [1549891472010,1549891487724,1549891503438]
}

prometheus 查询展示的结构也如下:

image

Copy link
Contributor

@Ceilzcx Ceilzcx left a comment

Choose a reason for hiding this comment

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

ci not pass

Signed-off-by: tomsun28 <tomsun28@outlook.com>
@tomsun28 tomsun28 merged commit ee99fd7 into master Dec 15, 2023
2 checks passed
@tomsun28 tomsun28 deleted the parse_txt branch December 15, 2023 03:58
tomsun28 added a commit that referenced this pull request Jan 16, 2024
Signed-off-by: tomsun28 <tomsun28@outlook.com>
tomsun28 added a commit that referenced this pull request Mar 9, 2024
Signed-off-by: tomsun28 <tomsun28@outlook.com>
tomsun28 added a commit that referenced this pull request Mar 9, 2024
Signed-off-by: tomsun28 <tomsun28@outlook.com>
tomsun28 added a commit that referenced this pull request Mar 10, 2024
Signed-off-by: tomsun28 <tomsun28@outlook.com>
tomsun28 added a commit that referenced this pull request Mar 10, 2024
Signed-off-by: tomsun28 <tomsun28@outlook.com>
tomsun28 added a commit that referenced this pull request Mar 11, 2024
Signed-off-by: tomsun28 <tomsun28@outlook.com>
tomsun28 added a commit that referenced this pull request Mar 11, 2024
Signed-off-by: tomsun28 <tomsun28@outlook.com>
tomsun28 added a commit that referenced this pull request Mar 11, 2024
Signed-off-by: tomsun28 <tomsun28@outlook.com>
tomsun28 added a commit that referenced this pull request Mar 11, 2024
Signed-off-by: tomsun28 <tomsun28@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants