-
Notifications
You must be signed in to change notification settings - Fork 137
Add Prometheus namespace with five new endpoints #6293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
894c31b
d551ab3
2450cc7
7ef9460
57a17c3
ec044ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,70 @@ | ||||||
| /* | ||||||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||||||
| * license agreements. See the NOTICE file distributed with | ||||||
| * this work for additional information regarding copyright | ||||||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||||||
| * the Apache License, Version 2.0 (the "License"); you may | ||||||
| * not use this file except in compliance with the License. | ||||||
| * You may obtain a copy of the License at | ||||||
| * | ||||||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||||||
| * | ||||||
| * Unless required by applicable law or agreed to in writing, | ||||||
| * software distributed under the License is distributed on an | ||||||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||||||
| * KIND, either express or implied. See the License for the | ||||||
| * specific language governing permissions and limitations | ||||||
| * under the License. | ||||||
| */ | ||||||
|
|
||||||
| import { RequestBase } from '@_types/Base' | ||||||
| import { IndexName, MediaType } from '@_types/common' | ||||||
| import { integer } from '@_types/Numeric' | ||||||
|
|
||||||
| /** | ||||||
| * Get label names. | ||||||
| * | ||||||
| * Return a list of label names that match a certain set of selectors. | ||||||
| * @rest_spec_name prometheus.labels | ||||||
| * @availability stack since=9.4.0 stability=experimental visibility=public | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We've now got "tech_preview" available per #6312
Suggested change
|
||||||
| * @availability serverless stability=experimental visibility=public | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| * @doc_id prometheus-labels | ||||||
| */ | ||||||
| export interface Request extends RequestBase { | ||||||
| urls: [ | ||||||
| { | ||||||
| path: '/_prometheus/api/v1/labels' | ||||||
| methods: ['GET'] | ||||||
| }, | ||||||
| { | ||||||
| path: '/_prometheus/{index}/api/v1/labels' | ||||||
| methods: ['GET'] | ||||||
| } | ||||||
| ] | ||||||
| path_parts: { | ||||||
| /** | ||||||
| * An index pattern that restricts the query to a specific index. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. server default "metrics-*" server code |
||||||
| */ | ||||||
| index?: IndexName | ||||||
| } | ||||||
| response_media_type: MediaType.Json | ||||||
| query_parameters: { | ||||||
| /** | ||||||
| * Series selectors used to filter the returned label names. | ||||||
| * @codegen_name match | ||||||
| */ | ||||||
| 'match[]'?: string[] | ||||||
| /** | ||||||
| * The start of the time range. Defaults to `now - 24h`. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should use the server default annotation
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. from the server code it looks like it's "end-24h" (which yes it's "now-24h" in case both are empty, but still) |
||||||
| */ | ||||||
| start?: string | ||||||
| /** | ||||||
| * The end of the time range. Defaults to now. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should use the server default annotation |
||||||
| */ | ||||||
| end?: string | ||||||
| /** | ||||||
| * The maximum number of results to return. `0` means no limit. | ||||||
| */ | ||||||
| limit?: integer | ||||||
| } | ||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import { UserDefinedValue } from '@spec_utils/UserDefinedValue' | ||
|
|
||
| export class Response { | ||
| /** @codegen_name body */ | ||
| body: UserDefinedValue | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is it really completely unmappable? I'm looking at the server code and it seems like there is some structure, there's also the error case which we could map using the |
||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,65 @@ | ||||||
| /* | ||||||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||||||
| * license agreements. See the NOTICE file distributed with | ||||||
| * this work for additional information regarding copyright | ||||||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||||||
| * the Apache License, Version 2.0 (the "License"); you may | ||||||
| * not use this file except in compliance with the License. | ||||||
| * You may obtain a copy of the License at | ||||||
| * | ||||||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||||||
| * | ||||||
| * Unless required by applicable law or agreed to in writing, | ||||||
| * software distributed under the License is distributed on an | ||||||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||||||
| * KIND, either express or implied. See the License for the | ||||||
| * specific language governing permissions and limitations | ||||||
| * under the License. | ||||||
| */ | ||||||
|
|
||||||
| import { RequestBase } from '@_types/Base' | ||||||
| import { IndexName, MediaType } from '@_types/common' | ||||||
| import { integer } from '@_types/Numeric' | ||||||
|
|
||||||
| /** | ||||||
| * Execute a PromQL instant query. | ||||||
| * | ||||||
| * Evaluate a PromQL expression at a single point in time. | ||||||
| * @rest_spec_name prometheus.query | ||||||
| * @availability stack since=9.4.0 stability=experimental visibility=public | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| * @availability serverless stability=experimental visibility=public | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| * @doc_id prometheus-query | ||||||
| */ | ||||||
| export interface Request extends RequestBase { | ||||||
| urls: [ | ||||||
| { | ||||||
| path: '/_prometheus/api/v1/query' | ||||||
| methods: ['GET'] | ||||||
| }, | ||||||
| { | ||||||
| path: '/_prometheus/{index}/api/v1/query' | ||||||
| methods: ['GET'] | ||||||
| } | ||||||
| ] | ||||||
| path_parts: { | ||||||
| /** | ||||||
| * An index pattern that restricts the query to a specific index. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||||||
| */ | ||||||
| index?: IndexName | ||||||
| } | ||||||
| response_media_type: MediaType.Json | ||||||
| query_parameters: { | ||||||
| /** | ||||||
| * The PromQL expression to evaluate. | ||||||
| */ | ||||||
| query: string | ||||||
| /** | ||||||
| * The evaluation timestamp. Defaults to the current server time. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should use the server default annotation (default to now) |
||||||
| */ | ||||||
| time?: string | ||||||
| /** | ||||||
| * The maximum number of results to return. `0` means no limit. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. server default 0 |
||||||
| */ | ||||||
| limit?: integer | ||||||
| } | ||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import { UserDefinedValue } from '@spec_utils/UserDefinedValue' | ||
|
|
||
| export class Response { | ||
| /** @codegen_name body */ | ||
| body: UserDefinedValue | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above, server code hints to a structure |
||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,73 @@ | ||||||
| /* | ||||||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||||||
| * license agreements. See the NOTICE file distributed with | ||||||
| * this work for additional information regarding copyright | ||||||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||||||
| * the Apache License, Version 2.0 (the "License"); you may | ||||||
| * not use this file except in compliance with the License. | ||||||
| * You may obtain a copy of the License at | ||||||
| * | ||||||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||||||
| * | ||||||
| * Unless required by applicable law or agreed to in writing, | ||||||
| * software distributed under the License is distributed on an | ||||||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||||||
| * KIND, either express or implied. See the License for the | ||||||
| * specific language governing permissions and limitations | ||||||
| * under the License. | ||||||
| */ | ||||||
|
|
||||||
| import { RequestBase } from '@_types/Base' | ||||||
| import { IndexName, MediaType } from '@_types/common' | ||||||
| import { integer } from '@_types/Numeric' | ||||||
|
|
||||||
| /** | ||||||
| * Execute a PromQL range query. | ||||||
| * | ||||||
| * Evaluate a PromQL expression over a time range. | ||||||
| * @rest_spec_name prometheus.query_range | ||||||
| * @availability stack since=9.4.0 stability=experimental visibility=public | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| * @availability serverless stability=experimental visibility=public | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| * @doc_id prometheus-query-range | ||||||
| */ | ||||||
| export interface Request extends RequestBase { | ||||||
| urls: [ | ||||||
| { | ||||||
| path: '/_prometheus/api/v1/query_range' | ||||||
| methods: ['GET'] | ||||||
| }, | ||||||
| { | ||||||
| path: '/_prometheus/{index}/api/v1/query_range' | ||||||
| methods: ['GET'] | ||||||
| } | ||||||
| ] | ||||||
| path_parts: { | ||||||
| /** | ||||||
| * An index pattern that restricts the query to a specific index. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||||||
| */ | ||||||
| index?: IndexName | ||||||
| } | ||||||
| response_media_type: MediaType.Json | ||||||
| query_parameters: { | ||||||
| /** | ||||||
| * The PromQL expression to evaluate. | ||||||
| */ | ||||||
| query: string | ||||||
| /** | ||||||
| * The start of the time range (inclusive). | ||||||
| */ | ||||||
| start: string | ||||||
| /** | ||||||
| * The end of the time range (inclusive). | ||||||
| */ | ||||||
| end: string | ||||||
| /** | ||||||
| * The query resolution step. | ||||||
| */ | ||||||
| step: string | ||||||
| /** | ||||||
| * The maximum number of results to return. `0` means no limit. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||||||
| */ | ||||||
| limit?: integer | ||||||
| } | ||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import { UserDefinedValue } from '@spec_utils/UserDefinedValue' | ||
|
|
||
| export class Response { | ||
| /** @codegen_name body */ | ||
| body: UserDefinedValue | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above, probably the same structure as the instant query |
||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this one is likely missing the body, the request_media_type and the response_media_type. from the server code it's not immediately clear what's expecting, let's gather more info first. |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,57 @@ | ||||||
| /* | ||||||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||||||
| * license agreements. See the NOTICE file distributed with | ||||||
| * this work for additional information regarding copyright | ||||||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||||||
| * the Apache License, Version 2.0 (the "License"); you may | ||||||
| * not use this file except in compliance with the License. | ||||||
| * You may obtain a copy of the License at | ||||||
| * | ||||||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||||||
| * | ||||||
| * Unless required by applicable law or agreed to in writing, | ||||||
| * software distributed under the License is distributed on an | ||||||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||||||
| * KIND, either express or implied. See the License for the | ||||||
| * specific language governing permissions and limitations | ||||||
| * under the License. | ||||||
| */ | ||||||
|
|
||||||
| import { RequestBase } from '@_types/Base' | ||||||
|
|
||||||
| /** | ||||||
| * Ingest Prometheus remote write data. | ||||||
| * | ||||||
| * Accepts a Prometheus remote write request (protobuf-encoded) and indexes the | ||||||
| * time series data into Elasticsearch. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not mandatory, but might be nice to link to the narrative docs:
Suggested change
|
||||||
| * @rest_spec_name prometheus.remote_write | ||||||
| * @availability stack since=9.4.0 stability=experimental visibility=public | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| * @availability serverless stability=experimental visibility=public | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| * @doc_id prometheus-remote-write | ||||||
| */ | ||||||
| export interface Request extends RequestBase { | ||||||
| urls: [ | ||||||
| { | ||||||
| path: '/_prometheus/api/v1/write' | ||||||
| methods: ['POST'] | ||||||
| }, | ||||||
| { | ||||||
| path: '/_prometheus/metrics/{dataset}/api/v1/write' | ||||||
| methods: ['POST'] | ||||||
| }, | ||||||
| { | ||||||
| path: '/_prometheus/metrics/{dataset}/{namespace}/api/v1/write' | ||||||
| methods: ['POST'] | ||||||
| } | ||||||
| ] | ||||||
| path_parts: { | ||||||
| /** | ||||||
| * The Prometheus dataset name. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. server default "generic", server code |
||||||
| */ | ||||||
| dataset?: string | ||||||
| /** | ||||||
| * The Prometheus namespace. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. server default "default", server code a line below the other one |
||||||
| */ | ||||||
| namespace?: string | ||||||
| } | ||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import { UserDefinedValue } from '@spec_utils/UserDefinedValue' | ||
|
|
||
| export class Response { | ||
| /** @codegen_name body */ | ||
| body: UserDefinedValue | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this one just returns and empty response, from reading the server code, but again, not super clear, need more info. |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since the endpoint java doc in the server code specifies that the list is sorted we can also add it here