Trim comments across Rust and webapp source to direct one-liners (ticket 030)
Pass over src/*.rs, webapp/src/**, and the in-app "?" docs prose: condensed multi-paragraph doc comments to single lines that state the non-obvious why, deleted comments that only restated adjacent code, and tightened the Docs.tsx help-panel wording. No logic, structure, or code formatting changed — verified via cargo test (143 passed) and tsc -b && vite build. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XFUNZwCvz3kcod3352ZR2o
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
3cef6dc8ae
commit
00c21c8032
+6
-20
@@ -3,19 +3,13 @@ use crate::timestamp::Timestamp;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
/// A single parsed metric primitive extracted from a regex capture group.
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct RegexToMetricPrimitiveMatcher {
|
||||
pub param_name: String,
|
||||
pub capture_group: String,
|
||||
pub kind: MetricPrimitiveKind,
|
||||
/// Ticket 022: whether this param contributes to the bucket's `labels`
|
||||
/// (the default) or is the bucket's per-event captured `value` (at most
|
||||
/// one `Value`-role param per metric — `declare_metric` rejects more
|
||||
/// than one). `#[serde(default)]` so profile files saved before this
|
||||
/// field existed still load, with every param defaulting to `Label` —
|
||||
/// i.e. unchanged behavior (the fixed occurrence-count-of-1 value).
|
||||
/// Whether this param is a bucket label or its captured value (at most one Value-role param per metric); `#[serde(default)]` so profile files saved before this field existed still load as `Label`.
|
||||
#[serde(default)]
|
||||
pub role: ParamRole,
|
||||
}
|
||||
@@ -29,10 +23,7 @@ pub enum ParamRole {
|
||||
Value,
|
||||
}
|
||||
|
||||
/// `rename_all = "lowercase"` matches every other `kind`-style enum exposed
|
||||
/// over the API/settings JSON (`ColorScheme`, `CssEntryKind`,
|
||||
/// `ProfileMetricPrimitiveKind`), so `POST /api/params`/`POST /api/metrics`
|
||||
/// bodies use `"string"`/`"number"`/`"timestamp"`.
|
||||
/// `rename_all = "lowercase"` matches other `kind`-style enums, so JSON bodies use "string"/"number"/"timestamp".
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
@@ -40,12 +31,7 @@ pub enum MetricPrimitiveKind {
|
||||
String,
|
||||
Number,
|
||||
Timestamp,
|
||||
/// Ticket 023: milliseconds. On a metric's `Value`-role param, this
|
||||
/// doesn't parse the captured text at all — the value is instead derived
|
||||
/// as the elapsed time since the previous counter event with the same
|
||||
/// label set (see `crate::engine::apply_metric_to_log`). On any other
|
||||
/// param (a `Label`-role metric param, or a standalone `ParamDeclaration`),
|
||||
/// it parses the captured text as a literal `i64` millisecond count.
|
||||
/// On a Value-role param this is derived as elapsed time since the previous event (not parsed from text); otherwise it's a literal i64 millisecond count.
|
||||
Duration,
|
||||
}
|
||||
|
||||
@@ -65,16 +51,16 @@ pub enum DataValue {
|
||||
MetricDeclaration {
|
||||
message_match_regex: String,
|
||||
params: Vec<RegexToMetricPrimitiveMatcher>,
|
||||
/// See `crate::engine::DeclareMetricRequest::matched_labels` (ticket 025).
|
||||
/// See `crate::engine::DeclareMetricRequest::matched_labels`.
|
||||
matched_labels: Option<BTreeMap<String, String>>,
|
||||
/// See `crate::engine::DeclareMetricRequest::unmatched_labels` (ticket 025).
|
||||
/// See `crate::engine::DeclareMetricRequest::unmatched_labels`.
|
||||
unmatched_labels: Option<BTreeMap<String, String>>,
|
||||
},
|
||||
/// Paired with `IndexKey::Bucket`.
|
||||
BucketValue {
|
||||
values: Vec<(u64, Timestamp, MetricPrimitive)>,
|
||||
},
|
||||
/// Paired with `IndexKey::LastMetricEvent` (ticket 023).
|
||||
/// Paired with `IndexKey::LastMetricEvent`.
|
||||
LastEventTimestamp {
|
||||
timestamp: Timestamp,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user