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 metrics for successful/failed Spark index creation #837

Merged
merged 14 commits into from
Nov 15, 2024

Conversation

Swiddis
Copy link
Contributor

@Swiddis Swiddis commented Oct 30, 2024

Description

Success and failure metrics for spark index creation -- note that "failure" here means an execution failure (e.g. Spark couldn't execute the query), not validation failure (e.g. the index already exists).

E.g. success for creating a skipping index:
image

Related Issues

N/A

Check List

  • Updated documentation (docs/ppl-lang/README.md)
  • Implemented unit tests
  • Implemented tests for combination with other commands
  • New added source code should include a copyright header
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Comment on lines 50 to 55
val result = doCreate(spark, metadata)
emitIndexCreationStatusMetric(metadata, success = true)
Some(result)
} catch {
case e: Exception =>
emitIndexCreationStatusMetric(metadata, success = false)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you double check if this is the right place? I recall this factory is actually deserializer from Flint metadata to index class. I guess you may want to intercept API call in FlintSpark? Also for all metrics related logic, please consider AOP style rather than insert this logic in many places.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved the metric collection to the new location. I experimented with trying something AOP-like but it was cumbersome -- linking the existing logic in spark/refresh introduces a circular dependency, and the callable implicitly raising Exception makes error handling awkward if trying to make a general-purpose duplicate of what exists on the Scala side.

@Swiddis Swiddis marked this pull request as draft November 7, 2024 18:41
@Swiddis Swiddis force-pushed the feature/index-metrics branch from f8f1624 to 7df59b8 Compare November 8, 2024 23:51
Signed-off-by: Simeon Widdis <[email protected]>
Signed-off-by: Simeon Widdis <[email protected]>
Signed-off-by: Simeon Widdis <[email protected]>
Signed-off-by: Simeon Widdis <[email protected]>
Signed-off-by: Simeon Widdis <[email protected]>
@Swiddis Swiddis marked this pull request as ready for review November 14, 2024 19:46
Signed-off-by: Simeon Widdis <[email protected]>
@ykmr1224 ykmr1224 merged commit 6f37b2d into opensearch-project:main Nov 15, 2024
4 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Nov 15, 2024
* Add index creation metrics

Signed-off-by: Simeon Widdis <[email protected]>

* Update emit metric function location

Signed-off-by: Simeon Widdis <[email protected]>

* Apply scalafmt

Signed-off-by: Simeon Widdis <[email protected]>

* revert FlintSparkIndexFactory metrics emission

Signed-off-by: Simeon Widdis <[email protected]>

* Update OS client to emit metrics

Signed-off-by: Simeon Widdis <[email protected]>

* Fix index kind detection

Signed-off-by: Simeon Widdis <[email protected]>

* Remove cumbersome with() method

Signed-off-by: Simeon Widdis <[email protected]>

* Revert the void change

Signed-off-by: Simeon Widdis <[email protected]>

* Make the code branchless

Signed-off-by: Simeon Widdis <[email protected]>

* Add default case to switches

Signed-off-by: Simeon Widdis <[email protected]>

* Apply PR feedback

Signed-off-by: Simeon Widdis <[email protected]>

---------

Signed-off-by: Simeon Widdis <[email protected]>
(cherry picked from commit 6f37b2d)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
ykmr1224 pushed a commit that referenced this pull request Nov 15, 2024
* Add index creation metrics



* Update emit metric function location



* Apply scalafmt



* revert FlintSparkIndexFactory metrics emission



* Update OS client to emit metrics



* Fix index kind detection



* Remove cumbersome with() method



* Revert the void change



* Make the code branchless



* Add default case to switches



* Apply PR feedback



---------


(cherry picked from commit 6f37b2d)

Signed-off-by: Simeon Widdis <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
kenrickyap pushed a commit to Bit-Quill/opensearch-spark that referenced this pull request Dec 11, 2024
…oject#837)

* Add index creation metrics

Signed-off-by: Simeon Widdis <[email protected]>

* Update emit metric function location

Signed-off-by: Simeon Widdis <[email protected]>

* Apply scalafmt

Signed-off-by: Simeon Widdis <[email protected]>

* revert FlintSparkIndexFactory metrics emission

Signed-off-by: Simeon Widdis <[email protected]>

* Update OS client to emit metrics

Signed-off-by: Simeon Widdis <[email protected]>

* Fix index kind detection

Signed-off-by: Simeon Widdis <[email protected]>

* Remove cumbersome with() method

Signed-off-by: Simeon Widdis <[email protected]>

* Revert the void change

Signed-off-by: Simeon Widdis <[email protected]>

* Make the code branchless

Signed-off-by: Simeon Widdis <[email protected]>

* Add default case to switches

Signed-off-by: Simeon Widdis <[email protected]>

* Apply PR feedback

Signed-off-by: Simeon Widdis <[email protected]>

---------

Signed-off-by: Simeon Widdis <[email protected]>
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.

4 participants