Skip to content

Commit

Permalink
address lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
huyan0 committed Aug 11, 2020
1 parent be9454a commit e6c5533
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 6 deletions.
6 changes: 3 additions & 3 deletions exporter/prometheusremotewriteexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func (prwe *prwExporter) handleSummaryMetric(tsMap map[string]*prompb.TimeSeries
// process each percentile/quantile
for _, qt := range pt.GetPercentileValues() {
quantile := &prompb.Sample{
Value: float64(qt.Value),
Value: qt.Value,
Timestamp: time,
}
percentileStr := strconv.FormatFloat(qt.Percentile, 'f', -1, 64)
Expand All @@ -298,9 +298,9 @@ func (prwe *prwExporter) handleSummaryMetric(tsMap map[string]*prompb.TimeSeries
// Because we are adhering closely to the Remote Write API, we must Export a
// Snappy-compressed WriteRequest instance of the TimeSeries Metrics in order
// for the Remote Write Endpoint to properly receive our Metrics data.
func (prwe *prwExporter) export(ctx context.Context, TsMap map[string]*prompb.TimeSeries) error {
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
req, err := wrapTimeSeries(TsMap)
req, err := wrapTimeSeries(tsMap)
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions exporter/prometheusremotewriteexporter/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,12 @@ func getPromMetricName(desc *otlp.MetricDescriptor, ns string) string {

// Simple helper function that takes the <Signature String - *TimeSeries> map
// and creates a WriteRequest from the struct -- can move to the helper.go file
func wrapTimeSeries(TsMap map[string]*prompb.TimeSeries) (*prompb.WriteRequest, error) {
if len(TsMap) == 0 {
func wrapTimeSeries(tsMap map[string]*prompb.TimeSeries) (*prompb.WriteRequest, error) {
if len(tsMap) == 0 {
return nil, errors.Errorf("invalid TsMap: cannot be empty map")
}
TsArray := []prompb.TimeSeries{}
for _, v := range TsMap {
for _, v := range tsMap {
TsArray = append(TsArray, *v)
}
wrapped := prompb.WriteRequest{
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ require (
github.com/gogo/protobuf v1.3.1
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/google/addlicense v0.0.0-20200622132530-df58acafd6d5
github.com/google/go-cmp v0.5.1
Expand Down
Loading

0 comments on commit e6c5533

Please sign in to comment.