<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Azure Databricks Metrics to Prometheus? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/azure-databricks-metrics-to-prometheus/m-p/71633#M34362</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/106165"&gt;@Shahe&lt;/a&gt;&amp;nbsp;how are you?&lt;/P&gt;
&lt;P&gt;The standard way of doing so is to first configure your spark to enable Prometheus using:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;spark.ui.prometheus.enabled true
spark.metrics.namespace &amp;lt;app_name&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;We recommend replacing &amp;lt;app_name&amp;gt; with job names for job clusters.&lt;/P&gt;
&lt;P&gt;Then, create an init script and attach to the cluster&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;dbutils.fs.put("dbfs:/dlyle/install-prometheus.sh",
"""
#!/bin/bash
cat &amp;lt;&amp;lt;EOF &amp;gt; /databricks/spark/conf/metrics.properties
*.sink.prometheusServlet.class=org.apache.spark.metrics.sink.PrometheusServlet
*.sink.prometheusServlet.path=/metrics/prometheus
master.sink.prometheusServlet.path=/metrics/master/prometheus
applications.sink.prometheusServlet.path=/metrics/applications/prometheus
EOF
cat &amp;gt;/databricks/driver/conf/00-custom-spark.conf &amp;lt;&amp;lt;EOF
[driver] {  
  spark.sql.streaming.metricsEnabled = "true"
  spark.metrics.appStatusSource.enabled = "true"
}
EOF
""", True)&lt;/LI-CODE&gt;
&lt;P&gt;Confirm the driver port by running:&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;spark.conf.get("spark.ui.port")&lt;/LI-CODE&gt;
&lt;P&gt;Make a note of the driver port. You'll need this when setting up the scrape target.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;
&lt;P&gt;Generate a personal access token as shown&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://docs.databricks.com/dev-tools/api/latest/authentication.html#generate-a-personal-access-token" target="_blank" rel="noopener noreferrer"&gt;here&lt;/A&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Add the following to your prometheus_values.yaml&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;LI-CODE lang="markup"&gt;extraScrapeConfigs: |
   - job_name: '&amp;lt;cluster_name&amp;gt;'
     metrics_path: /driver-proxy-api/o/0/&amp;lt;cluster_id&amp;gt;/&amp;lt;spark_ui_port&amp;gt;/metrics/prometheus/
     static_configs:
       - targets:
         - &amp;lt;workspace_url&amp;gt;
     authorization:
     # Sets the authentication type of the request.
       type: Bearer
       credentials: &amp;lt;personal access token&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;Update your helm installation:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;helm upgrade &amp;lt;installation_name - i.e. dlyle-prometheus&amp;gt; -f prometheus_values.yaml -n &amp;lt;namespace - i.e. prometheus-monitoring&amp;gt; --create-namespace prometheus-community/prometheus&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;&lt;/CODE&gt;Prometheus server has a sidecar container that&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;should&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;automatically update the config. You can also force a restart:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;kubectl rollout restart deployment &amp;lt;installation_name&amp;gt; -n &amp;lt;namespace&amp;gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;At this point, you should be able to see your cluster as a scrape target in Prometheus server.&lt;/P&gt;
&lt;P&gt;Follow this link for more refference:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.databricks.com/en/machine-learning/model-serving/metrics-export-serving-endpoint.html" target="_blank"&gt;https://docs.databricks.com/en/machine-learning/model-serving/metrics-export-serving-endpoint.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Jun 2024 15:46:06 GMT</pubDate>
    <dc:creator>anardinelli</dc:creator>
    <dc:date>2024-06-04T15:46:06Z</dc:date>
    <item>
      <title>Azure Databricks Metrics to Prometheus?</title>
      <link>https://community.databricks.com/t5/data-engineering/azure-databricks-metrics-to-prometheus/m-p/71569#M34346</link>
      <description>&lt;P&gt;What is the best method to expose Azure Databricks metrics to Prometheus specifically? And is it possible to get the underlying Spark metrics also? All I can see clearly defined in the documentation is the serving endpoint metrics:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/databricks/machine-learning/model-serving/metrics-export-serving-endpoint" target="_blank"&gt;https://learn.microsoft.com/en-us/azure/databricks/machine-learning/model-serving/metrics-export-serving-endpoint&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Please advise, thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2024 08:43:20 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/azure-databricks-metrics-to-prometheus/m-p/71569#M34346</guid>
      <dc:creator>Shahe</dc:creator>
      <dc:date>2024-06-04T08:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: Azure Databricks Metrics to Prometheus?</title>
      <link>https://community.databricks.com/t5/data-engineering/azure-databricks-metrics-to-prometheus/m-p/71633#M34362</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/106165"&gt;@Shahe&lt;/a&gt;&amp;nbsp;how are you?&lt;/P&gt;
