You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: wasp/alert.go
+11-15Lines changed: 11 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -23,10 +23,11 @@ type AlertChecker struct {
23
23
grafanaClient*grafana.Client
24
24
}
25
25
26
-
// NewAlertChecker initializes a new AlertChecker instance by retrieving the Grafana URL and API token from the environment variables.
27
-
// It panics if either the GRAFANA_URL or GRAFANA_TOKEN environment variable is not set, ensuring that the necessary configuration is available.
28
-
// The function creates a Grafana client using the provided URL and API token, and sets up the AlertChecker with a default requirement label key and a logger.
29
-
// It returns a pointer to the newly created AlertChecker instance, which can be used for checking alerts in Grafana.
26
+
// NewAlertChecker initializes and returns a new AlertChecker instance.
27
+
// It retrieves the Grafana URL and API token from environment variables
28
+
// GRAFANA_URL and GRAFANA_TOKEN, respectively. If either is not set, it
29
+
// panics. The function creates a Grafana client using these credentials
30
+
// and sets up the AlertChecker with a logger and a requirement label key.
// CheckDashboardAlerts retrieves annotations of type "alert" from a specified Grafana dashboard within a given time range.
88
-
// It returns a slice of annotations and an error if any occurred during the retrieval process.
89
-
// If the retrieval is successful, the function sorts the annotations by time from oldest to newest and checks if any alerts are in an "alerting" state.
90
-
// If at least one alert is found to be firing, it returns the annotations along with an error indicating that an alert was firing.
91
-
// If no alerts are firing, it returns the annotations with a nil error.
85
+
// CheckDashboardAlerts retrieves and checks alerts from a Grafana dashboard within a specified time range.
86
+
// It returns a slice of annotations representing the alerts and an error if any alert is in the "alerting" state
87
+
// or if there is an issue retrieving the annotations. The alerts are sorted by time from oldest to newest.
92
88
funcCheckDashboardAlerts(grafanaClient*grafana.Client, from, to time.Time, dashboardUIDstring) ([]grafana.Annotation, error) {
// buildAndPushImage builds a Docker image using the specified configuration and pushes it to a container registry.
208
-
// It constructs the command to execute based on the provided build script, Dockerfile, and context path,
209
-
// along with the image tag, registry, and repository details parsed from the image URI.
210
-
// If any errors occur during the parsing of the image URI or the execution of the build command,
211
-
// the function returns the corresponding error.
212
-
// On successful execution, it returns nil.
199
+
// buildAndPushImage parses the ECR image URI from the configuration and constructs a command to build and push a Docker image. It returns an error if the URI parsing or command execution fails.
0 commit comments