Skip to content

Commit

Permalink
Merge pull request #94 from vshn/add/minio_sla_reports
Browse files Browse the repository at this point in the history
Gather VSHNMinio SLA metrics
  • Loading branch information
Kidswiss authored Nov 7, 2023
2 parents 31accba + e4a1c29 commit 24435d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/slareport.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ upload them to an S3 bucket.`,
command.Flags().StringVar(&endpointURL, "endpointurl", viper.GetString("ENDPOINT_URL"), "S3 endpoint url for uploading the reports. ENV: ENDPOINT_URL")
command.Flags().StringVar(&bucket, "bucket", viper.GetString("BUCKET_NAME"), "S3 bucketname for uploading the reports. ENV: BUCKET_NAME")
command.Flags().StringVar(&mimirOrg, "mimirorg", "", "Set the X-Scope-OrgID header for mimir queries")
command.Flags().StringToStringVar(&serviceSlas, "sla", nil, "Set SLA for each service comma separated. Ex. 's1=sla1,s2=sla2'. Available services: vshnpostgresql, vshnredis")
command.Flags().StringToStringVar(&serviceSlas, "sla", nil, "Set SLA for each service comma separated. Ex. 's1=sla1,s2=sla2'. Available services: vshnpostgresql, vshnredis, vshnminio")
command.Flags().BoolVar(&previousMonth, "previousmonth", false, "Run the report for the previous month. Sets the date to the last day of the previous month and range to 30d. This takes precedence over date and range.")

return command
Expand Down
6 changes: 3 additions & 3 deletions pkg/slareport/prom.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var (
promClientFunc = getPrometheusAPIClient
getMetricsFunc = getSLAMetrics
getTargetSLAFunc = getTargetSLA
allowedServices = []string{"vshnpostgresql", "vshnredis"}
allowedServices = []string{"vshnpostgresql", "vshnredis", "vshnminio"}
)

func getPrometheusAPIClient(promURL string, thanosAllowPartialResponses bool, orgID string) (apiv1.API, error) {
Expand Down Expand Up @@ -83,10 +83,10 @@ func RunQuery(ctx context.Context, promURL, timeRange, date, mimirOrg string, se
org = "noOrganizationInfo"
}

l.V(1).Info("Parsing metrics", "org", org)

service := string(sample.Metric["service"])

l.V(1).Info("Parsing metrics", "org", org, "service", service)

if !slices.Contains(allowedServices, strings.ToLower(service)) {
l.V(1).Info("Service not supported: ", service)
continue
Expand Down

0 comments on commit 24435d2

Please sign in to comment.