Skip to content

Commit 080f598

Browse files
committed
oximeter: clean up query summary logic and docs.
* Convert query summaries lazily; h/t @david-crespo. * Genericize user-facing docs; h/t @ahl. We don't need to leak details of the oximeter implementation here, so we drop references to clickhouse and clarify that query summaries are meant for performance investigation and not general use.
1 parent ca91632 commit 080f598

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

nexus/src/external_api/http_entrypoints.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7157,13 +7157,13 @@ impl NexusExternalApi for NexusExternalApiImpl {
71577157
.into_iter()
71587158
.map(Into::into)
71597159
.collect(),
7160-
query_summaries: include_summaries.then_some(
7160+
query_summaries: include_summaries.then(|| {
71617161
result
71627162
.query_summaries
71637163
.into_iter()
71647164
.map(Into::into)
7165-
.collect(),
7166-
),
7165+
.collect()
7166+
}),
71677167
})
71687168
})
71697169
.map_err(HttpError::from)
@@ -7201,13 +7201,13 @@ impl NexusExternalApi for NexusExternalApiImpl {
72017201
.into_iter()
72027202
.map(Into::into)
72037203
.collect(),
7204-
query_summaries: include_summaries.then_some(
7204+
query_summaries: include_summaries.then(|| {
72057205
result
72067206
.query_summaries
72077207
.into_iter()
72087208
.map(Into::into)
7209-
.collect(),
7210-
),
7209+
.collect()
7210+
}),
72117211
})
72127212
})
72137213
.map_err(HttpError::from)

nexus/types/src/external_api/params.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2443,7 +2443,7 @@ pub struct ProbeListSelector {
24432443
pub struct TimeseriesQuery {
24442444
/// A timeseries query string, written in the Oximeter query language.
24452445
pub query: String,
2446-
/// Whether to include ClickHouse query summaries in the response.
2446+
/// Whether to include query summaries in the response. Used to track oximeter performance.
24472447
#[serde(default)]
24482448
pub include_summaries: bool,
24492449
}

nexus/types/src/external_api/views.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,14 +1123,14 @@ impl From<oxql_types::Table> for OxqlTable {
11231123
}
11241124
}
11251125

1126-
/// Basic metadata about the resource usage of a single ClickHouse SQL query.
1126+
/// Basic metadata about the resource usage of a single backend query.
11271127
#[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)]
11281128
pub struct OxqlQuerySummary {
11291129
/// The database-assigned query ID.
11301130
pub id: Uuid,
1131-
/// The raw ClickHouse SQL query.
1131+
/// The raw query.
11321132
pub query: String,
1133-
/// The total duration of the ClickHouse query (network plus execution).
1133+
/// The total duration of the query (network plus execution).
11341134
pub elapsed_ms: usize,
11351135
/// Summary of the data read and written.
11361136
pub io_summary: oxql_types::IoSummary,
@@ -1152,7 +1152,7 @@ impl From<oxql_types::QuerySummary> for OxqlQuerySummary {
11521152
pub struct OxqlQueryResult {
11531153
/// Tables resulting from the query, each containing timeseries.
11541154
pub tables: Vec<OxqlTable>,
1155-
/// Summaries of queries run against ClickHouse.
1155+
/// Summaries of queries run against the oximeter backend. Used to track oximeter performance.
11561156
pub query_summaries: Option<Vec<OxqlQuerySummary>>,
11571157
}
11581158

openapi/nexus.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22553,7 +22553,7 @@
2255322553
"properties": {
2255422554
"query_summaries": {
2255522555
"nullable": true,
22556-
"description": "Summaries of queries run against ClickHouse.",
22556+
"description": "Summaries of queries run against the oximeter backend. Used to track oximeter performance.",
2255722557
"type": "array",
2255822558
"items": {
2255922559
"$ref": "#/components/schemas/OxqlQuerySummary"
@@ -22572,11 +22572,11 @@
2257222572
]
2257322573
},
2257422574
"OxqlQuerySummary": {
22575-
"description": "Basic metadata about the resource usage of a single ClickHouse SQL query.",
22575+
"description": "Basic metadata about the resource usage of a single backend query.",
2257622576
"type": "object",
2257722577
"properties": {
2257822578
"elapsed_ms": {
22579-
"description": "The total duration of the ClickHouse query (network plus execution).",
22579+
"description": "The total duration of the query (network plus execution).",
2258022580
"type": "integer",
2258122581
"format": "uint",
2258222582
"minimum": 0
@@ -22595,7 +22595,7 @@
2259522595
]
2259622596
},
2259722597
"query": {
22598-
"description": "The raw ClickHouse SQL query.",
22598+
"description": "The raw query.",
2259922599
"type": "string"
2260022600
}
2260122601
},
@@ -26037,7 +26037,7 @@
2603726037
"type": "object",
2603826038
"properties": {
2603926039
"include_summaries": {
26040-
"description": "Whether to include ClickHouse query summaries in the response.",
26040+
"description": "Whether to include query summaries in the response. Used to track oximeter performance.",
2604126041
"default": false,
2604226042
"type": "boolean"
2604326043
},

0 commit comments

Comments
 (0)