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

Enable configuring Prometheus metrics port for local runs #377

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 14 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion agent/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "agent"
version = "0.6.15"
version = "0.6.16"
authors = ["Kate Goldenring <kate.goldenring@microsoft.com>", "<bfjelds@microsoft.com>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion controller/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "controller"
version = "0.6.15"
version = "0.6.16"
authors = ["<bfjelds@microsoft.com>"]
edition = "2018"

Expand Down
4 changes: 2 additions & 2 deletions deployment/helm/Chart.yaml
Expand Up @@ -15,9 +15,9 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.6.15
version: 0.6.16

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 0.6.15
appVersion: 0.6.16
@@ -1,6 +1,6 @@
[package]
name = "debug-echo-discovery-handler"
version = "0.6.15"
version = "0.6.16"
authors = ["Kate Goldenring <kate.goldenring@microsoft.com>"]
edition = "2018"

Expand Down
@@ -1,6 +1,6 @@
[package]
name = "onvif-discovery-handler"
version = "0.6.15"
version = "0.6.16"
authors = ["Kate Goldenring <kate.goldenring@microsoft.com>"]
edition = "2018"

Expand Down
@@ -1,6 +1,6 @@
[package]
name = "opcua-discovery-handler"
version = "0.6.15"
version = "0.6.16"
authors = ["Kate Goldenring <kate.goldenring@microsoft.com>"]
edition = "2018"

Expand Down
@@ -1,6 +1,6 @@
[package]
name = "udev-discovery-handler"
version = "0.6.15"
version = "0.6.16"
authors = ["Kate Goldenring <kate.goldenring@microsoft.com>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion discovery-handlers/debug-echo/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "akri-debug-echo"
version = "0.6.15"
version = "0.6.16"
authors = ["Kate Goldenring <kate.goldenring@microsoft.com>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion discovery-handlers/onvif/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "akri-onvif"
version = "0.6.15"
version = "0.6.16"
authors = ["Kate Goldenring <kate.goldenring@microsoft.com>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion discovery-handlers/opcua/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "akri-opcua"
version = "0.6.15"
version = "0.6.16"
authors = ["Kate Goldenring <kate.goldenring@microsoft.com>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion discovery-handlers/udev/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "akri-udev"
version = "0.6.15"
version = "0.6.16"
authors = ["Kate Goldenring <kate.goldenring@microsoft.com>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion discovery-utils/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "akri-discovery-utils"
version = "0.6.15"
version = "0.6.16"
authors = ["Kate Goldenring <kate.goldenring@microsoft.com>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion samples/brokers/udev-video-broker/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "udev-video-broker"
version = "0.6.15"
version = "0.6.16"
authors = ["Kate Goldenring <kate.goldenring@microsoft.com>", "<bfjelds@microsoft.com>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion shared/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "akri-shared"
version = "0.6.15"
version = "0.6.16"
authors = ["<bfjelds@microsoft.com>"]
edition = "2018"

Expand Down
11 changes: 9 additions & 2 deletions shared/src/akri/metrics.rs
Expand Up @@ -2,6 +2,9 @@ use log::info;
use prometheus::Encoder;
use warp::{Filter, Rejection, Reply};

/// Environment variable name for setting metrics port
const METRICS_PORT_LABEL: &str = "METRICS_PORT";

/// Reports an Akri component's latest custom Prometheus metrics along with
/// process metrics such as process_cpu_seconds_total, process_open_fds, etc, which are added by
/// default to the default Prometheus registry.
Expand All @@ -21,8 +24,12 @@ async fn metrics_handler() -> Result<impl Reply, Rejection> {
/// Serves prometheus metrics over a web service at /metrics
pub async fn run_metrics_server() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>>
{
info!("starting metrics server on port 8080 at /metrics");
let port = match std::env::var(METRICS_PORT_LABEL) {
Ok(p) => p.parse::<u16>()?,
Err(_) => 8080,
};
info!("starting metrics server on port {} at /metrics", port);
let metrics_route = warp::path!("metrics").and_then(metrics_handler);
warp::serve(metrics_route).run(([0, 0, 0, 0], 8080)).await;
warp::serve(metrics_route).run(([0, 0, 0, 0], port)).await;
Ok(())
}
2 changes: 1 addition & 1 deletion version.txt
@@ -1 +1 @@
0.6.15
0.6.16
2 changes: 1 addition & 1 deletion webhooks/validating/configuration/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "webhook-configuration"
version = "0.6.15"
version = "0.6.16"
authors = ["DazWilkin <daz.wilkin@gmail.com>"]
edition = "2018"

Expand Down