-
Notifications
You must be signed in to change notification settings - Fork 50
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: add Tokenserver metrics #1200
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -224,7 +224,11 @@ macro_rules! build_app_without_syncstorage { | |
impl Server { | ||
pub async fn with_settings(settings: Settings) -> Result<dev::Server, ApiError> { | ||
let settings_copy = settings.clone(); | ||
let metrics = metrics::metrics_from_opts(&settings)?; | ||
let metrics = metrics::metrics_from_opts( | ||
settings.statsd_label.clone(), | ||
settings.statsd_host.clone(), | ||
settings.statsd_port, | ||
)?; | ||
let host = settings.host.clone(); | ||
let port = settings.port; | ||
let db_pool = pool_from_settings(&settings, &Metrics::from(&metrics)).await?; | ||
|
@@ -241,7 +245,11 @@ impl Server { | |
let tokenserver_state = if settings.tokenserver.enabled { | ||
Some(tokenserver::ServerState::from_settings( | ||
&settings.tokenserver, | ||
metrics.clone(), | ||
metrics::metrics_from_opts( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tokenserver will have its own separate metrics client -- is that okay? It seems like it shouldn't be a problem to me, but I wanted to double-check There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea, it's not a big deal for now. |
||
settings.tokenserver.statsd_label.clone(), | ||
settings.statsd_host, | ||
settings.statsd_port, | ||
)?, | ||
)?) | ||
} else { | ||
None | ||
|
@@ -287,9 +295,14 @@ impl Server { | |
let host = settings.host.clone(); | ||
let port = settings.port; | ||
let secrets = Arc::new(settings.master_secret.clone()); | ||
let metrics = metrics::metrics_from_opts(&settings)?; | ||
let tokenserver_state = | ||
tokenserver::ServerState::from_settings(&settings.tokenserver, metrics)?; | ||
let tokenserver_state = tokenserver::ServerState::from_settings( | ||
&settings.tokenserver, | ||
metrics::metrics_from_opts( | ||
settings.tokenserver.statsd_label.clone(), | ||
settings.statsd_host, | ||
settings.statsd_port, | ||
)?, | ||
)?; | ||
let server = HttpServer::new(move || { | ||
build_app_without_syncstorage!( | ||
Some(tokenserver_state.clone()), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not terribly important but this could take references instead.
Option::as_deref
can easily give you anOption<&str>
from the host fieldOption<String>
(as_ref
doesn't)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch!