diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d96f3ec..7ff1b903 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,9 @@ jobs: # Build the crate using the other optional features - run: cargo build --features=metrics-0_21,custom-objective-percentile,custom-objective-latency + # Install protoc for the examples + - uses: arduino/setup-protoc@v3 + # Compile the examples - run: cargo build --package example-actix-web - run: cargo build --package example-axum @@ -42,6 +45,7 @@ jobs: - run: cargo build --package example-exemplars-tracing - run: cargo build --package example-exemplars-tracing-opentelemetry - run: cargo build --package example-full-api + - run: cargo build --package example-grpc-http - run: cargo build --package example-opentelemetry-push diff --git a/examples/grpc-http/Cargo.toml b/examples/grpc-http/Cargo.toml index 7eaa4213..3849f930 100644 --- a/examples/grpc-http/Cargo.toml +++ b/examples/grpc-http/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "grpc-http" +name = "example-grpc-http" version = "0.0.0" publish = false edition = "2021" diff --git a/examples/grpc-http/src/main.rs b/examples/grpc-http/src/main.rs index 872594ca..f1b0a47c 100644 --- a/examples/grpc-http/src/main.rs +++ b/examples/grpc-http/src/main.rs @@ -1,6 +1,7 @@ use std::net::SocketAddr; use tonic::transport::Server as TonicServer; use warp::Filter; +use warp::http::StatusCode; use autometrics::prometheus_exporter; use server::MyJobRunner; @@ -52,7 +53,7 @@ async fn main() -> Result<(), Box> { // Build http /metrics endpoint let routes = warp::get() .and(warp::path("metrics")) - .map(|| prometheus_exporter::encode_http_response()); + .map(|| prometheus_exporter::encode_to_string().map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)); // Build http web server let (_, web_server) =