mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-24 21:24:05 -08:00
Add license header to fix CI
Signed-off-by: Mustafain Ali Khan <mustalik@amazon.com>
This commit is contained in:
parent
0736877480
commit
c432672c14
|
@ -42,6 +42,7 @@ const (
|
||||||
alertMetricName = "ALERTS"
|
alertMetricName = "ALERTS"
|
||||||
// AlertForStateMetricName is the metric name for 'for' state of alert.
|
// AlertForStateMetricName is the metric name for 'for' state of alert.
|
||||||
alertForStateMetricName = "ALERTS_FOR_STATE"
|
alertForStateMetricName = "ALERTS_FOR_STATE"
|
||||||
|
|
||||||
// AlertStateLabel is the label name indicating the state of an alert.
|
// AlertStateLabel is the label name indicating the state of an alert.
|
||||||
alertStateLabel = "alertstate"
|
alertStateLabel = "alertstate"
|
||||||
)
|
)
|
||||||
|
@ -577,6 +578,8 @@ func (r *AlertingRule) sendAlerts(ctx context.Context, ts time.Time, resendDelay
|
||||||
notifyFunc(ctx, r.vector.String(), alerts...)
|
notifyFunc(ctx, r.vector.String(), alerts...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note that changing format of String() changes value of GetFingerprint() leading to loss of persisted state
|
||||||
|
// when the `alert-state-persistence` feature is enabled.
|
||||||
func (r *AlertingRule) String() string {
|
func (r *AlertingRule) String() string {
|
||||||
ar := rulefmt.Rule{
|
ar := rulefmt.Rule{
|
||||||
Alert: r.name,
|
Alert: r.name,
|
||||||
|
|
|
@ -129,7 +129,7 @@ type ManagerOptions struct {
|
||||||
RuleDependencyController RuleDependencyController
|
RuleDependencyController RuleDependencyController
|
||||||
AlertStore AlertStore
|
AlertStore AlertStore
|
||||||
|
|
||||||
Metrics *Metrics
|
Metrics *Metrics
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewManager returns an implementation of Manager, ready to be started
|
// NewManager returns an implementation of Manager, ready to be started
|
||||||
|
|
|
@ -1,3 +1,16 @@
|
||||||
|
// Copyright 2024 The Prometheus Authors
|
||||||
|
// 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.
|
||||||
|
|
||||||
package rules
|
package rules
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -65,9 +78,9 @@ func (s *FileStore) initState(registerer prometheus.Registerer) {
|
||||||
var data *FileData
|
var data *FileData
|
||||||
err = json.NewDecoder(file).Decode(&data)
|
err = json.NewDecoder(file).Decode(&data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
data = nil
|
|
||||||
s.logger.Error("Failed reading alerts state from file", "err", err)
|
s.logger.Error("Failed reading alerts state from file", "err", err)
|
||||||
s.storeInitErrors.Inc()
|
s.storeInitErrors.Inc()
|
||||||
|
return
|
||||||
}
|
}
|
||||||
alertsByRule := make(map[uint64][]*Alert)
|
alertsByRule := make(map[uint64][]*Alert)
|
||||||
if data != nil && data.Alerts != nil {
|
if data != nil && data.Alerts != nil {
|
||||||
|
|
|
@ -1,3 +1,16 @@
|
||||||
|
// Copyright 2024 The Prometheus Authors
|
||||||
|
// 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.
|
||||||
|
|
||||||
package rules
|
package rules
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -6,9 +19,9 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
"github.com/prometheus/common/promslog"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/prometheus/common/promslog"
|
|
||||||
"github.com/prometheus/prometheus/model/labels"
|
"github.com/prometheus/prometheus/model/labels"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue