Skip to content

Commit cac28d3

Browse files
committed
Deprecate and remove api/v1/
Signed-off-by: gotjosh <josue.abreu@gmail.com>
1 parent 3f3e2ce commit cac28d3

File tree

12 files changed

+1
-3902
lines changed

12 files changed

+1
-3902
lines changed

api/api.go

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"github.com/prometheus/common/model"
2626
"github.com/prometheus/common/route"
2727

28-
apiv1 "github.com/prometheus/alertmanager/api/v1"
2928
apiv2 "github.com/prometheus/alertmanager/api/v2"
3029
"github.com/prometheus/alertmanager/cluster"
3130
"github.com/prometheus/alertmanager/config"
@@ -37,7 +36,6 @@ import (
3736

3837
// API represents all APIs of Alertmanager.
3938
type API struct {
40-
v1 *apiv1.API
4139
v2 *apiv2.API
4240
requestsInFlight prometheus.Gauge
4341
concurrencyLimitExceeded prometheus.Counter
@@ -110,15 +108,6 @@ func New(opts Options) (*API, error) {
110108
}
111109
}
112110

113-
v1 := apiv1.New(
114-
opts.Alerts,
115-
opts.Silences,
116-
opts.StatusFunc,
117-
opts.Peer,
118-
log.With(l, "version", "v1"),
119-
opts.Registry,
120-
)
121-
122111
v2, err := apiv2.NewAPI(
123112
opts.Alerts,
124113
opts.GroupFunc,
@@ -154,7 +143,6 @@ func New(opts Options) (*API, error) {
154143
}
155144

156145
return &API{
157-
v1: v1,
158146
v2: v2,
159147
requestsInFlight: requestsInFlight,
160148
concurrencyLimitExceeded: concurrencyLimitExceeded,
@@ -163,17 +151,14 @@ func New(opts Options) (*API, error) {
163151
}, nil
164152
}
165153

166-
// Register all APIs. It registers APIv1 with the provided router directly. As
167-
// APIv2 works on the http.Handler level, this method also creates a new
154+
// Register all APIs. As APIv2 works on the http.Handler level, this method also creates a new
168155
// http.ServeMux and then uses it to register both the provided router (to
169156
// handle "/") and APIv2 (to handle "<routePrefix>/api/v2"). The method returns
170157
// the newly created http.ServeMux. If a timeout has been set on construction of
171158
// API, it is enforced for all HTTP request going through this mux. The same is
172159
// true for the concurrency limit, with the exception that it is only applied to
173160
// GET requests.
174161
func (api *API) Register(r *route.Router, routePrefix string) *http.ServeMux {
175-
api.v1.Register(r.WithPrefix("/api/v1"))
176-
177162
mux := http.NewServeMux()
178163
mux.Handle("/", api.limitHandler(r))
179164

@@ -196,7 +181,6 @@ func (api *API) Register(r *route.Router, routePrefix string) *http.ServeMux {
196181
// Update config and resolve timeout of each API. APIv2 also needs
197182
// setAlertStatus to be updated.
198183
func (api *API) Update(cfg *config.Config, setAlertStatus func(model.LabelSet)) {
199-
api.v1.Update(cfg)
200184
api.v2.Update(cfg, setAlertStatus)
201185
}
202186

0 commit comments

Comments
 (0)