Skip to content

Commit d8d3a8a

Browse files
committed
[feldera-types] Implement some traits for multihost samply profiles.
Signed-off-by: Ben Pfaff <blp@feldera.com>
1 parent 8e8a138 commit d8d3a8a

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

crates/feldera-types/src/query_params.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Types for the query parameters of the pipeline endpoints.
22
3-
use serde::Deserialize;
3+
use serde::{Deserialize, Serialize};
44
use utoipa::{IntoParams, ToSchema};
55

66
use crate::runtime_status::RuntimeDesiredStatus;
@@ -42,23 +42,25 @@ impl Default for ActivateParams {
4242
}
4343
}
4444

45-
#[derive(Debug, Deserialize, IntoParams, ToSchema)]
45+
#[derive(Debug, Deserialize, Serialize, IntoParams, ToSchema)]
46+
#[serde(default)]
4647
pub struct SamplyProfileParams {
47-
#[serde(default = "default_samply_profile_duration")]
4848
pub duration_secs: u64,
4949
}
5050

51-
/// Default for the `duration_secs` query parameter when POST a pipeline samply profile.
52-
fn default_samply_profile_duration() -> u64 {
53-
30
51+
/// Default query parameters for POST of a pipeline samply profile.
52+
impl Default for SamplyProfileParams {
53+
fn default() -> Self {
54+
Self { duration_secs: 30 }
55+
}
5456
}
5557

5658
/// Query parameters to retrieve samply profile.
57-
#[derive(Debug, Deserialize, IntoParams, ToSchema)]
59+
#[derive(Debug, Default, Deserialize, Serialize, IntoParams, ToSchema)]
5860
#[into_params(parameter_in = Query)]
61+
#[serde(default)]
5962
pub struct SamplyProfileGetParams {
6063
/// If true, returns 204 redirect with Retry-After header if profile collection is in progress.
6164
/// If false or not provided, returns the last collected profile.
62-
#[serde(default)]
6365
pub latest: bool,
6466
}

0 commit comments

Comments
 (0)