vectordotdev / vector

A high-performance observability data pipeline.
https://vector.dev
Mozilla Public License 2.0
17k stars 1.47k forks source link

Support Prometheus StateSet and Info metrics #20621

Open aliaqel-stripe opened 1 month ago

aliaqel-stripe commented 1 month ago

A note for the community

Use Cases

We want to scrape metrics from kube-state-metrics for custom resources and a certain kind of metric requires the implementation to be a StateSet. Unfortunately, we ran into lack of support for StateSet metrics in an older version of Vector and it appears it's not supported in a newer release either. I see references to the type in proto but no actual support for scraping.

Here's an example of a metric generated by kube-state-metrics that we want to use Stateset with https://github.com/kubernetes/kube-state-metrics/issues/2070#issuecomment-1823134570

Attempted Solutions

No response

Proposal

No response

References

https://github.com/kubernetes/kube-state-metrics/issues/2070#issuecomment-1823134570

Version

0.30.0

jszwedko commented 1 month ago

Hi @aliaqel-stripe ,

I think I'm missing some context here (maybe due to my lack of familiarity with Kubernetes). What is the change to Vector that you are asking for exactly?

aliaqel-stripe commented 1 month ago

Hi @jszwedko!

Sorry about lack of clarity. The change I'm asking is that scraping of these types of metrics is implemented. I see that vector is aware of these types of metrics but when the metrics are served on a prometheus metrics endpoint,, vector does not know what to do with them

2024-06-06T15:01:06.534735Z ERROR source{component_kind="source" component_id=kube-state-metrics component_type=prometheus_scrape component_name=kube-state-metrics}: vector::internal_events::prometheus: Parsing error. url=http://127.0.0.1:8088/metrics error=WithLine { line: "# TYPE kube_customresource_scaledobject_status_condition stateset", kind: InvalidMetricKind { input: "stateset" } } error_type="parser_failed" stage="processing" internal_log_rate_limit=true
aliaqel-stripe commented 1 month ago

Not necessarily a kubernetes specific thing, but StateSet a metric type in OpenMetrics (https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#stateset)

For reference, this is how OpenTelemetry handles conversions of StateSets to their type of metrics https://opentelemetry.io/docs/specs/otel/compatibility/prometheus_and_openmetrics/#stateset

jszwedko commented 1 month ago

Ah, I see, it is a different metric type. Thanks for the additional context. This would be an enhancement to our metrics data model (likely) and then the Prometheus text parser.