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: plugin procstat - extract label from cmdline using regexp Named capturing group #951

Merged
merged 1 commit into from
Jun 5, 2024

Conversation

zzmark
Copy link
Contributor

@zzmark zzmark commented May 29, 2024

功能描述

  • 对单进程的指标,使用正则表达式,从 cmdline 中提取字串作为 label 标签。

使用场景

  • 需要对大量相同进程使用 procstat 抓取基础指标时,仅靠pid难以区分进程的功能,静态标签无法适应频繁启停。

使用案例

启动命令行模板: java -cp lib/* -Denv=${tenantry} main.GwStartup --serviceName=${service} --serverId=${serverId}

配置案例: 静态标签 [region, product],采集每个进程,不统计总量,开启所需指标,使用正则动态获取

[[instances]]
search_cmdline_substring = "main.GwStartup"
labels = { region="us-west-1", product="gw" }
gather_total = false
gather_per_pid = true
gather_more_metrics = ["threads", "io", "uptime", "cpu", "mem", "jvm"]
labels_from_cmdline_reggroup = "-Denv=(?P<vfenv>[\\w]+)\\s+main.GwStartup\\s+--serviceName=(?P<serviceName>[\\w]+)\\s+--serverId=(?P<serverId>\\d{1,4})"

@kongfei605 kongfei605 merged commit 2015cf7 into flashcatcloud:main Jun 5, 2024
3 checks passed
@kongfei605
Copy link
Collaborator

Thank you @zzmark

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