Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup deprecated package #123

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
6 changes: 3 additions & 3 deletions promql/cmd/promql-compliance-tester/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"flag"
"fmt"
"math"
"net/http"
"os"
Expand All @@ -11,7 +12,6 @@ import (
"time"

"github.com/cheggaaa/pb/v3"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/api"
v1 "github.com/prometheus/client_golang/api/prometheus/v1"
"github.com/prometheus/common/log"
Expand All @@ -29,7 +29,7 @@ func newPromAPI(targetConfig config.TargetConfig) (v1.API, error) {
}
client, err := api.NewClient(apiConfig)
if err != nil {
return nil, errors.Wrapf(err, "creating Prometheus API client for %q: %v", targetConfig.QueryURL, err)
return nil, fmt.Errorf("error creating Prometheus API client for %q: %w", targetConfig.QueryURL, err)
}

return v1.NewAPI(client), nil
Expand Down Expand Up @@ -180,5 +180,5 @@ func parseTime(s string) (time.Time, error) {
if t, err := time.Parse(time.RFC3339Nano, s); err == nil {
return t, nil
}
return time.Time{}, errors.Errorf("cannot parse %q to a valid timestamp", s)
return time.Time{}, fmt.Errorf("cannot parse %q to a valid timestamp", s)
}
3 changes: 1 addition & 2 deletions promql/comparer/comparer.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/pkg/errors"
v1 "github.com/prometheus/client_golang/api/prometheus/v1"
"github.com/prometheus/common/model"
"github.com/prometheus/compliance/promql/config"
Expand Down Expand Up @@ -91,7 +90,7 @@ func (c *Comparer) Compare(tc *TestCase) (*Result, error) {

if (refErr != nil) != tc.ShouldFail {
if refErr != nil {
return nil, errors.Wrapf(refErr, "querying reference API for %q", tc.Query)
return nil, fmt.Errorf("error querying reference API for %q: %w", tc.Query, refErr)
}
return nil, fmt.Errorf("expected reference API query %q to fail, but succeeded", tc.Query)
}
Expand Down
8 changes: 4 additions & 4 deletions promql/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package config

import (
"bytes"
"fmt"
"os"

"github.com/pkg/errors"
"github.com/prometheus/common/model"
"gopkg.in/yaml.v2"
)
Expand Down Expand Up @@ -65,15 +65,15 @@ func LoadFromFiles(filenames []string) (*Config, error) {
for _, f := range filenames {
content, err := os.ReadFile(f)
if err != nil {
return nil, errors.Wrapf(err, "reading config file %s", f)
return nil, fmt.Errorf("error reading config file %s: %w", f, err)
}
if _, err := buf.Write(content); err != nil {
return nil, errors.Wrapf(err, "appending config file %s to buffer", f)
return nil, fmt.Errorf("error appending config file %s to buffer: %w", f, err)
}
}
cfg, err := Load(buf.Bytes())
if err != nil {
return nil, errors.Wrapf(err, "parsing YAML files %s", filenames)
return nil, fmt.Errorf("error parsing YAML files %s: %w", filenames, err)
}
return cfg, nil
}
Expand Down
1 change: 0 additions & 1 deletion promql/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ go 1.22
require (
github.com/cheggaaa/pb/v3 v3.1.5
github.com/google/go-cmp v0.6.0
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.8.1-0.20201120195816-39b478e90c0b
github.com/prometheus/common v0.14.0
go.uber.org/atomic v1.11.0
Expand Down
1 change: 0 additions & 1 deletion promql/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
4 changes: 2 additions & 2 deletions promql/output/html.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package output

import (
"fmt"
"html/template"
"log"
"os"
"path"

"github.com/pkg/errors"
"github.com/prometheus/compliance/promql/comparer"
"github.com/prometheus/compliance/promql/config"
)
Expand Down Expand Up @@ -45,7 +45,7 @@ var funcMap = map[string]interface{}{
func HTML(tplFile string) (Outputter, error) {
t, err := template.New(path.Base(tplFile)).Funcs(funcMap).ParseFiles(tplFile)
if err != nil {
return nil, errors.Wrapf(err, "parsing template file %q", tplFile)
return nil, fmt.Errorf("error parsing template file %q: %w", tplFile, err)
}

return func(results []*comparer.Result, includePassing bool, tweaks []*config.QueryTweak) {
Expand Down