Documentation
¶
Overview ¶
Copyright 2025 Microsoft Corporation
Licensed 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.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CliConfig ¶
type CliConfig struct {
PrometheusRules PrometheusRulesConfig `json:"prometheusRules"`
InternalSubscriptionFilter InternalSubscriptionFilterConfig `json:"internalSubscriptionFilter,omitempty"`
}
type CorrelationIDSegment ¶
type CorrelationIDSegment struct {
Type string `json:"type"`
Value string `json:"value,omitempty"`
Name string `json:"name,omitempty"`
}
CorrelationIDSegment is a single segment of a parsed correlation ID. Each segment is either a literal string value or a reference to a Prometheus label.
type CorrelationMapEntry ¶
type CorrelationMapEntry struct {
Alert string `json:"alert"`
Segments []CorrelationIDSegment `json:"correlationId"`
}
CorrelationMapEntry holds the mapping between a monitor identifier and its parsed correlation ID segments.
type GroupAlerts ¶
type InternalSubscriptionFilterConfig ¶
type InternalSubscriptionFilterConfig struct {
Enabled bool `json:"enabled,omitempty"`
Table string `json:"table,omitempty"`
}
InternalSubscriptionFilterConfig configures post-expression filtering of internal (e2e/dev/test) subscriptions. When enabled, alerts that carry the label exclude_internal_subscriptions: "true" have their PromQL expression wrapped with an `unless on(subscription_id) <Table>` clause. The recording rule referenced by Table must exist in the Azure Monitor Workspace; if it does not, the unless is a no-op (empty set excludes nothing).
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
func NewOptions ¶
func NewOptions() *Options
func (*Options) CorrelationMap ¶
func (o *Options) CorrelationMap() ([]CorrelationMapEntry, error)
CorrelationMap iterates all alerting rules (using the same logic as Generate) and returns the mapping between group/alert names and their parsed correlation ID segments.
func (*Options) WithPreserveAggregationLabels ¶
WithPreserveAggregationLabels configures the labels that must be preserved through every aggregation when generating rules.
type PrometheusRulesConfig ¶
type PrometheusRulesConfig struct {
RulesFolders []string `json:"rulesFolders"`
UntestedRules []string `json:"untestedRules,omitempty"`
TestDependencies []string `json:"testDependencies,omitempty"`
OutputBicep string `json:"outputBicep"`
IncludedAlertsByGroup []GroupAlerts `json:"includedAlertsByGroup,omitempty"` // Optional: Only alerts listed here are included; if empty, all alerts are included
LabelsToExtract []string `json:"labelsToExtract,omitempty"`
OutputReplacements []Replacements `json:"outputReplacements,omitempty"`
RegexOutputReplacements []Replacements `json:"regexOutputReplacements,omitempty"`
DefaultEvaluationInterval string `json:"defaultEvaluationInterval,omitempty"`
GroupNamePrefix string `json:"groupNamePrefix,omitempty"`
}
type RegexReplacements ¶
type ReplacementWriter ¶
type ReplacementWriter struct {
// contains filtered or unexported fields
}
func NewReplacementWriter ¶
func NewReplacementWriter(w io.Writer, replacements []Replacements, regexReplacements []RegexReplacements) *ReplacementWriter