Prometheus: Add support for day_of_year (#72403)

add querybuilder/code editor support for day_of_year
This commit is contained in:
Galen Kistler 2023-07-26 14:03:17 -05:00 committed by GitHub
parent 59bed9e156
commit 831e8acf15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 0 deletions

View File

@ -238,6 +238,13 @@ export const FUNCTIONS = [
documentation: documentation:
'Returns the day of the week for each of the given times in UTC. Returned values are from 0 to 6, where 0 means Sunday etc.', 'Returns the day of the week for each of the given times in UTC. Returned values are from 0 to 6, where 0 means Sunday etc.',
}, },
{
insertText: 'day_of_year',
label: 'day_of_year',
detail: 'day_of_year(v=vector(time()) instant-vector)',
documentation:
'Returns the day of the year for each of the given times in UTC. Returned values are from 1 to 365 for non-leap years, and 1 to 366 in leap years.',
},
{ {
insertText: 'days_in_month', insertText: 'days_in_month',
label: 'days_in_month', label: 'days_in_month',

View File

@ -164,6 +164,10 @@ export function getOperationDefinitions(): QueryBuilderOperationDef[] {
id: PromOperationId.DayOfWeek, id: PromOperationId.DayOfWeek,
category: PromVisualQueryOperationCategory.Time, category: PromVisualQueryOperationCategory.Time,
}), }),
createFunction({
id: PromOperationId.DayOfYear,
category: PromVisualQueryOperationCategory.Time,
}),
createFunction({ createFunction({
id: PromOperationId.DaysInMonth, id: PromOperationId.DaysInMonth,
category: PromVisualQueryOperationCategory.Time, category: PromVisualQueryOperationCategory.Time,

View File

@ -53,6 +53,7 @@ export enum PromOperationId {
CountValues = 'count_values', CountValues = 'count_values',
DayOfMonth = 'day_of_month', DayOfMonth = 'day_of_month',
DayOfWeek = 'day_of_week', DayOfWeek = 'day_of_week',
DayOfYear = 'day_of_year',
DaysInMonth = 'days_in_month', DaysInMonth = 'days_in_month',
Deg = 'deg', Deg = 'deg',
Delta = 'delta', Delta = 'delta',