Skip to content

Commit

Permalink
Bumps github.com/golangci/golangci-lint from 1.30.0 to 1.31.0. (#1781)
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
  • Loading branch information
bogdandrutu authored Sep 14, 2020
1 parent 25d4823 commit e1a90a3
Show file tree
Hide file tree
Showing 17 changed files with 79 additions and 92 deletions.
2 changes: 1 addition & 1 deletion exporter/prometheusremotewriteexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func Test_loadConfig(t *testing.T) {
Endpoint: "localhost:8888",
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
CAFile: "/var/lib/mycert.pem", //This is subject to change, but currently I have no idea what else to put here lol
CAFile: "/var/lib/mycert.pem", // This is subject to change, but currently I have no idea what else to put here lol
},
Insecure: false,
},
Expand Down
6 changes: 3 additions & 3 deletions exporter/prometheusremotewriteexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,21 +208,21 @@ func (prwe *PrwExporter) handleHistogramMetric(tsMap map[string]*prompb.TimeSeri

// export sends a Snappy-compressed WriteRequest containing TimeSeries to a remote write endpoint in order
func (prwe *PrwExporter) export(ctx context.Context, tsMap map[string]*prompb.TimeSeries) error {
//Calls the helper function to convert the TsMap to the desired format
// Calls the helper function to convert the TsMap to the desired format
req, err := wrapTimeSeries(tsMap)
if err != nil {
return err
}

//Uses proto.Marshal to convert the WriteRequest into bytes array
// Uses proto.Marshal to convert the WriteRequest into bytes array
data, err := proto.Marshal(req)
if err != nil {
return err
}
buf := make([]byte, len(data), cap(data))
compressedData := snappy.Encode(buf, data)

//Create the HTTP POST request to send to the endpoint
// Create the HTTP POST request to send to the endpoint
httpReq, err := http.NewRequest("POST", prwe.endpointURL.String(), bytes.NewReader(compressedData))
if err != nil {
return err
Expand Down
17 changes: 8 additions & 9 deletions exporter/prometheusremotewriteexporter/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,24 +124,23 @@ func Test_Shutdown(t *testing.T) {
}
}

//Test whether or not the Server receives the correct TimeSeries.
//Currently considering making this test an iterative for loop of multiple TimeSeries
//Much akin to Test_PushMetrics
// Test whether or not the Server receives the correct TimeSeries.
// Currently considering making this test an iterative for loop of multiple TimeSeries much akin to Test_PushMetrics
func Test_export(t *testing.T) {
//First we will instantiate a dummy TimeSeries instance to pass into both the export call and compare the http request
// First we will instantiate a dummy TimeSeries instance to pass into both the export call and compare the http request
labels := getPromLabels(label11, value11, label12, value12, label21, value21, label22, value22)
sample1 := getSample(floatVal1, msTime1)
sample2 := getSample(floatVal2, msTime2)
ts1 := getTimeSeries(labels, sample1, sample2)
handleFunc := func(w http.ResponseWriter, r *http.Request, code int) {
//The following is a handler function that reads the sent httpRequest, unmarshals, and checks if the WriteRequest
//preserves the TimeSeries data correctly
// The following is a handler function that reads the sent httpRequest, unmarshals, and checks if the WriteRequest
// preserves the TimeSeries data correctly
body, err := ioutil.ReadAll(r.Body)
if err != nil {
t.Fatal(err)
}
require.NotNil(t, body)
//Receives the http requests and unzip, unmarshals, and extracts TimeSeries
// Receives the http requests and unzip, unmarshals, and extracts TimeSeries
assert.Equal(t, "0.1.0", r.Header.Get("X-Prometheus-Remote-Write-Version"))
assert.Equal(t, "snappy", r.Header.Get("Content-Encoding"))
writeReq := &prompb.WriteRequest{}
Expand Down Expand Up @@ -213,12 +212,12 @@ func Test_export(t *testing.T) {
}

func runExportPipeline(t *testing.T, ts *prompb.TimeSeries, endpoint *url.URL) error {
//First we will construct a TimeSeries array from the testutils package
// First we will construct a TimeSeries array from the testutils package
testmap := make(map[string]*prompb.TimeSeries)
testmap["test"] = ts

HTTPClient := http.DefaultClient
//after this, instantiate a CortexExporter with the current HTTP client and endpoint set to passed in endpoint
// after this, instantiate a CortexExporter with the current HTTP client and endpoint set to passed in endpoint
prwe, err := NewPrwExporter("test", endpoint.String(), HTTPClient)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions exporter/prometheusremotewriteexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ import (
"go.opentelemetry.io/collector/config/configtls"
)

//Tests whether or not the default Exporter factory can instantiate a properly interfaced Exporter with default conditions
// Tests whether or not the default Exporter factory can instantiate a properly interfaced Exporter with default conditions
func Test_createDefaultConfig(t *testing.T) {
cfg := createDefaultConfig()
assert.NotNil(t, cfg, "failed to create default config")
assert.NoError(t, configcheck.ValidateConfig(cfg))
}

//Tests whether or not a correct Metrics Exporter from the default Config parameters
// Tests whether or not a correct Metrics Exporter from the default Config parameters
func Test_createMetricsExporter(t *testing.T) {

invalidConfig := createDefaultConfig().(*Config)
Expand Down
2 changes: 1 addition & 1 deletion exporter/prometheusremotewriteexporter/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func wrapTimeSeries(tsMap map[string]*prompb.TimeSeries) (*prompb.WriteRequest,
}
wrapped := prompb.WriteRequest{
Timeseries: TsArray,
//Other parameters of the WriteRequest are unnecessary for our Export
// Other parameters of the WriteRequest are unnecessary for our Export
}
return &wrapped, nil
}
Expand Down
2 changes: 1 addition & 1 deletion exporter/prometheusremotewriteexporter/testutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ var (
invalidIntHistogram = "invalidIntHistogram"
invalidDoubleHistogram = "invalidDoubleHistogram"

//Category 3: nil data points
// Category 3: nil data points
nilDataPointIntGauge = "nilDataPointIntGauge"
nilDataPointDoubleGauge = "nilDataPointDoubleGauge"
nilDataPointIntSum = "nilDataPointIntSum"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ require (
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e
github.com/golang/protobuf v1.4.2
github.com/golang/snappy v0.0.1
github.com/golangci/golangci-lint v1.30.0
github.com/golangci/golangci-lint v1.31.0
github.com/google/addlicense v0.0.0-20200622132530-df58acafd6d5
github.com/google/go-cmp v0.5.2
github.com/google/go-github v17.0.0+incompatible
Expand Down
Loading

0 comments on commit e1a90a3

Please sign in to comment.