Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add an example of using prometheus servlet #2403

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nabuskey
Copy link

@nabuskey nabuskey commented Jan 24, 2025

Purpose of this PR

Proposed changes:

  • Adds an example of using prometheus servlet natively available in spark.

Change Category

  • Bugfix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that could affect existing functionality)
  • Documentation update

Rationale

Checklist

  • I have conducted a self-review of my own code.
  • I have updated documentation accordingly.
  • I have added tests that prove my changes are effective or that my feature works.
  • Existing unit tests pass locally with my changes.

Additional Notes

You can do something like this to verify.

$ kubectl port-forward pod/spark-pi-python-driver 3000:4040
$ curl localhost:3000/metrics/executors/prometheus
spark_info{version="3.5.3", revision="32232e9ed33bb16b93ad58cfde8b82e0f07c0970"} 1.0
metrics_executor_rddBlocks{application_id="spark-c8519a1215934adba443bc7cd1108a1c", application_name="PythonPi", executor_id="driver"} 0
metrics_executor_memoryUsed_bytes{application_id="spark-c8519a1215934adba443bc7cd1108a1c", application_name="PythonPi", executor_id="driver"} 8959
metrics_executor_diskUsed_bytes{application_id="spark-c8519a1215934adba443bc7cd1108a1c", application_name="PythonPi", executor_id="driver"} 0
metrics_executor_totalCores{application_id="spark-c8519a1215934adba443bc7cd1108a1c", application_name="PythonPi", executor_id="driver"} 0
metrics_executor_maxTasks{application_id="spark-c8519a1215934adba443bc7cd1108a1c", application_name="PythonPi", executor_id="driver"} 0

fixes: #2381

Copy link
Contributor

@vara-bonthu vara-bonthu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this example.

mainApplicationFile: local:///opt/spark/examples/src/main/python/pi.py
sparkVersion: 3.5.3
sparkConf:
# Expose Spark metrics for Prometheus
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem like you need to them. I added annotations for Prometheus though.

Signed-off-by: Manabu McCloskey <[email protected]>
Copy link
Contributor

@vara-bonthu vara-bonthu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vara-bonthu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an example of using PrometheusServlet for monitoring
2 participants