Skip to content

Commit

Permalink
telemetry: address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
panoel committed Dec 4, 2023
1 parent d6248b9 commit fa33724
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 22 deletions.
2 changes: 1 addition & 1 deletion node/cmd/guardiand/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -1055,11 +1055,11 @@ func runNode(cmd *cobra.Command, args []string) {
if (err != nil) || (statusPort64 == 0) {
logger.Fatal("Please specify a valid --statusAddr")
} else {
// TODO: check when the http server gets started.
info.StatusPort = uint16(statusPort64)
promLogger := logger.With(zap.String("component", "prometheus_scraper"))
errC := make(chan error)
common.StartRunnable(rootCtx, errC, false, "prometheus_scraper", func(ctx context.Context) error {
// This initial sleep allows the http server to start up.
t := time.NewTicker(15 * time.Second)

for {
Expand Down
2 changes: 2 additions & 0 deletions node/pkg/proto/prometheus/v1/remote.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions node/pkg/proto/prometheus/v1/types.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions node/pkg/telemetry/prom_remote_write/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// limitations under the License.

// NOTICE: THIS FILE HAS BEEN MODIFIED FROM THE ORIGINAL
// Changes were made to use go protobuf instead of gogo protobuf.
// Original code is here: https://github.com/prometheus/prometheus/blob/e4ec263bcc11493953c75d1b2e7bc78fd0463e05/util/fmtutil/format.go

package promremotew

Expand Down
9 changes: 1 addition & 8 deletions node/pkg/telemetry/prom_remote_write/prom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"testing"

// "github.com/certusone/wormhole/node/pkg/telemetry/prom_remote_write/prompb"
prometheusv1 "github.com/certusone/wormhole/node/pkg/proto/prometheus/v1"
"google.golang.org/protobuf/proto"

Expand Down Expand Up @@ -201,14 +200,8 @@ func TestMarshalUnmarshal(t *testing.T) {
wr := prometheusv1.WriteRequest{Timeseries: timeseries}
bytes, err := proto.Marshal(&wr)
require.NoError(t, err)
// if err != nil {
// panic("Failed to marshall: " + err.Error())
// }

newWr := prometheusv1.WriteRequest{}
err = proto.Unmarshal(bytes, &newWr) // this line causes panic
err = proto.Unmarshal(bytes, &newWr)
require.NoError(t, err)
// if err != nil {
// panic("Failed to unmarshall: " + err.Error())
// }
}
13 changes: 0 additions & 13 deletions node/pkg/telemetry/prom_remote_write/scrape.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,3 @@ func ScrapeAndSendLocalMetrics(ctx context.Context, info PromTelemetryInfo, logg
}
return nil
}

// func StartPrometheusScraper(ctx context.Context, info PromTelemetryInfo, logger *zap.Logger) error {
// promLogger := logger.With(zap.String("component", "prometheus_scraper"))
// for {
// // Sleeping first to give things a chance to set up
// time.Sleep(15 * time.Second)
// ScrapeAndSendLocalMetrics(info, promLogger)
// select {
// case <-ctx.Done():
// return ctx.Err()
// }
// }
// }
2 changes: 2 additions & 0 deletions proto/prometheus/v1/remote.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// limitations under the License.

// NOTICE: THIS FILE HAS BEEN MODIFIED FROM THE ORIGINAL
// Changes were made to use go protobuf instead of gogo protobuf.
// Original code is here: https://github.com/prometheus/prometheus/blob/e4ec263bcc11493953c75d1b2e7bc78fd0463e05/prompb/remote.proto

syntax = "proto3";
package prometheus.v1;
Expand Down
2 changes: 2 additions & 0 deletions proto/prometheus/v1/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// limitations under the License.

// NOTICE: THIS FILE HAS BEEN MODIFIED FROM THE ORIGINAL
// Changes were made to use go protobuf instead of gogo protobuf.
// Original code is here: https://github.com/prometheus/prometheus/blob/e4ec263bcc11493953c75d1b2e7bc78fd0463e05/prompb/types.proto

syntax = "proto3";
package prometheus.v1;
Expand Down

0 comments on commit fa33724

Please sign in to comment.