Skip to content

Commit

Permalink
move existing timeseries query endpoints to /v1/system
Browse files Browse the repository at this point in the history
  • Loading branch information
david-crespo committed Nov 12, 2024
1 parent 7cf688c commit 38878f7
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 104 deletions.
4 changes: 2 additions & 2 deletions nexus/external-api/output/nexus_tags.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ login_saml POST /login/{silo_name}/saml/{provi
API operations found with tag "metrics"
OPERATION ID METHOD URL PATH
silo_metric GET /v1/metrics/{metric_name}
timeseries_query POST /v1/timeseries/query
timeseries_schema_list GET /v1/timeseries/schema

API operations found with tag "policy"
OPERATION ID METHOD URL PATH
Expand Down Expand Up @@ -170,6 +168,8 @@ ip_pool_view GET /v1/system/ip-pools/{pool}
API operations found with tag "system/metrics"
OPERATION ID METHOD URL PATH
system_metric GET /v1/system/metrics/{metric_name}
system_timeseries_query POST /v1/system/timeseries/query
system_timeseries_schema_list GET /v1/system/timeseries/schema

API operations found with tag "system/networking"
OPERATION ID METHOD URL PATH
Expand Down
12 changes: 6 additions & 6 deletions nexus/external-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2541,10 +2541,10 @@ pub trait NexusExternalApi {
/// List timeseries schemas
#[endpoint {
method = GET,
path = "/v1/timeseries/schema",
tags = ["metrics"],
path = "/v1/system/timeseries/schema",
tags = ["system/metrics"],
}]
async fn timeseries_schema_list(
async fn system_timeseries_schema_list(
rqctx: RequestContext<Self::Context>,
pag_params: Query<TimeseriesSchemaPaginationParams>,
) -> Result<
Expand All @@ -2559,10 +2559,10 @@ pub trait NexusExternalApi {
/// Queries are written in OxQL.
#[endpoint {
method = POST,
path = "/v1/timeseries/query",
tags = ["metrics"],
path = "/v1/system/timeseries/query",
tags = ["system/metrics"],
}]
async fn timeseries_query(
async fn system_timeseries_query(
rqctx: RequestContext<Self::Context>,
body: TypedBody<params::TimeseriesQuery>,
) -> Result<HttpResponseOk<views::OxqlQueryResult>, HttpError>;
Expand Down
4 changes: 2 additions & 2 deletions nexus/src/external_api/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5494,7 +5494,7 @@ impl NexusExternalApi for NexusExternalApiImpl {
.await
}

async fn timeseries_schema_list(
async fn system_timeseries_schema_list(
rqctx: RequestContext<ApiContext>,
pag_params: Query<TimeseriesSchemaPaginationParams>,
) -> Result<
Expand All @@ -5521,7 +5521,7 @@ impl NexusExternalApi for NexusExternalApiImpl {
.await
}

async fn timeseries_query(
async fn system_timeseries_query(
rqctx: RequestContext<ApiContext>,
body: TypedBody<params::TimeseriesQuery>,
) -> Result<HttpResponseOk<views::OxqlQueryResult>, HttpError> {
Expand Down
4 changes: 2 additions & 2 deletions nexus/tests/integration_tests/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -947,10 +947,10 @@ pub static DEMO_SILO_METRICS_URL: Lazy<String> = Lazy::new(|| {
});

pub static TIMESERIES_LIST_URL: Lazy<String> =
Lazy::new(|| String::from("/v1/timeseries/schema"));
Lazy::new(|| String::from("/v1/system/timeseries/schema"));

pub static TIMESERIES_QUERY_URL: Lazy<String> =
Lazy::new(|| String::from("/v1/timeseries/query"));
Lazy::new(|| String::from("/v1/system/timeseries/query"));

pub static DEMO_TIMESERIES_QUERY: Lazy<params::TimeseriesQuery> =
Lazy::new(|| params::TimeseriesQuery {
Expand Down
4 changes: 2 additions & 2 deletions nexus/tests/integration_tests/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ async fn test_timeseries_schema_list(
// producing data. Force a collection to ensure that happens.
cptestctx.oximeter.force_collect().await;
let client = &cptestctx.external_client;
let url = "/v1/timeseries/schema";
let url = "/v1/system/timeseries/schema";
let schema =
objects_list_page_authz::<TimeseriesSchema>(client, &url).await;
schema
Expand Down Expand Up @@ -300,7 +300,7 @@ pub async fn timeseries_query(
nexus_test_utils::http_testing::RequestBuilder::new(
&cptestctx.external_client,
http::Method::POST,
"/v1/timeseries/query",
"/v1/system/timeseries/query",
)
.body(Some(&body)),
)
Expand Down
180 changes: 90 additions & 90 deletions openapi/nexus.json
Original file line number Diff line number Diff line change
Expand Up @@ -8490,6 +8490,96 @@
}
}
},
"/v1/system/timeseries/query": {
"post": {
"tags": [
"system/metrics"
],
"summary": "Run timeseries query",
"description": "Queries are written in OxQL.",
"operationId": "system_timeseries_query",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TimeseriesQuery"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OxqlQueryResult"
}
}
}
},
"4XX": {
"$ref": "#/components/responses/Error"
},
"5XX": {
"$ref": "#/components/responses/Error"
}
}
}
},
"/v1/system/timeseries/schema": {
"get": {
"tags": [
"system/metrics"
],
"summary": "List timeseries schemas",
"operationId": "system_timeseries_schema_list",
"parameters": [
{
"in": "query",
"name": "limit",
"description": "Maximum number of items returned by a single call",
"schema": {
"nullable": true,
"type": "integer",
"format": "uint32",
"minimum": 1
}
},
{
"in": "query",
"name": "page_token",
"description": "Token returned by previous call to retrieve the subsequent page",
"schema": {
"nullable": true,
"type": "string"
}
}
],
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TimeseriesSchemaResultsPage"
}
}
}
},
"4XX": {
"$ref": "#/components/responses/Error"
},
"5XX": {
"$ref": "#/components/responses/Error"
}
},
"x-dropshot-pagination": {
"required": []
}
}
},
"/v1/system/users": {
"get": {
"tags": [
Expand Down Expand Up @@ -8800,96 +8890,6 @@
}
}
},
"/v1/timeseries/query": {
"post": {
"tags": [
"metrics"
],
"summary": "Run timeseries query",
"description": "Queries are written in OxQL.",
"operationId": "timeseries_query",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TimeseriesQuery"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OxqlQueryResult"
}
}
}
},
"4XX": {
"$ref": "#/components/responses/Error"
},
"5XX": {
"$ref": "#/components/responses/Error"
}
}
}
},
"/v1/timeseries/schema": {
"get": {
"tags": [
"metrics"
],
"summary": "List timeseries schemas",
"operationId": "timeseries_schema_list",
"parameters": [
{
"in": "query",
"name": "limit",
"description": "Maximum number of items returned by a single call",
"schema": {
"nullable": true,
"type": "integer",
"format": "uint32",
"minimum": 1
}
},
{
"in": "query",
"name": "page_token",
"description": "Token returned by previous call to retrieve the subsequent page",
"schema": {
"nullable": true,
"type": "string"
}
}
],
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TimeseriesSchemaResultsPage"
}
}
}
},
"4XX": {
"$ref": "#/components/responses/Error"
},
"5XX": {
"$ref": "#/components/responses/Error"
}
},
"x-dropshot-pagination": {
"required": []
}
}
},
"/v1/users": {
"get": {
"tags": [
Expand Down

0 comments on commit 38878f7

Please sign in to comment.