&lt;P&gt;The standard way of doing so is to first configure your spark to enable Prometheus using:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;spark.ui.prometheus.enabled true
spark.metrics.namespace &amp;lt;app_name&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;We recommend replacing &amp;lt;app_name&amp;gt; with job names for job clusters.&lt;/P&gt;
&lt;P&gt;Then, create an init script and attach to the cluster&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;dbutils.fs.put("dbfs:/dlyle/install-prometheus.sh",
"""
#!/bin/bash
cat &amp;lt;&amp;lt;EOF &amp;gt; /databricks/spark/conf/metrics.properties
*.sink.prometheusServlet.class=org.apache.spark.metrics.sink.PrometheusServlet
*.sink.prometheusServlet.path=/metrics/prometheus
master.sink.prometheusServlet.path=/metrics/master/prometheus
applications.sink.prometheusServlet.path=/metrics/applications/prometheus
EOF
cat &amp;gt;/databricks/driver/conf/00-custom-spark.conf &amp;lt;&amp;lt;EOF
[driver] {  
  spark.sql.streaming.metricsEnabled = "true"
  spark.metrics.appStatusSource.enabled = "true"
}
EOF
""", True)&lt;/LI-CODE&gt;
&lt;P&gt;Confirm the driver port by running:&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;spark.conf.get("spark.ui.port")&lt;/LI-CODE&gt;
&lt;P&gt;Make a note of the driver port. You'll need this when setting up the scrape target.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;
&lt;P&gt;Generate a personal access token as shown&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://docs.databricks.com/dev-tools/api/latest/authentication.html#generate-a-personal-access-token" target="_blank" rel="noopener noreferrer"&gt;here&lt;/A&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Add the following to your prometheus_values.yaml&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;LI-CODE lang="markup"&gt;extraScrapeConfigs: |
   - job_name: '&amp;lt;cluster_name&amp;gt;'
     metrics_path: /driver-proxy-api/o/0/&amp;lt;cluster_id&amp;gt;/&amp;lt;spark_ui_port&amp;gt;/metrics/prometheus/
     static_configs:
       - targets:
         - &amp;lt;workspace_url&amp;gt;
     authorization:
     # Sets the authentication type of the request.
       type: Bearer
       credentials: &amp;lt;personal access token&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;Update your helm installation:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;helm upgrade &amp;lt;installation_name - i.e. dlyle-prometheus&amp;gt; -f prometheus_values.yaml -n &amp;lt;namespace - i.e. prometheus-monitoring&amp;gt; --create-namespace prometheus-community/prometheus&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;&lt;/CODE&gt;Prometheus server has a sidecar container that&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;should&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;automatically update the config. You can also force a restart:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;kubectl rollout restart deployment &amp;lt;installation_name&amp;gt; -n &amp;lt;namespace&amp;gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;At this point, you should be able to see your cluster as a scrape target in Prometheus server.&lt;/P&gt;
&lt;P&gt;Follow this link for more refference:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.databricks.com/en/machine-learning/model-serving/metrics-export-serving-endpoint.html" target="_blank"&gt;https://docs.databricks.com/en/machine-learning/model-serving/metrics-export-serving-endpoint.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2024 15:46:06 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/azure-databricks-metrics-to-prometheus/m-p/71633#M34362</guid>
      <dc:creator>anardinelli</dc:creator>
      <dc:date>2024-06-04T15:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: Azure Databricks Metrics to Prometheus?</title>
      <link>https://community.databricks.com/t5/data-engineering/azure-databricks-metrics-to-prometheus/m-p/73239#M34642</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I don't have databricks running as pod in an aks cluster.. It's working on azure as saas.. What should I do the export the metrics to prometheus?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 20:48:34 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/azure-databricks-metrics-to-prometheus/m-p/73239#M34642</guid>
      <dc:creator>DanielB</dc:creator>
      <dc:date>2024-06-12T20:48:34Z</dc:date>
    </item>
  </channel>
</rss>

