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

feat: support prometheus self monitor, add 9 metrics for prom input plugin #1760

Open
wants to merge 46 commits into
base: main
Choose a base branch
from

Conversation

catdogpandas
Copy link
Contributor

指标 描述 labels 类型
prom_register_state 注册状态 pod_name,operator_host,operator_port IntGauge
prom_register_retry_total 注册重试 status,pod_name,... Counter
prom_job_num 输入插件(Job)数量 pod_name,... IntGauge
prom_subsricbe_targets 订阅的 Targets 数量 job,pod_name,... IntGauge
prom_subsricbe_total 订阅次数总量 status,job,pod_name,... Counter
prom_subsricbe_time_ms 订阅耗时(分布) status,job,pod_name,... IntGauge
prom_scrape_total 采集次数总量 status,target,job,pod_name,... Counter
prom_scrape_bytes_total 采集总字节数 status,target,job,pod_name,... Counter
prom_scrape_time_ms 采集耗时(分布) status,target,job,pod_name,... IntGauge

core/prometheus/Constants.h Outdated Show resolved Hide resolved
core/prometheus/PromSelfMonitor.cpp Outdated Show resolved Hide resolved
core/prometheus/PrometheusInputRunner.cpp Outdated Show resolved Hide resolved
core/prometheus/PromSelfMonitor.h Show resolved Hide resolved
core/prometheus/PromSelfMonitor.h Outdated Show resolved Hide resolved
core/prometheus/PromSelfMonitor.h Outdated Show resolved Hide resolved
if (!mMetricsCounterMap.count(metricName) || !mMetricsCounterMap[metricName].count(status)) {
mMetricsCounterMap[metricName][status] = GetOrCreateReentrantMetricsRecordRef(status)->GetCounter(metricName);
}
mMetricsCounterMap[metricName][status]->Add(val);
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里不要用map存储查找,具体原则可以再找玄飏对齐一下

Copy link
Collaborator

Choose a reason for hiding this comment

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

就算用map,不用加锁吗

Copy link
Collaborator

Choose a reason for hiding this comment

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

status 3XX,4XX,5XX这样是不是就好了?不需要具体的code吧

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.

3 participants