Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cmd/plugin-backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ import (
"strconv"
"strings"

server "github.com/openshift/monitoring-plugin/pkg"
"github.com/sirupsen/logrus"

server "github.com/openshift/monitoring-plugin/pkg"
)

var (
portArg = flag.Int("port", 0, "server port to listen on (default: 9443)\nports 9444 and 9445 reserved for other use")
certArg = flag.String("cert", "", "cert file path to enable TLS (disabled by default)")
keyArg = flag.String("key", "", "private key file path to enable TLS (disabled by default)")
featuresArg = flag.String("features", "", "enabled features, comma separated.\noptions: ['acm-alerting', 'incidents', 'dev-config', 'perses-dashboards']")
featuresArg = flag.String("features", "", "enabled features, comma separated.\noptions: ['acm-alerting', 'incidents', 'dev-config', 'perses-dashboards', 'alert-management-api']")
staticPathArg = flag.String("static-path", "", "static files path to serve frontend (default: './web/dist')")
configPathArg = flag.String("config-path", "", "config files path (default: './config')")
pluginConfigArg = flag.String("plugin-config-path", "", "plugin yaml configuration")
Expand Down
96 changes: 64 additions & 32 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,55 +6,87 @@ require (
github.com/evanphx/json-patch v4.12.0+incompatible
github.com/gorilla/handlers v1.5.2
github.com/gorilla/mux v1.8.1
github.com/onsi/ginkgo/v2 v2.22.0
github.com/onsi/gomega v1.36.1
github.com/openshift/api v0.0.0-20251122153900-88cca31a44c9
github.com/openshift/client-go v0.0.0-20251123231646-4685125c2287
github.com/openshift/library-go v0.0.0-20240905123346-5bdbfe35a6f5
Comment on lines +12 to 13
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

prometheus/prometheus v0.308.0 release validity

💡 Result:

Yes—prometheus/prometheus v0.308.0 is a real, official GitHub release tag.

  • GitHub shows a release page for v0.308.0, pointing to commit e44ed35, and indicates it was tagged on Dec 2, 2025 (tagged by jan--f). [1]
  • Independent release indexing also lists v0.308.0 as released on Dec 2, 2025. [2]

Conclusion: v0.308.0 is a valid Prometheus repository release/tag (not a fabricated version). [1]

Sources: [1] GitHub release tag page, [2] ReleaseAlert release index.


🏁 Script executed:

# Find vars.go file in the repository
fd vars.go

Repository: openshift/monitoring-plugin

Length of output: 86


🏁 Script executed:

# Check the go.mod file to see if prometheus/prometheus dependency is listed
cat go.mod

Repository: openshift/monitoring-plugin

Length of output: 4293


🏁 Script executed:

cat -n pkg/k8s/vars.go

Repository: openshift/monitoring-plugin

Length of output: 1777


🌐 Web query:

prometheus v0.308.0 API endpoints /alerts /rules

💡 Result:

In Prometheus, the HTTP API endpoints for alerts and rules are:

  • Active alerts: GET /api/v1/alerts (returns all currently active alerts) [1]
  • Loaded rules: GET /api/v1/rules (returns currently loaded recording + alerting rules, and includes active alerts per alerting rule) [1]

/api/v1/rules optional query params include: type=alert|record, rule_name[]=..., rule_group[]=..., file[]=..., plus pagination via group_limit + group_next_token [1].

Note: These are Prometheus server endpoints. If you meant Alertmanager’s alerts API (to send alerts), that’s POST /api/v2/alerts on Alertmanager, not Prometheus [2].

Sources: [1] [2]


🌐 Web query:

prometheus http API paths /v1/alerts /v1/rules documentation

💡 Result:

In Prometheus (server), the stable HTTP API is rooted at /api/v1 (not /v1). (prometheus.io)

Active alerts (Prometheus)

  • Path: GET /api/v1/alerts
  • Docs: Prometheus “HTTP API” → “Alerts” (prometheus.io)

Loaded rules (Prometheus)

  • Path: GET /api/v1/rules
  • Optional filters include type=alert|record, rule_name[], rule_group[], file[], plus pagination via group_next_token (with group_limit). (prometheus.io)

Common gotcha: Alertmanager “/v1/alerts”

If you meant Alertmanager’s alerts ingestion endpoint: Alertmanager API v1 was deprecated (0.16.0) and removed (0.27.0); use POST /api/v2/alerts instead. (prometheus.io)

Citations:


Fix API paths: add missing /api prefix to Prometheus endpoints.

The paths defined in vars.go lines 12–13 are incorrect. The Prometheus HTTP API uses /api/v1/alerts and /api/v1/rules, not /v1/alerts and /v1/rules. This applies to prometheus/prometheus v0.308.0 and all other versions—the /api prefix is required.

Current (incorrect) paths:
PrometheusAlertsPath = "/v1/alerts"
PrometheusRulesPath = "/v1/rules"

Update both constants to include the /api prefix to match the official Prometheus API specification.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@go.mod` around lines 12 - 13, Update the Prometheus endpoint constants in
vars.go so they include the required "/api" prefix: change the
PrometheusAlertsPath and PrometheusRulesPath constants from "/v1/alerts" and
"/v1/rules" to "/api/v1/alerts" and "/api/v1/rules" respectively; locate the
symbols PrometheusAlertsPath and PrometheusRulesPath in vars.go and modify their
string values to the corrected paths.

github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.87.0
github.com/prometheus-operator/prometheus-operator/pkg/client v0.87.0
github.com/prometheus/common v0.67.4
github.com/prometheus/prometheus v0.308.0
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.9.0
github.com/stretchr/testify v1.11.1
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.31.1
k8s.io/apiserver v0.30.3
k8s.io/client-go v0.31.1
k8s.io/api v0.34.2
k8s.io/apimachinery v0.34.2
k8s.io/apiserver v0.34.2
k8s.io/client-go v0.34.2
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
github.com/dennwc/varint v1.0.0 // indirect
github.com/emicklei/go-restful/v3 v3.13.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-openapi/jsonpointer v0.22.1 // indirect
github.com/go-openapi/jsonreference v0.21.2 // indirect
github.com/go-openapi/swag v0.25.1 // indirect
github.com/go-openapi/swag/cmdutils v0.25.1 // indirect
github.com/go-openapi/swag/conv v0.25.1 // indirect
github.com/go-openapi/swag/fileutils v0.25.1 // indirect
github.com/go-openapi/swag/jsonname v0.25.1 // indirect
github.com/go-openapi/swag/jsonutils v0.25.1 // indirect
github.com/go-openapi/swag/loading v0.25.1 // indirect
github.com/go-openapi/swag/mangling v0.25.1 // indirect
github.com/go-openapi/swag/netutils v0.25.1 // indirect
github.com/go-openapi/swag/stringutils v0.25.1 // indirect
github.com/go-openapi/swag/typeutils v0.25.1 // indirect
github.com/go-openapi/swag/yamlutils v0.25.1 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/gnostic-models v0.7.0 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/pprof v0.0.0-20250923004556-9e5a51aed1e8 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/grafana/regexp v0.0.0-20250905093917-f7b3be9d1853 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.23.2 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/procfs v0.16.1 // indirect
github.com/spf13/pflag v1.0.6 // indirect
github.com/x448/float16 v0.8.4 // indirect
golang.org/x/net v0.34.0 // indirect
golang.org/x/oauth2 v0.25.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/term v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.9.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/net v0.46.0 // indirect
golang.org/x/oauth2 v0.32.0 // indirect
golang.org/x/sys v0.37.0 // indirect
golang.org/x/term v0.36.0 // indirect
golang.org/x/text v0.30.0 // indirect
golang.org/x/time v0.13.0 // indirect
golang.org/x/tools v0.37.0 // indirect
google.golang.org/protobuf v1.36.10 // indirect
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apimachinery v0.31.1 // indirect
k8s.io/apiextensions-apiserver v0.34.2 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240808142205-8e686545bdb8 // indirect
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 // indirect
sigs.k8s.io/controller-runtime v0.22.3 // indirect
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
sigs.k8s.io/yaml v1.6.0 // indirect
)
Loading