Skip to content

Commit 23d896c

Browse files
committed
oximeter: clean up query summary logic and docs.
* 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 ca91632 commit 23d896c

File tree

4 files changed

+15
-107
lines changed

4 files changed

+15
-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: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2443,8 +2443,10 @@ 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's mainly of interest internally.
24472448
#[serde(default)]
2449+
#[schemars(skip)]
24482450
pub include_summaries: bool,
24492451
}
24502452

nexus/types/src/external_api/views.rs

Lines changed: 6 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,9 @@ 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 ClickHouse. Note: we omit this field
1156+
//from the generated docs, since it's mainly of interest internally.
1157+
#[schemars(skip)]
11561158
pub query_summaries: Option<Vec<OxqlQuerySummary>>,
11571159
}
11581160

openapi/nexus.json

Lines changed: 0 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -21386,54 +21386,6 @@
2138621386
"items"
2138721387
]
2138821388
},
21389-
"IoCount": {
21390-
"description": "A count of bytes / rows accessed during a query.",
21391-
"type": "object",
21392-
"properties": {
21393-
"bytes": {
21394-
"description": "The number of bytes accessed.",
21395-
"type": "integer",
21396-
"format": "uint64",
21397-
"minimum": 0
21398-
},
21399-
"rows": {
21400-
"description": "The number of rows accessed.",
21401-
"type": "integer",
21402-
"format": "uint64",
21403-
"minimum": 0
21404-
}
21405-
},
21406-
"required": [
21407-
"bytes",
21408-
"rows"
21409-
]
21410-
},
21411-
"IoSummary": {
21412-
"description": "Summary of the I/O resources used by a query.",
21413-
"type": "object",
21414-
"properties": {
21415-
"read": {
21416-
"description": "The bytes and rows read by the query.",
21417-
"allOf": [
21418-
{
21419-
"$ref": "#/components/schemas/IoCount"
21420-
}
21421-
]
21422-
},
21423-
"written": {
21424-
"description": "The bytes and rows written by the query.",
21425-
"allOf": [
21426-
{
21427-
"$ref": "#/components/schemas/IoCount"
21428-
}
21429-
]
21430-
}
21431-
},
21432-
"required": [
21433-
"read",
21434-
"written"
21435-
]
21436-
},
2143721389
"IpNet": {
2143821390
"x-rust-type": {
2143921391
"crate": "oxnet",
@@ -22551,14 +22503,6 @@
2255122503
"description": "The result of a successful OxQL query.",
2255222504
"type": "object",
2255322505
"properties": {
22554-
"query_summaries": {
22555-
"nullable": true,
22556-
"description": "Summaries of queries run against ClickHouse.",
22557-
"type": "array",
22558-
"items": {
22559-
"$ref": "#/components/schemas/OxqlQuerySummary"
22560-
}
22561-
},
2256222506
"tables": {
2256322507
"description": "Tables resulting from the query, each containing timeseries.",
2256422508
"type": "array",
@@ -22571,41 +22515,6 @@
2257122515
"tables"
2257222516
]
2257322517
},
22574-
"OxqlQuerySummary": {
22575-
"description": "Basic metadata about the resource usage of a single ClickHouse SQL query.",
22576-
"type": "object",
22577-
"properties": {
22578-
"elapsed_ms": {
22579-
"description": "The total duration of the ClickHouse query (network plus execution).",
22580-
"type": "integer",
22581-
"format": "uint",
22582-
"minimum": 0
22583-
},
22584-
"id": {
22585-
"description": "The database-assigned query ID.",
22586-
"type": "string",
22587-
"format": "uuid"
22588-
},
22589-
"io_summary": {
22590-
"description": "Summary of the data read and written.",
22591-
"allOf": [
22592-
{
22593-
"$ref": "#/components/schemas/IoSummary"
22594-
}
22595-
]
22596-
},
22597-
"query": {
22598-
"description": "The raw ClickHouse SQL query.",
22599-
"type": "string"
22600-
}
22601-
},
22602-
"required": [
22603-
"elapsed_ms",
22604-
"id",
22605-
"io_summary",
22606-
"query"
22607-
]
22608-
},
2260922518
"OxqlTable": {
2261022519
"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.",
2261122520
"type": "object",
@@ -26036,11 +25945,6 @@
2603625945
"description": "A timeseries query string, written in the Oximeter query language.",
2603725946
"type": "object",
2603825947
"properties": {
26039-
"include_summaries": {
26040-
"description": "Whether to include ClickHouse query summaries in the response.",
26041-
"default": false,
26042-
"type": "boolean"
26043-
},
2604425948
"query": {
2604525949
"description": "A timeseries query string, written in the Oximeter query language.",
2604625950
"type": "string"

0 commit comments

Comments
 (0)