Skip to content

Commit

Permalink
penumbra: use [email protected] (#5006)
Browse files Browse the repository at this point in the history
## Describe your changes

Depends on penumbra-zone/cnidarium#9, let's just
merge it once the release gets tagged and published. CI won't pass until
then.


## Issue ticket number and link

Fix #5004 

## Checklist before requesting a review

- [x] I have added guiding text to explain how a reviewer should test
these changes.
Check `localhost:9000`

- [x] If this code contains consensus-breaking changes, I have added the
"consensus-breaking" label. Otherwise, I declare my belief that there
are not consensus-breaking changes, for the following reason:

  > metrics bug fix

---------

Co-authored-by: Conor Schaefer <[email protected]>
  • Loading branch information
erwanor and conorsch authored Jan 27, 2025
1 parent 8463d63 commit 49843f7
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 28 deletions.
16 changes: 3 additions & 13 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ camino = { version = "1" }
chacha20poly1305 = { version = "0.9.0" }
chrono = { default-features = false, version = "0.4" }
clap = { version = "3.2" }
cnidarium = { version = "0.82.1", default-features = false}
cnidarium = { version = "0.83", default-features = false}
cnidarium-component = { default-features = false, version = "1.0.0", path = "crates/cnidarium-component" }
cometindex = { version = "1.0.0", path = "crates/util/cometindex" }
criterion = { version = "0.4" }
Expand Down
1 change: 1 addition & 0 deletions crates/bin/pd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,4 @@ penumbra-sdk-proof-params = { workspace = true, features = [
assert_cmd = { workspace = true }
predicates = "2.1"
prost-reflect = "0.14.3"
regex = { workspace = true }
37 changes: 37 additions & 0 deletions crates/bin/pd/tests/network_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,45 @@ use http::StatusCode;
use penumbra_sdk_proto::FILE_DESCRIPTOR_SET;
use predicates::prelude::*;
use prost_reflect::{DescriptorPool, ServiceDescriptor};
use regex::Regex;
use url::Url;

/// Specific patterns for spot-checking the metrics emitted by pd.
/// It's a smattering of metrics from the various components, including
/// some from outside the workspace, e.g. `cnidarium`.
const PD_METRICS_PATTERNS: &[&str] = &[
r"^cnidarium_get_raw_duration_seconds_count_seconds \d+",
r"^cnidarium_nonverifiable_get_raw_duration_seconds_count_seconds \d+",
r"^pd_async_sleep_drift_microseconds \d+",
r"^penumbra_funding_streams_total_processing_time_milliseconds_count_milliseconds \d+",
r"^penumbra_dex_path_search_duration_seconds_count_seconds \d+",
];

#[ignore]
#[tokio::test]
/// Confirm that prometheus metrics are being exported for scraping.
/// Several times while bumping related crates we've missed a breakage
/// to metrics, and only noticed when we checked the grafana boards
/// for the preview environment post-deploy.
async fn confirm_metrics_emission() -> anyhow::Result<()> {
let client = reqwest::Client::new();
let metrics_url = std::env::var("PENUMBRA_NODE_PD_METRICS_URL")
.unwrap_or("http://localhost:9000/metrics".to_string());
let r = client.get(metrics_url).send().await?;
let status = r.status();
let body = r.text().await?;
// Assert 200
assert_eq!(status, StatusCode::OK);

// Check specific metrics in the combined output
for pattern in PD_METRICS_PATTERNS {
// Enable multi-line support in the regex matching.
let re = Regex::new(&format!(r"(?m){}", pattern))?;
assert!(re.is_match(&body), "pd metric missing: {}", pattern);
}
Ok(())
}

#[ignore]
#[tokio::test]
/// Confirm that permissive CORS headers are returned in HTTP responses
Expand Down
35 changes: 21 additions & 14 deletions deployments/compose/process-compose-smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,12 @@ processes:
pd:
condition: process_healthy

# Run `pd` integration tests.
test-pd:
command: >-
cargo test --release --package pd -- --ignored --test-threads 1 --nocapture
depends_on:
pd:
condition: process_healthy
cometbft:
condition: process_started
availability:
restart: exit_on_failure

# The order of the integration tests is (unfortunately) important:
#
# 1. First up are the pclientd tests, because
# 2. The pcli tests assume the pclientd tests have been run first
# 3. Finally, we run the pd tests, which need work to have been performed for metrics to be emitted.
#
# Run `pclientd` integration tests.
test-pclientd:
command: >-
Expand All @@ -88,8 +82,6 @@ processes:
condition: process_healthy
cometbft:
condition: process_started
test-pd:
condition: process_completed
availability:
restart: exit_on_failure

Expand All @@ -109,6 +101,21 @@ processes:
availability:
restart: exit_on_failure

# Run `pd` integration tests. These run last, as the metrics checks
# will be empty unless actual work has been performed.
test-pd:
command: >-
cargo test --release --package pd -- --ignored --test-threads 1 --nocapture
depends_on:
pd:
condition: process_healthy
cometbft:
condition: process_started
test-pcli:
condition: process_completed
availability:
restart: exit_on_failure

# Finalizer task, which will wait until all test suites have finished.
# This allows us to ensure that.
summary:
Expand Down

0 comments on commit 49843f7

Please sign in to comment.