Skip to content

Add cs_features metric - #4770

Merged
blotus merged 2 commits into
masterfrom
blotus/cs-features-metric
Oct 21, 2026
Merged

blotus merged 2 commits into
masterfrom
blotus/cs-features-metric

Conversation

@blotus

@blotus blotus commented Oct 20, 2026

Copy link
Copy Markdown
Member

Add a new cs_features prometheus metric that track if the following features are enabled on a given instance:

  • LAPI
  • CAPI
  • PAPI
  • WAF
  • Bot detection

The goal is to help user understand which instance is doing what.
All labels are always written to the metrics, 0 for disabled, 1 for enabled.
For example, on a machine that is both a LAPI and a LP, with the WAF disabled:

cs_features{feature="bot_detection"} 0
cs_features{feature="capi"} 1
cs_features{feature="lapi"} 1
cs_features{feature="log_processor"} 1
cs_features{feature="papi"} 0
cs_features{feature="waf"} 0

The data is also shown when doing cscli machines list / cscli machines inspect:

$ ./cscli -c dev.yaml  machines list
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 Name  IP Address  Last Update           Status  Version                     OS            Auth Type  Last Heartbeat  Features
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 test  127.0.0.1   2026-10-20T10:20:10Z  ✔️       v1.8.1-dev-g137f62f0-dirty  ubuntu/26.04  password   25s             capi,lapi,log_processor
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

This is also pushed to the console as part of the usage metrics.

@github-actions

Copy link
Copy Markdown

@blotus: There are no 'kind' label on this PR. You need a 'kind' label to generate the release automatically.

  • /kind feature
  • /kind enhancement
  • /kind refactoring
  • /kind fix
  • /kind chore
  • /kind dependencies
Details

I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

@github-actions

Copy link
Copy Markdown

@blotus: There are no area labels on this PR. You can add as many areas as you see fit.

  • /area agent
  • /area local-api
  • /area cscli
  • /area appsec
  • /area security
  • /area configuration
Details

I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

@blotus

blotus commented Oct 20, 2026

Copy link
Copy Markdown
Member Author

/kind enhancement

@blotus blotus added this to the 1.8.2 milestone Oct 20, 2026
@github-actions github-actions Bot added kind/enhancement New feature or request and removed needs/kind labels Oct 20, 2026
@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.57143% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 71.82%. Comparing base (f64b626) to head (1c0304b).

Files with missing lines Patch % Lines
pkg/metrics/metrics.go 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #4770       +/-   ##
===========================================
+ Coverage   49.49%   71.82%   +22.33%     
===========================================
  Files         543      545        +2     
  Lines       37108    37163       +55     
===========================================
+ Hits        18365    26693     +8328     
+ Misses      18741    10469     -8272     
+ Partials        2        1        -1     
Flag Coverage Δ
bats 45.27% <78.57%> (?)
unit-linux 49.79% <68.57%> (+0.30%) ⬆️
unit-windows 37.80% <60.00%> (+0.32%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sabban sabban left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@blotus
blotus merged commit 725b665 into master Oct 21, 2026
16 of 17 checks passed
@blotus
blotus deleted the blotus/cs-features-metric branch October 21, 2026 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement New feature or request needs/area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants