I wrote a Spark application which I compile with maven and use spark-submit to run it. I wanted to monitor my application and collect metrics. Therefore, I used a Prometheus container, but I'm struggling with exposing a simple metric to it. I tried to follow the answer here. But I didn't understand what should I do with the spark.yml file.
- I have a Prometheus client that counts some stuff.
- I uncomment *.sink.jmx.class=org.apache.spark.metrics.sink.JmxSink in spark/conf/metrics.properties
- I added JMX Prometheus Javaagent to my pom.xml
This is my prometheus.yml:
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:9090']
- job_name: spark-master
static_configs:
- targets: ['spark-master:8082']
When I look at the targets in http://localhost:9090/targets I can see that Prometheus target is up and Spark is down