ZeroRez
ZeroRez

Reputation: 605

Prometheus scrape from Windows - invalid metric name/"INVALID" is not a valid start token

I've installed prometheus on my linux node. I have a go application on a Windows server that exports metrics from the app. The metric path for the Windows node is at /app/metrics. Note, the output of the metrics is in json format.

Here is my prometheus.yml:

scrape_configs:
  - job_name: 'prometheus_metrics'
    static_configs:
      - targets: ['localhost:9090']
  - job_name: 'node_exporter_metrics'
    static_configs:
      - targets: ['localhost:9100']
  - job_name: 'app-qa-1'
    metrics_path: /app/metrics
    scheme: http
    static_configs:
      - targets: ['app-qa-1:1701']

When I query the metrics and pass through the promtool I get:

error while linting: text format parsing error in line 1: invalid metric name

On my targets page I have this error for the Windows node:

"INVALID" is not a valid start token

And this is what the metrics from my Windows node look like:

"api.engine.gateway.50-percentile": 0,
"api.engine.gateway.75-percentile": 0,
"api.engine.gateway.95-percentile": 0,
"api.engine.gateway.99-percentile": 0,
"api.engine.gateway.999-percentile": 0,
"api.engine.gateway.count": 0,
"api.engine.gateway.fifteen-minute": 0,
"api.engine.gateway.five-minute": 0,

Upvotes: 0

Views: 1758

Answers (1)

DazWilkin
DazWilkin

Reputation: 40071

The app's metrics aren't in Prometheus' YAML-based Exposition format.

Your best bet is to determine whether the app can be configured to export Prometheus metrics (too).

If not, you're going to need either a proxy that sits between your Prometheus server and the app that, when scraped by Prometheus, calls the app's metrics' endpoint and transforms the results into Exposition format.

To my knowledge, there isn't a general-purpose transforming exporter that you can use. But this would be useful. You'd configure it with your endpoints and a transform function and it would do the work for you.

Or, you will need to write your own exporter for the app. But, if the current metric list is sufficient for your needs, that may be too much effort.

Upvotes: 1

Related Questions