diff --git a/public/app/plugins/datasource/prometheus/promql.ts b/public/app/plugins/datasource/prometheus/promql.ts index 6baa26d4899..c37f52796ba 100644 --- a/public/app/plugins/datasource/prometheus/promql.ts +++ b/public/app/plugins/datasource/prometheus/promql.ts @@ -238,6 +238,13 @@ export const FUNCTIONS = [ 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.', }, + { + 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', label: 'days_in_month', diff --git a/public/app/plugins/datasource/prometheus/querybuilder/operations.ts b/public/app/plugins/datasource/prometheus/querybuilder/operations.ts index 788689ee7da..2c091045bb2 100644 --- a/public/app/plugins/datasource/prometheus/querybuilder/operations.ts +++ b/public/app/plugins/datasource/prometheus/querybuilder/operations.ts @@ -164,6 +164,10 @@ export function getOperationDefinitions(): QueryBuilderOperationDef[] { id: PromOperationId.DayOfWeek, category: PromVisualQueryOperationCategory.Time, }), + createFunction({ + id: PromOperationId.DayOfYear, + category: PromVisualQueryOperationCategory.Time, + }), createFunction({ id: PromOperationId.DaysInMonth, category: PromVisualQueryOperationCategory.Time, diff --git a/public/app/plugins/datasource/prometheus/querybuilder/types.ts b/public/app/plugins/datasource/prometheus/querybuilder/types.ts index 49cef909698..24750f21a96 100644 --- a/public/app/plugins/datasource/prometheus/querybuilder/types.ts +++ b/public/app/plugins/datasource/prometheus/querybuilder/types.ts @@ -53,6 +53,7 @@ export enum PromOperationId { CountValues = 'count_values', DayOfMonth = 'day_of_month', DayOfWeek = 'day_of_week', + DayOfYear = 'day_of_year', DaysInMonth = 'days_in_month', Deg = 'deg', Delta = 'delta',