vector icon indicating copy to clipboard operation
vector copied to clipboard

Expose custom variables via internal metrics

Open johnhtodd opened this issue 8 months ago • 0 comments

A note for the community

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Use Cases

I set several environment values in each Vector instance, which then regulate various actions within VRL. For instance, I have a sample rate that is dependent on system available CPUs. In order to understand this variable currently when graphing data results out of Vector aggregations in Prometheus, I need to import these values via a third-party path (currently: node montitors with text file scrape.) It seems that this is a very roundabout way to get this data, when it should be in Vector's own Prometheus output. That way I have certainty that the data is correct and timely, and I can eliminate significant external tooling. These are static values, mostly based on environment variables that are customized to this exact instance of Vector but yet are different for every Vector instance we operate.

My use case is only Prometheus-based, but I can imagine others have more extensive uses for this type of data exposure.

Attempted Solutions

I have used node text scraper for this, but that requires additional tooling and scripts to double up my data.

Proposal

I would suggest that an option exist in the internal metrics to include arbitrary metrics defined once as part of the internal_metrics definition:

Partial contents of /etc/default/vector (environment variables):

# For this location, what is the sample rate used? 
VECTORPOPSAMPLERATE=20

Partial contents of vector.yml:

sources:
  my_source_id:
    type: internal_metrics
       custom:
          samplerate: "${VECTORPOPSAMPLERATE}"
          blah: 4.4

sinks:
  vector-prometheus:
    type: "prometheus_exporter"
    inputs: ["vector_metrics"]
    address: "[::]:9300"

Partial output of "curl http://127.0.0.1:9300":

# HELP vector_custom Vector custom values
# TYPE vector_custom gauge
vector_custom{host="dev01.ams",custom_tag="samplerate"} 20 1719601893267
vector_custom{host="dev01.ams",custom_tag="blah"} 4.4 1719601893267

References

No response

Version

vector 0.39.0 (x86_64-unknown-linux-gnu)

johnhtodd avatar Jun 28 '24 19:06 johnhtodd