Graphite exporter mapping regex difficulties

1/20/2020

I am running a standalone Apache Spark cluster in a Kubernetes environment.

There is a need to export metrics to Prometheus and then finally display them in Grafana.

I found that installing a Graphite exporter was the simplest solution to do this since I am experiencing some trouble with getting all Spark metrics while only using the JMX exporter.

The thing I am having trouble with is to create mappings from graphite output to output that is parsable by prometheus templating.

For instance, I want to be able to parse

app_20200120105608_0736_0_executor_threadpool_completeTasks

so that it matches to something similar to this:

- match: '*.*.threadpool.*.*'
  name: app_data
  labels:
    application: $1 // app_20200120105608_0736
    executor_id: $2 // 0
    type: $3 // threadpool
    qty: $4 // completeTasks

I am not convinced that this will be the best solution overall so any other suggestions are welcome (For instance how this could be done in a proper way with using a JMX exporter only while also getting Spark app data.)

-- toerq
apache-spark
graphite
kubernetes
prometheus
regex

1 Answer

1/20/2020

If I understand correctly you try to build something like Spark -> Graphite -> Prometheus -> Grafana. Avoid to do that since Graphite adds overhead to your monitoring system.

You have several options available:

  • Query Graphite directly from Grafana with Graphite data source
  • Setup Jmx Exporter properly. You can refer the discussion to get the idea on how to do it with jmx-exporter. Also I can help you to deal with the errors you have if you share the problems you have with it.
  • Setup Prometheus Push Gateway and the corresponding Spark Prometheus sink. Note that this solution is advised for short running jobs. If you have long running jobs the Jmx Exporter is preferable.

Hope it helps.

-- Aliaksandr Sasnouskikh
Source: StackOverflow