What happened?
Im following the documentation here:
https://docs.crowdsec.net/docs/next/contributing/specs/bouncer_metrics_specs
to implement metrics for my remidiation component (bouncer)
https://github.com/Teifun2/cs-unifi-bouncer
In the Documentation it clearly states that one of the Metric Items to be sent should be
{
"name": "active_decisions",
"value": 342010
}
However when i try to do this over the UsageMetricsService Add Function i get the error below!
https://pkg.go.dev/github.com/crowdsecurity/crowdsec/pkg/apiclient#UsageMetricsService.Add
error code: 422,
body: validation failure list:\nremediation_components.0.metrics.0.items.1.unit in body is required
So the Server does not accept the Metric as it is described in the documentation!
As an additional gripe -> The Documentation is very unclear what values can be set as unit / name for these Metric Items. There seem to be certain "magic words" -> active_decisions. But its not clear if these are restricted or what exactly gets parsed.
What did you expect to happen?
The Example in the Documentation should be a valid request to the server!
How can we reproduce it (as minimally and precisely as possible)?
Use the Example Metrics Payload from here:
https://docs.crowdsec.net/docs/next/contributing/specs/bouncer_metrics_specs
To trigger a Metrics update of a remidiation component with the api Method here:
https://pkg.go.dev/github.com/crowdsecurity/crowdsec/pkg/apiclient#UsageMetricsService.Add
And the server will fail!
Anything else we need to know?
No response
Crowdsec version
Details
version: v1.7.7-981e6166
Codename: alphaga
BuildDate: 2026-04-01_13:14:30
GoVersion: 1.25.5
Platform: docker
libre2: C++
User-Agent: crowdsec/v1.7.7-981e6166-docker
Constraint_parser: >= 1.0, <= 3.0
Constraint_scenario: >= 1.0, <= 3.0
Constraint_api: v1
Constraint_acquis: >= 1.0, < 2.0
Built-in optional components: cscli_setup, datasource_appsec, datasource_cloudwatch, datasource_docker, datasource_file, datasource_http, datasource_journalctl, datasource_k8s-audit, datasource_kafka, datasource_kinesis, datasource_loki, datasource_s3, datasource_syslog, datasource_victorialogs, datasource_wineventlog, db_mysql, db_postgres, db_sqlite
OS version
Details
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here
# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
Enabled collections and parsers
Details
$ cscli hub list -o raw
# paste output here
Acquisition config
Details
# On Linux:
$ cat /etc/crowdsec/acquis.yaml /etc/crowdsec/acquis.d/*
# paste output here
# On Windows:
C:\> Get-Content C:\ProgramData\CrowdSec\config\acquis.yaml
# paste output here
Config show
Details
$ cscli config show
# paste output here
Prometheus metrics
Details
$ cscli metrics
# paste output here
Related custom configs versions (if applicable) : notification plugins, custom scenarios, parsers etc.
Details
What happened?
Im following the documentation here:
https://docs.crowdsec.net/docs/next/contributing/specs/bouncer_metrics_specs
to implement metrics for my remidiation component (bouncer)
https://github.com/Teifun2/cs-unifi-bouncer
In the Documentation it clearly states that one of the Metric Items to be sent should be
However when i try to do this over the UsageMetricsService Add Function i get the error below!
https://pkg.go.dev/github.com/crowdsecurity/crowdsec/pkg/apiclient#UsageMetricsService.Add
error code: 422,
body: validation failure list:\nremediation_components.0.metrics.0.items.1.unit in body is required
So the Server does not accept the Metric as it is described in the documentation!
As an additional gripe -> The Documentation is very unclear what values can be set as unit / name for these Metric Items. There seem to be certain "magic words" -> active_decisions. But its not clear if these are restricted or what exactly gets parsed.
What did you expect to happen?
The Example in the Documentation should be a valid request to the server!
How can we reproduce it (as minimally and precisely as possible)?
Use the Example Metrics Payload from here:
https://docs.crowdsec.net/docs/next/contributing/specs/bouncer_metrics_specs
To trigger a Metrics update of a remidiation component with the api Method here:
https://pkg.go.dev/github.com/crowdsecurity/crowdsec/pkg/apiclient#UsageMetricsService.Add
And the server will fail!
Anything else we need to know?
No response
Crowdsec version
Details
OS version
Details
Enabled collections and parsers
Details
Acquisition config
Details
Config show
Details
Prometheus metrics
Details
Related custom configs versions (if applicable) : notification plugins, custom scenarios, parsers etc.
Details