Skip to content

Commit

Permalink
Enabling pprof for agent, fixing deployment,host tags for agent metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
devdinu committed Feb 18, 2020
1 parent 5c05afb commit 6c00662
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions agent.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ export AGENT_DEV_MODE=true

export KAFKA_DATA_DIR="/usr/local/var/lib/kafka-logs"
export PROMETHEUS_ENABLED=true

export PPROF_ENABLED=true
2 changes: 1 addition & 1 deletion agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (a *Agent) runJobs() {
default:
}
} else {
logger.Infof("job: %s completed successfully", j.ID())
logger.Debugf("job: %s completed successfully", j.ID())
}
}(j, a.wg)
}
Expand Down
3 changes: 2 additions & 1 deletion agent/metrics/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ func Setup(cfg agcfg.Prometheus, collectors ...prometheus.Collector) (PromClient
}
}()
logger.Debugf("Enabled prometheus at /metris port: %s", cfg.BindPort())
return PromClient{port: cfg.Port, enabled: cfg.Enabled}, nil
tags := Tags{broker: cfg.Host, deployment: cfg.Deployment}
return PromClient{port: cfg.Port, Tags: tags, enabled: cfg.Enabled}, nil
}
logger.Debugf("Prometheus metrics disabled")
return PromClient{}, nil
Expand Down
3 changes: 3 additions & 0 deletions cmd/agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/gojek/kafqa/agent/metrics"
agcfg "github.com/gojek/kafqa/config/agent"
"github.com/gojek/kafqa/logger"
repmetrics "github.com/gojek/kafqa/reporter/metrics"
)

func main() {
Expand All @@ -32,6 +33,8 @@ func main() {
ag := agent.New(cfg, navJob)
go registerSignalHandler(ag)

repmetrics.SetupPProf(cfg.PProf)

errs := ag.Start()
go logErrors(errs)
ag.Wait()
Expand Down
3 changes: 3 additions & 0 deletions config/agent/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"log"
"time"

"github.com/gojek/kafqa/config"
"github.com/hashicorp/go-multierror"
"github.com/kelseyhightower/envconfig"
)
Expand All @@ -13,6 +14,7 @@ type Config struct {
Agent
Kafka
Prometheus
config.PProf
}

type Prometheus struct {
Expand All @@ -38,6 +40,7 @@ func LoadAgentConfig() (Config, error) {
"AGENT": &cfg.Agent,
"KAFKA": &cfg.Kafka,
"PROMETHEUS": &cfg.Prometheus,
"PPROF": &cfg.PProf,
}

err := loadConfigs(cfgs)
Expand Down

0 comments on commit 6c00662

Please sign in to comment.