Skip to content

Commit

Permalink
Add grafana dashboards.
Browse files Browse the repository at this point in the history
Fix ports in agents and qed server.
  • Loading branch information
Jose Luis Lucas authored and iknite committed Feb 19, 2019
1 parent 3af05fc commit febffef
Show file tree
Hide file tree
Showing 15 changed files with 1,996 additions and 110 deletions.
19 changes: 19 additions & 0 deletions balloon/balloon.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import (
"github.com/bbva/qed/metrics"
"github.com/bbva/qed/storage"
"github.com/bbva/qed/util"

"github.com/prometheus/client_golang/prometheus"
)

var (
Expand Down Expand Up @@ -180,6 +182,11 @@ func (b *Balloon) RefreshVersion() error {

func (b *Balloon) Add(event []byte) (*Snapshot, []*storage.Mutation, error) {

// Metrics
metrics.Qed_balloon_add_total.Inc()
timer := prometheus.NewTimer(metrics.Qed_balloon_add_duration_seconds)
defer timer.ObserveDuration()

// Activate metrics gathering
stats := metrics.Balloon

Expand Down Expand Up @@ -281,10 +288,22 @@ func (b Balloon) QueryDigestMembership(keyDigest hashing.Digest, version uint64)

func (b Balloon) QueryMembership(event []byte, version uint64) (*MembershipProof, error) {
hasher := b.hasherF()

// Metrics
metrics.Qed_balloon_membership_total.Inc()
timer := prometheus.NewTimer(metrics.Qed_balloon_membership_duration_seconds)
defer timer.ObserveDuration()

return b.QueryDigestMembership(hasher.Do(event), version)
}

func (b Balloon) QueryConsistency(start, end uint64) (*IncrementalProof, error) {

// Metrics
metrics.Qed_balloon_incremental_total.Inc()
timer := prometheus.NewTimer(metrics.Qed_balloon_incremental_duration_seconds)
defer timer.ObserveDuration()

stats := metrics.Balloon
stats.AddFloat("QueryConsistency", 1)
var proof IncrementalProof
Expand Down
3 changes: 2 additions & 1 deletion cmd/agent_auditor.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ func newAgentAuditorCommand(ctx cmdContext, config gossip.Config, agentPreRun fu
config = agentPreRun(config)

// Bindings
auditorConfig.MetricsAddr = config.BindAddr // TODO: make MetricsAddr configurable
auditorConfig.QEDUrls = v.GetStringSlice("agent.server_urls")
auditorConfig.PubUrls = v.GetStringSlice("agent.alert_urls")

markSliceStringRequired(auditorConfig.QEDUrls, "qedUrls")
markSliceStringRequired(auditorConfig.PubUrls, "pubUrls")

},
Run: func(cmd *cobra.Command, args []string) {

Expand Down
3 changes: 2 additions & 1 deletion cmd/agent_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ func newAgentMonitorCommand(ctx cmdContext, config gossip.Config, agentPreRun fu
config = agentPreRun(config)

// Bindings
monitorConfig.MetricsAddr = config.BindAddr // TODO: make MetricsAddr configurable
monitorConfig.QEDUrls = v.GetStringSlice("agent.server_urls")
monitorConfig.PubUrls = v.GetStringSlice("agent.alert_urls")

markSliceStringRequired(monitorConfig.QEDUrls, "qedUrls")
markSliceStringRequired(monitorConfig.PubUrls, "pubUrls")

},
Run: func(cmd *cobra.Command, args []string) {

Expand Down
10 changes: 5 additions & 5 deletions cmd/agent_publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

func newAgentPublisherCommand(ctx cmdContext, config gossip.Config, agentPreRun func(gossip.Config) gossip.Config) *cobra.Command {

var endpoints []string
publisherConfig := publisher.DefaultConfig()

cmd := &cobra.Command{
Use: "publisher",
Expand All @@ -41,14 +41,14 @@ func newAgentPublisherCommand(ctx cmdContext, config gossip.Config, agentPreRun
config = agentPreRun(config)

// Bindings
endpoints = v.GetStringSlice("agent.snapshots_store_urls")
markSliceStringRequired(endpoints, "pubUrls")
publisherConfig.MetricsAddr = config.BindAddr // TODO: make MetricsAddr configurable
publisherConfig.PubUrls = v.GetStringSlice("agent.snapshots_store_urls")

markSliceStringRequired(publisherConfig.PubUrls, "pubUrls")
},
Run: func(cmd *cobra.Command, args []string) {

config.Role = member.Publisher
publisherConfig := publisher.NewConfig(endpoints)

publisher, err := publisher.NewPublisher(*publisherConfig)
if err != nil {
Expand All @@ -72,7 +72,7 @@ func newAgentPublisherCommand(ctx cmdContext, config gossip.Config, agentPreRun
}

f := cmd.Flags()
f.StringSliceVarP(&endpoints, "pubUrls", "", []string{},
f.StringSliceVarP(&publisherConfig.PubUrls, "pubUrls", "", []string{},
"Comma-delimited list of end-publishers ([host]:port), through which an publisher can send requests")

// Lookups
Expand Down
Loading

0 comments on commit febffef

Please sign in to comment.