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

feat(starknet_monitoring_endpoint): add metrics endpoint #2469

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

dan-starkware
Copy link
Collaborator

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link

github-actions bot commented Dec 5, 2024

Copy link

codecov bot commented Dec 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.40%. Comparing base (e3165c4) to head (d9e044c).
Report is 760 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2469       +/-   ##
===========================================
+ Coverage   40.10%   77.40%   +37.29%     
===========================================
  Files          26      387      +361     
  Lines        1895    41449    +39554     
  Branches     1895    41449    +39554     
===========================================
+ Hits          760    32083    +31323     
- Misses       1100     7083     +5983     
- Partials       35     2283     +2248     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@Itay-Tsabary-Starkware Itay-Tsabary-Starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 4 files reviewed, 3 unresolved discussions (waiting on @dan-starkware)


crates/starknet_monitoring_endpoint/src/monitoring_endpoint.rs line 101 at r1 (raw file):

        None => StatusCode::METHOD_NOT_ALLOWED.into_response(),
    }
}

Are we expected not to collect metrics at some point? IIUC this is turned on once, and we'll keep adding new relevant metrics as we go.
Could we avoid using Option here, and simply return handle.render().into_response()?

Code quote:

/// In case the node doesn’t collect metrics returns an empty response with status code 405: method
/// not allowed.
#[instrument(level = "debug", ret, skip(prometheus_handle))]
async fn metrics(prometheus_handle: Option<PrometheusHandle>) -> Response {
    match prometheus_handle {
        Some(handle) => handle.render().into_response(),
        None => StatusCode::METHOD_NOT_ALLOWED.into_response(),
    }
}

crates/starknet_monitoring_endpoint/src/monitoring_endpoint_test.rs line 51 at r1 (raw file):

#[tokio::test]
async fn test_ready() {

Could you please align the test names (with/without test_ prefix) within this module? I don't mind to which, just aiming for consistency.

Code quote:

async fn test_ready() {

crates/starknet_monitoring_endpoint/src/monitoring_endpoint_test.rs line 69 at r1 (raw file):

    absolute_counter!(metric_name, metric_value);

    let response = request_app(app, crate::monitoring_endpoint::METRICS).await;

Please import at top, and use METRICS here.

Code quote:

crate::monitoring_endpoint::METRICS

@dan-starkware
Copy link
Collaborator Author

crates/starknet_monitoring_endpoint/src/monitoring_endpoint_test.rs line 69 at r1 (raw file):

Previously, Itay-Tsabary-Starkware wrote…

Please import at top, and use METRICS here.

Done.

@dan-starkware
Copy link
Collaborator Author

crates/starknet_monitoring_endpoint/src/monitoring_endpoint_test.rs line 51 at r1 (raw file):

Previously, Itay-Tsabary-Starkware wrote…

Could you please align the test names (with/without test_ prefix) within this module? I don't mind to which, just aiming for consistency.

Done further up the stack

Copy link
Contributor

@Itay-Tsabary-Starkware Itay-Tsabary-Starkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 2 of 4 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @dan-starkware)


crates/starknet_monitoring_endpoint/src/monitoring_endpoint.rs line 101 at r1 (raw file):

Previously, Itay-Tsabary-Starkware wrote…

Are we expected not to collect metrics at some point? IIUC this is turned on once, and we'll keep adding new relevant metrics as we go.
Could we avoid using Option here, and simply return handle.render().into_response()?

Could you please add a todo on my name (tsabary) to handle the Option setup?
Changed to non-blocking

@dan-starkware dan-starkware force-pushed the dan/monitoring/metrics01 branch from 9786f69 to d9e044c Compare December 9, 2024 10:46
Copy link
Collaborator Author

@dan-starkware dan-starkware left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 4 files at r1, 1 of 2 files at r2, 2 of 2 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @dan-starkware)

@dan-starkware dan-starkware merged commit e602b3b into main Dec 9, 2024
22 checks passed
Copy link
Collaborator Author

Merge activity

  • Dec 9, 7:01 AM EST: A user merged this pull request with Graphite.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants