Documentation ¶
Index ¶
- Constants
- func CalculatePromLookbackDuration(startDate, endDate *mgmtv1alpha1.Date) string
- func DateToTime(d *mgmtv1alpha1.Date) time.Time
- func GenerateMonthRegexRange(startDate, endDate *mgmtv1alpha1.Date) []string
- func GetDailyUsageFromProm(ctx context.Context, api promv1.API, query string, ts time.Time, ...) ([]*mgmtv1alpha1.DayResult, float64, error)
- func GetPromQueryFromMetric(metric mgmtv1alpha1.RangedMetricName, labels MetricLabels, timeWindow string) (string, error)
- func GetTotalUsageFromProm(ctx context.Context, api promv1.API, query string, dayEnd time.Time, ...) (float64, error)
- func ToEndOfDay(t time.Time) time.Time
- type MetricLabel
- type MetricLabels
Constants ¶
View Source
const ( AccountIdLabel = "neosyncAccountId" JobIdLabel = "neosyncJobId" TemporalWorkflowId = "temporalWorkflowId" TemporalRunId = "temporalRunId" TableSchemaLabel = "tableSchema" TableNameLabel = "tableName" JobTypeLabel = "jobType" IsUpdateConfigLabel = "isUpdateConfig" NeosyncDateLabel = "date" NeosyncDateFormat = "2006-01-02" TemporalWorkflowIdEnvKey = "TEMPORAL_WORKFLOW_ID" TemporalRunIdEnvKey = "TEMPORAL_ENV_ID" NeosyncDateEnvKey = "NEOSYNC_DATE" )
Variables ¶
This section is empty.
Functions ¶
func CalculatePromLookbackDuration ¶ added in v0.4.70
func CalculatePromLookbackDuration(startDate, endDate *mgmtv1alpha1.Date) string
For a given date range, returns the lookback period duration to be plugged in to the PromQL Query
Returns:
2024-09-14, 2024-09-15 == 2d
func DateToTime ¶ added in v0.4.70
func DateToTime(d *mgmtv1alpha1.Date) time.Time
func GenerateMonthRegexRange ¶ added in v0.4.70
func GenerateMonthRegexRange(startDate, endDate *mgmtv1alpha1.Date) []string
For a given date range, returns the PromQL Month Regex Patterns.
Returns:
[]string{"2024-09-.*", "2024-10-.*"}
func GetDailyUsageFromProm ¶ added in v0.4.65
func GetPromQueryFromMetric ¶ added in v0.4.65
func GetPromQueryFromMetric( metric mgmtv1alpha1.RangedMetricName, labels MetricLabels, timeWindow string, ) (string, error)
func GetTotalUsageFromProm ¶ added in v0.4.65
Types ¶
type MetricLabel ¶
func NewEqLabel ¶
func NewEqLabel(key, value string) MetricLabel
func NewNotEqLabel ¶
func NewNotEqLabel(key, value string) MetricLabel
note: this has only been tested with prometheus and using it with benthos is not currently supported
func NewRegexMatchLabel ¶ added in v0.4.70
func NewRegexMatchLabel(key, value string) MetricLabel
This is used when querying Prometheus and is not supported when using with Benthos
func (*MetricLabel) ToBenthosMeta ¶
func (m *MetricLabel) ToBenthosMeta() string
func (*MetricLabel) ToPromQueryString ¶
func (m *MetricLabel) ToPromQueryString() string
type MetricLabels ¶
type MetricLabels []MetricLabel
func (MetricLabels) ToBenthosMeta ¶
func (m MetricLabels) ToBenthosMeta() string
func (MetricLabels) ToPromQueryString ¶
func (m MetricLabels) ToPromQueryString() string
Click to show internal directories.
Click to hide internal directories.