Skip to content

Commit

Permalink
Review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Lennart Elsen committed Aug 8, 2023
1 parent 5d3d401 commit 9fb57bf
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cmd/global-query/cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func serverEntrypoint(cmd *cobra.Command, args []string) error {

// set up the API server
addr := viper.GetString(conf.ServerAddr)
apiServer := gqserver.New(conf.ServiceName, addr, hostListResolver, querier,
apiServer := gqserver.New(addr, hostListResolver, querier,
// Set the release mode of GIN depending on the log level
server.WithDebugMode(
logging.LevelFromString(viper.GetString(conf.LogLevel)) == logging.LevelDebug,
Expand Down
2 changes: 1 addition & 1 deletion cmd/goProbe/goProbe.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func main() {
// apiOptions = append(apiOptions, api.WithKeys(config.API.Keys))
// }

apiServer = gpserver.New(gpconf.ServiceName, config.API.Addr, captureManager, apiOptions...)
apiServer = gpserver.New(config.API.Addr, captureManager, apiOptions...)
apiServer.SetDBPath(config.DB.Path)

logger.With("addr", config.API.Addr).Info("starting API server")
Expand Down
5 changes: 3 additions & 2 deletions pkg/api/globalquery/server/server.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package server

import (
"github.com/els0r/goProbe/cmd/global-query/pkg/conf"
"github.com/els0r/goProbe/cmd/global-query/pkg/distributed"
"github.com/els0r/goProbe/cmd/global-query/pkg/hosts"
gqapi "github.com/els0r/goProbe/pkg/api/globalquery"
Expand All @@ -16,11 +17,11 @@ type Server struct {
}

// New creates a new global-query API server
func New(serviceName, addr string, resolver hosts.Resolver, querier distributed.Querier, opts ...server.Option) *Server {
func New(addr string, resolver hosts.Resolver, querier distributed.Querier, opts ...server.Option) *Server {
server := &Server{
hostListResolver: resolver,
querier: querier,
DefaultServer: server.NewDefault(serviceName, addr, opts...),
DefaultServer: server.NewDefault(conf.ServiceName, addr, opts...),
}

server.registerRoutes()
Expand Down
5 changes: 3 additions & 2 deletions pkg/api/goprobe/server/server.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package server

import (
"github.com/els0r/goProbe/cmd/goProbe/config"
gpapi "github.com/els0r/goProbe/pkg/api/goprobe"
"github.com/els0r/goProbe/pkg/api/server"
"github.com/els0r/goProbe/pkg/capture"
Expand All @@ -25,11 +26,11 @@ func (server *Server) SetDBPath(path string) *Server {
}

// New creates a new goprobe API server
func New(serviceName, addr string, captureManager *capture.Manager, opts ...server.Option) *Server {
func New(addr string, captureManager *capture.Manager, opts ...server.Option) *Server {
server := &Server{
dbPath: defaults.DBPath,
captureManager: captureManager,
DefaultServer: server.NewDefault(serviceName, addr, opts...),
DefaultServer: server.NewDefault(config.ServiceName, addr, opts...),
}

server.registerRoutes()
Expand Down
1 change: 1 addition & 0 deletions pkg/capture/capture.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ func (c *Capture) capturePacket() error {
c.errMap[err.Error()]++

// add error counter to exposed metric
// TODO: move out to a metric tracked within the c.stats
captureErrors.Inc()

// Shut down the interface thread if too many consecutive decoding failures
Expand Down
2 changes: 1 addition & 1 deletion pkg/capture/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var rotationDuration = prometheus.NewHistogram(prometheus.HistogramOpts{
Name: "rotation_duration_seconds",
Help: "Total flow map rotation time, aggregated across all interfaces",
// rotation is significantly faster than the writeout. Hence the small buckets
Buckets: []float64{0.0001, 0.0005, 0.001, 0.0025, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25},
Buckets: []float64{0.001, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 0.75, 1},
})

func init() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/goprobe/writeout/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var writeoutDuration = prometheus.NewHistogram(prometheus.HistogramOpts{
Name: "writeout_duration_seconds",
Help: "Total flow data writeout time, aggregated across all interfaces written to DB",
// these buckets should capture disks of various speed and setups with many interfaces
Buckets: []float64{0.001, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 5},
Buckets: []float64{0.025, 0.05, 0.1, 0.25, 0.5, 1, 5, 10, 30, 60},
})

func init() {
Expand Down

0 comments on commit 9fb57bf

Please sign in to comment.