#collector #aggregation #janus #prio3

janus_collector

Collector for Janus, the server powering ISRG's Divvi Up

210 releases

new 0.7.58 Apr 2, 2025
0.7.57 Mar 25, 2025
0.7.53 Feb 26, 2025
0.7.45 Dec 11, 2024
0.1.24 Nov 16, 2022

#98 in Science

Download history 156/week @ 2024-12-13 73/week @ 2024-12-20 30/week @ 2024-12-27 122/week @ 2025-01-03 246/week @ 2025-01-10 314/week @ 2025-01-17 428/week @ 2025-01-24 339/week @ 2025-01-31 262/week @ 2025-02-07 284/week @ 2025-02-14 451/week @ 2025-02-21 378/week @ 2025-02-28 359/week @ 2025-03-07 345/week @ 2025-03-14 280/week @ 2025-03-21 244/week @ 2025-03-28

1,253 downloads per month
Used in divviup-cli

MPL-2.0 license

455KB
11K SLoC

A DAP-PPM collector

This library implements the collector role of the DAP-PPM protocol. It works in concert with two DAP-PPM aggregator servers to compute a statistical aggregate over data from many clients, while preserving the privacy of each client's data.

Examples

Initialize an instance of Collector.

use std::{fs::File, str::FromStr};

use janus_collector::{Collector, PrivateCollectorCredential};
use janus_messages::{Duration, FixedSizeQuery, Interval, Query, TaskId, Time};
use prio::vdaf::prio3::Prio3;
use url::Url;

let task_id = TaskId::from_str("[your DAP task ID here]").unwrap();

let collector_credential: PrivateCollectorCredential =
    serde_json::from_reader(File::open("[path to JSON encoded collector credential]").unwrap())
        .unwrap();

let leader_url =
    Url::from_str("[absolute URI to the DAP leader, e.g. https://leader.dap.example.com/]")
        .unwrap();

// Supply a VDAF implementation, corresponding to this task.
let vdaf = Prio3::new_count(2).unwrap();

let collector = Collector::new(
    task_id,
    leader_url,
    collector_credential.authentication_token(),
    collector_credential.hpke_keypair(),
    vdaf,
)
.unwrap();

// If this is a time interval task, specify the time interval over which the aggregation
// should be calculated.
let interval = Interval::new(
    Time::from_seconds_since_epoch(1_656_000_000),
    Duration::from_seconds(3600),
)
.unwrap();

// Make the requests and retrieve the aggregated statistic.
let aggregation_result = collector
    .collect(Query::new_time_interval(interval), &())
    .await
    .unwrap();

// Or if this is a fixed size task, make a fixed size query.
let query = Query::new_fixed_size(FixedSizeQuery::CurrentBatch);
let aggregation_result = collector.collect(query, &()).await.unwrap();

janus_collector

Build Status latest version docs badge

janus_collector is a self-contained implementation of the Distributed Aggregation Protocol's collector role. It is intended for use with Janus and Divvi Up, ISRG's privacy-respecting metrics service. janus_collector is published to crates.io by a GitHub Action that runs when a janus release is created.

Dependencies

~98MB
~2.5M SLoC