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

Metric tap agent #161

Merged
merged 10 commits into from May 13, 2024
Merged

Metric tap agent #161

merged 10 commits into from May 13, 2024

Conversation

carlosvdr
Copy link
Contributor

@carlosvdr carlosvdr commented May 6, 2024

fixes #156

@carlosvdr carlosvdr self-assigned this May 6, 2024
Copy link

github-actions bot commented May 6, 2024

Pull Request Test Coverage Report for Build 9067937779

Details

  • 69 of 120 (57.5%) changed or added relevant lines in 5 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.2%) to 66.837%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tap-agent/src/config.rs 0 2 0.0%
tap-agent/src/main.rs 0 3 0.0%
tap-agent/src/agent/sender_allocation.rs 60 66 90.91%
tap-agent/src/metrics.rs 0 40 0.0%
Files with Coverage Reduction New Missed Lines %
common/src/tap/checks/deny_list_check.rs 1 93.64%
Totals Coverage Status
Change from base Build 8932557105: -0.2%
Covered Lines: 3406
Relevant Lines: 5096

💛 - Coveralls

@carlosvdr carlosvdr linked an issue May 7, 2024 that may be closed by this pull request
@carlosvdr carlosvdr marked this pull request as draft May 7, 2024 17:06
@carlosvdr carlosvdr marked this pull request as ready for review May 9, 2024 17:03
tap-agent/Cargo.toml Outdated Show resolved Hide resolved
tap-agent/src/agent/sender_accounts_manager.rs Outdated Show resolved Hide resolved
tap-agent/src/agent/sender_accounts_manager.rs Outdated Show resolved Hide resolved
tap-agent/src/agent/sender_allocation.rs Outdated Show resolved Hide resolved
tap-agent/src/agent/sender_allocation.rs Outdated Show resolved Hide resolved
tap-agent/src/agent/sender_allocation.rs Outdated Show resolved Hide resolved
tap-agent/src/agent/sender_allocation.rs Outdated Show resolved Hide resolved
tap-agent/src/agent/sender_allocation.rs Outdated Show resolved Hide resolved
tap-agent/src/agent/sender_allocation.rs Outdated Show resolved Hide resolved
tap-agent/src/agent/sender_allocation.rs Show resolved Hide resolved
@carlosvdr carlosvdr requested a review from gusinacio May 9, 2024 21:25
@@ -34,7 +34,8 @@ async fn _run_server(port: u16) {
.route("/metrics", get(handler_metrics))
.fallback(handler_404);
let addr = SocketAddr::from(([0, 0, 0, 0], port));
let server = Server::bind(&addr).serve(app.into_make_service());
let listener = tokio::net::TcpListener::bind(addr).await.unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

use expect instead of unwrap and add information: "Failed to bind metrics address"


use axum::{http::StatusCode, response::IntoResponse, routing::get, Router};
use futures_util::FutureExt;
use jsonrpsee::tracing::error;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm I can't remember why I used jsonrpsee::tracing::error here https://github.com/semiotic-ai/timeline-aggregation-protocol/blob/c179dfedee1ed8078b358de3d35f4d051f74c9c1/tap_aggregator/src/metrics.rs#L8
But in any case, it should look less weird with tracing::error instead.


lazy_static! {
static ref RAVS_PER_SENDER_ALLOCATION: CounterVec = register_counter_vec!(
format!("ravs_created_per_sender_allocation"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Inconsistent with other labels. Sometimes you use sender_x_allocation and sometimes sender_allocation. Just pick either one and use it everywhere

Comment on lines 60 to 66
lazy_static! {
static ref CLOSED_ALLOCATIONS: Counter = register_counter!(
format!("amount_of_closed_allocations"),
"allocations closed",
)
.unwrap();
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd be more specific as to what this is counting:

Suggested change
lazy_static! {
static ref CLOSED_ALLOCATIONS: Counter = register_counter!(
format!("amount_of_closed_allocations"),
"allocations closed",
)
.unwrap();
}
lazy_static! {
static ref CLOSED_SENDER_ALLOCATIONS: Counter = register_counter!(
format!("closed_sender_allocation_total"),
"Total count of sender-allocation managers closed.",
)
.unwrap();
}

Comment on lines 55 to 58
lazy_static! {
static ref RAV_VALUE: GaugeVec =
register_gauge_vec!(format!("rav_value"), "RAV Updated value", &["allocation"]).unwrap();
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's missing the sender label.

Suggested change
lazy_static! {
static ref RAV_VALUE: GaugeVec =
register_gauge_vec!(format!("rav_value"), "RAV Updated value", &["allocation"]).unwrap();
}
lazy_static! {
static ref RAV_VALUE: GaugeVec =
register_gauge_vec!(format!("rav_value"), "Value of the last RAV per sender-allocation", &["sender", "allocation"]).unwrap();
}

gusinacio
gusinacio previously approved these changes May 10, 2024
Copy link
Contributor

@gusinacio gusinacio left a comment

Choose a reason for hiding this comment

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

LGTM

@carlosvdr carlosvdr requested a review from aasseman May 10, 2024 16:47
Copy link
Collaborator

@aasseman aasseman left a comment

Choose a reason for hiding this comment

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

Suggestion about naming I thought of just now.
I think that we can use shorter names, for ex ravs_created_per_sender_allocation can be ravs_created, since we use the labels sender and allocation with it anyways.

@aasseman aasseman merged commit 0448467 into main May 13, 2024
8 checks passed
@aasseman aasseman deleted the metric-tap-agent branch May 13, 2024 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat.Req] Add prometheus metrics to tap-agent
3 participants