Skip to content

Commit 77bb62f

Browse files
authored
oximeter: clean up query summary logic and docs. (#9184)
* Convert query summaries lazily; h/t @david-crespo. * Drop query summaries from user-facing docs; h/t @ahl. This feature is only useful for Oxide engineers to investigate oximeter performance, and we don't want to leak implementation details into public docs.
1 parent 8baffac commit 77bb62f

File tree

4 files changed

+17
-107
lines changed

4 files changed

+17
-107
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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2443,8 +2443,11 @@ 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. Note: we omit this
2447+
/// field from the generated docs, since it is not intended for consumption
2448+
/// by customers.
24472449
#[serde(default)]
2450+
#[schemars(skip)]
24482451
pub include_summaries: bool,
24492452
}
24502453

nexus/types/src/external_api/views.rs

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

1127-
/// Basic metadata about the resource usage of a single ClickHouse SQL query.
1127+
/// Basic metadata about the resource usage of a query.
11281128
#[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)]
11291129
pub struct OxqlQuerySummary {
11301130
/// The database-assigned query ID.
11311131
pub id: Uuid,
1132-
/// The raw ClickHouse SQL query.
1132+
/// The raw query.
11331133
pub query: String,
1134-
/// The total duration of the ClickHouse query (network plus execution).
1134+
/// The total duration of the query (network plus execution).
11351135
pub elapsed_ms: usize,
11361136
/// Summary of the data read and written.
11371137
pub io_summary: oxql_types::IoSummary,
@@ -1153,7 +1153,10 @@ impl From<oxql_types::QuerySummary> for OxqlQuerySummary {
11531153
pub struct OxqlQueryResult {
11541154
/// Tables resulting from the query, each containing timeseries.
11551155
pub tables: Vec<OxqlTable>,
1156-
/// Summaries of queries run against ClickHouse.
1156+
/// Summaries of queries run against ClickHouse. Note: we omit this field
1157+
/// from the generated docs, since it is not intended for consumption by
1158+
/// customers.
1159+
#[schemars(skip)]
11571160
pub query_summaries: Option<Vec<OxqlQuerySummary>>,
11581161
}
11591162

openapi/nexus.json

Lines changed: 0 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -21426,54 +21426,6 @@
2142621426
"items"
2142721427
]
2142821428
},
21429-
"IoCount": {
21430-
"description": "A count of bytes / rows accessed during a query.",
21431-
"type": "object",
21432-
"properties": {
21433-
"bytes": {
21434-
"description": "The number of bytes accessed.",
21435-
"type": "integer",
21436-
"format": "uint64",
21437-
"minimum": 0
21438-
},
21439-
"rows": {
21440-
"description": "The number of rows accessed.",
21441-
"type": "integer",
21442-
"format": "uint64",
21443-
"minimum": 0
21444-
}
21445-
},
21446-
"required": [
21447-
"bytes",
21448-
"rows"
21449-
]
21450-
},
21451-
"IoSummary": {
21452-
"description": "Summary of the I/O resources used by a query.",
21453-
"type": "object",
21454-
"properties": {
21455-
"read": {
21456-
"description": "The bytes and rows read by the query.",
21457-
"allOf": [
21458-
{
21459-
"$ref": "#/components/schemas/IoCount"
21460-
}
21461-
]
21462-
},
21463-
"written": {
21464-
"description": "The bytes and rows written by the query.",
21465-
"allOf": [
21466-
{
21467-
"$ref": "#/components/schemas/IoCount"
21468-
}
21469-
]
21470-
}
21471-
},
21472-
"required": [
21473-
"read",
21474-
"written"
21475-
]
21476-
},
2147721429
"IpNet": {
2147821430
"x-rust-type": {
2147921431
"crate": "oxnet",
@@ -22591,14 +22543,6 @@
2259122543
"description": "The result of a successful OxQL query.",
2259222544
"type": "object",
2259322545
"properties": {
22594-
"query_summaries": {
22595-
"nullable": true,
22596-
"description": "Summaries of queries run against ClickHouse.",
22597-
"type": "array",
22598-
"items": {
22599-
"$ref": "#/components/schemas/OxqlQuerySummary"
22600-
}
22601-
},
2260222546
"tables": {
2260322547
"description": "Tables resulting from the query, each containing timeseries.",
2260422548
"type": "array",
@@ -22611,41 +22555,6 @@
2261122555
"tables"
2261222556
]
2261322557
},
22614-
"OxqlQuerySummary": {
22615-
"description": "Basic metadata about the resource usage of a single ClickHouse SQL query.",
22616-
"type": "object",
22617-
"properties": {
22618-
"elapsed_ms": {
22619-
"description": "The total duration of the ClickHouse query (network plus execution).",
22620-
"type": "integer",
22621-
"format": "uint",
22622-
"minimum": 0
22623-
},
22624-
"id": {
22625-
"description": "The database-assigned query ID.",
22626-
"type": "string",
22627-
"format": "uuid"
22628-
},
22629-
"io_summary": {
22630-
"description": "Summary of the data read and written.",
22631-
"allOf": [
22632-
{
22633-
"$ref": "#/components/schemas/IoSummary"
22634-
}
22635-
]
22636-
},
22637-
"query": {
22638-
"description": "The raw ClickHouse SQL query.",
22639-
"type": "string"
22640-
}
22641-
},
22642-
"required": [
22643-
"elapsed_ms",
22644-
"id",
22645-
"io_summary",
22646-
"query"
22647-
]
22648-
},
2264922558
"OxqlTable": {
2265022559
"description": "A table represents one or more timeseries with the same schema.\n\nA table is the result of an OxQL query. It contains a name, usually the name of the timeseries schema from which the data is derived, and any number of timeseries, which contain the actual data.",
2265122560
"type": "object",
@@ -26034,11 +25943,6 @@
2603425943
"description": "A timeseries query string, written in the Oximeter query language.",
2603525944
"type": "object",
2603625945
"properties": {
26037-
"include_summaries": {
26038-
"description": "Whether to include ClickHouse query summaries in the response.",
26039-
"default": false,
26040-
"type": "boolean"
26041-
},
2604225946
"query": {
2604325947
"description": "A timeseries query string, written in the Oximeter query language.",
2604425948
"type": "string"

0 commit comments

Comments
 (0)