reductstore 1.20.3

ReductStore is a time series database designed specifically for storing and managing large amounts of blob data.
Documentation
// Copyright 2021-2026 ReductSoftware UG
// Licensed under the Apache License, Version 2.0

pub(crate) mod aggregator;

use serde::{Deserialize, Serialize};
use serde_json::{json, Value};

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub(crate) struct ApiAuditPayload {
    pub token_name: String,
    pub method: String,
    pub path: String,
    #[serde(default)]
    pub client_ip: Option<String>,
    pub call_count: u64,
    pub duration: f64,
}

impl ApiAuditPayload {
    pub(crate) fn entry_name(&self) -> String {
        self.token_name.clone()
    }

    pub(crate) fn to_value(&self) -> Value {
        json!({
            "token_name": self.token_name,
            "method": self.method,
            "path": self.path,
            "client_ip": self.client_ip,
            "call_count": self.call_count,
            "duration": self.duration,
        })
    }
}