Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/src/ApiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export interface Task {
report_counter_success: number;
report_counter_too_early: number;
report_counter_task_expired: number;
report_counter_duplicate_extension: number;
aggregation_job_counter_success: number;
aggregation_job_counter_helper_batch_collected: number;
aggregation_job_counter_helper_report_replayed: number;
Expand Down Expand Up @@ -115,7 +116,7 @@ export type NewTask = Omit<
| "report_counter_success"
| "report_counter_too_early"
| "report_counter_task_expired"
| "report_counter_task_expired"
| "report_counter_duplicate_extension"
> & {
vdaf: {
type: "sum" | "count" | "histogram";
Expand Down
4 changes: 4 additions & 0 deletions app/src/tasks/TaskDetail/Metrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ function UploadMetrics({ task }: { task: Promise<Task> }) {
name="Task Expired Failure"
counter={task.report_counter_task_expired}
/>
<FailedMetric
name="Duplicate Extension Failure"
counter={task.report_counter_duplicate_extension}
/>
</ListGroup>
)}
</Await>
Expand Down
1 change: 1 addition & 0 deletions client/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub struct Task {
pub report_counter_success: i64,
pub report_counter_too_early: i64,
pub report_counter_task_expired: i64,
pub report_counter_duplicate_extension: i64,

#[serde(default)]
pub aggregation_job_counter_success: i64,
Expand Down
2 changes: 2 additions & 0 deletions documentation/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,8 @@ components:
type: number
report_counter_task_expired:
type: number
report_counter_duplicate_extension:
type: number
Membership:
type: object
properties:
Expand Down
2 changes: 2 additions & 0 deletions migration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ mod m20240214_215101_upload_metrics;
mod m20240411_195358_time_bucketed_fixed_size;
mod m20240416_172920_task_deleted_at;
mod m20250801_164739_aggregation_job_metrics;
mod m20250827_170000_add_duplicate_extension_counter;

pub struct Migrator;

Expand Down Expand Up @@ -59,6 +60,7 @@ impl MigratorTrait for Migrator {
Box::new(m20240411_195358_time_bucketed_fixed_size::Migration),
Box::new(m20240416_172920_task_deleted_at::Migration),
Box::new(m20250801_164739_aggregation_job_metrics::Migration),
Box::new(m20250827_170000_add_duplicate_extension_counter::Migration),
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
use sea_orm_migration::prelude::*;

#[derive(DeriveMigrationName)]
pub struct Migration;

#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.alter_table(
Table::alter()
.table(Task::Table)
.add_column(
ColumnDef::new(Task::ReportCounterDuplicateExtension)
.big_integer()
.default(0),
)
.to_owned(),
)
.await
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.alter_table(
Table::alter()
.table(Task::Table)
.drop_column(Task::ReportCounterDuplicateExtension)
.to_owned(),
)
.await
}
}

#[derive(Iden)]
enum Task {
Table,
ReportCounterDuplicateExtension,
}
6 changes: 6 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions src/api_mocks/aggregator_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ async fn get_task_upload_metrics(_: &mut Conn, (): ()) -> Json<TaskUploadMetrics
report_outdated_key: fastrand::u64(..1000),
report_success: fastrand::u64(..1000),
report_too_early: fastrand::u64(..1000),
report_duplicate_extension: fastrand::u64(..1000),
task_expired: fastrand::u64(..1000),
})
}
Expand Down
3 changes: 3 additions & 0 deletions src/clients/aggregator_client/api_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ pub struct TaskUploadMetrics {
pub report_too_early: u64,
/// Reports that were submitted to the task after the task's expiry.
pub task_expired: u64,
/// Reports that were submitted with a duplicate extension.
pub report_duplicate_extension: u64,
}

impl PartialEq<Task> for TaskUploadMetrics {
Expand All @@ -359,6 +361,7 @@ impl PartialEq<Task> for TaskUploadMetrics {
&& other.report_counter_success == self.report_success as i64
&& other.report_counter_too_early == self.report_too_early as i64
&& other.report_counter_task_expired == self.task_expired as i64
&& other.report_counter_duplicate_extension == self.report_duplicate_extension as i64
}
}

Expand Down
7 changes: 7 additions & 0 deletions src/entity/task/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pub struct Model {
pub report_counter_success: i64,
pub report_counter_too_early: i64,
pub report_counter_task_expired: i64,
pub report_counter_duplicate_extension: i64,

// Aggregation job metrics
pub aggregation_job_counter_success: i64,
Expand Down Expand Up @@ -102,6 +103,12 @@ impl Model {
ActiveValue::Set(metrics.report_too_early.try_into().unwrap_or(i64::MAX));
task.report_counter_task_expired =
ActiveValue::Set(metrics.task_expired.try_into().unwrap_or(i64::MAX));
task.report_counter_duplicate_extension = ActiveValue::Set(
metrics
.report_duplicate_extension
.try_into()
.unwrap_or(i64::MAX),
);
task.updated_at = ActiveValue::Set(OffsetDateTime::now_utc());
task.update(&db).await
}
Expand Down
1 change: 1 addition & 0 deletions src/entity/task/provisionable_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ impl ProvisionableTask {
report_counter_success: 0,
report_counter_too_early: 0,
report_counter_task_expired: 0,
report_counter_duplicate_extension: 0,
aggregation_job_counter_success: 0,
aggregation_job_counter_helper_hpke_decrypt_failure: 0,
aggregation_job_counter_helper_batch_collected: 0,
Expand Down
1 change: 1 addition & 0 deletions test-support/src/fixtures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ pub async fn task(app: &DivviupApi, account: &Account) -> Task {
report_counter_success: 0,
report_counter_too_early: 0,
report_counter_task_expired: 0,
report_counter_duplicate_extension: 0,
aggregation_job_counter_success: 0,
aggregation_job_counter_helper_hpke_decrypt_failure: 0,
aggregation_job_counter_helper_batch_collected: 0,
Expand Down
Loading