Skip to content

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wlsaud619 committed Apr 9, 2020
1 parent 86e7090 commit 18600de
Show file tree
Hide file tree
Showing 26 changed files with 104 additions and 366 deletions.
11 changes: 6 additions & 5 deletions chains/cosmos/exporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ func Start(log *zap.Logger) {

// nomal guages
for i := 0; i < len(gaugesNamespaceList); i++ {
gauges[i] = metric.NewGauge("exporter", gaugesNamespaceList[i], "")
gauges[i] = utils.NewGauge("exporter", gaugesNamespaceList[i], "")
prometheus.MustRegister(gauges[i])
}


// denom gagues
count := 0
for i := 0; i < len(metric.DenomList)*3; i += 3 {
gaugesDenom[i] = metric.NewGauge("exporter_balances", metric.DenomList[count], "")
gaugesDenom[i+1] = metric.NewGauge("exporter_commission", metric.DenomList[count], "")
gaugesDenom[i+2] = metric.NewGauge("exporter_rewards", metric.DenomList[count], "")
gaugesDenom[i] = utils.NewGauge("exporter_balances", metric.DenomList[count], "")
gaugesDenom[i+1] = utils.NewGauge("exporter_commission", metric.DenomList[count], "")
gaugesDenom[i+2] = utils.NewGauge("exporter_rewards", metric.DenomList[count], "")
prometheus.MustRegister(gaugesDenom[i])
prometheus.MustRegister(gaugesDenom[i+1])
prometheus.MustRegister(gaugesDenom[i+2])
Expand All @@ -49,7 +49,7 @@ func Start(log *zap.Logger) {

// labels
labels := []string{"chainId", "moniker", "operatorAddress", "accountAddress", "consHexAddress"}
gaugesForLabel := metric.NewCounterVec("exporter", "labels", "", labels)
gaugesForLabel := utils.NewCounterVec("exporter", "labels", "", labels)

prometheus.MustRegister(gaugesForLabel)

Expand All @@ -71,6 +71,7 @@ func Start(log *zap.Logger) {

if previousBlockHeight != currentBlockHeight {

fmt.Println("")
log.Info("RPC-Server", zap.Bool("Success", true), zap.String("err", "nil"), zap.String("Get Data", "Block Height: " +fmt.Sprint(currentBlockHeight)))


Expand Down
34 changes: 0 additions & 34 deletions chains/cosmos/exporter/metric/types.go

This file was deleted.

11 changes: 6 additions & 5 deletions chains/emoney/exporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ func Start(log *zap.Logger) {

// nomal guages
for i := 0; i < len(gaugesNamespaceList); i++ {
gauges[i] = metric.NewGauge("exporter", gaugesNamespaceList[i], "")
gauges[i] = utils.NewGauge("exporter", gaugesNamespaceList[i], "")
prometheus.MustRegister(gauges[i])
}


// denom gagues
count := 0
for i := 0; i < len(metric.DenomList)*3; i += 3 {
gaugesDenom[i] = metric.NewGauge("exporter_balances", metric.DenomList[count], "")
gaugesDenom[i+1] = metric.NewGauge("exporter_commission", metric.DenomList[count], "")
gaugesDenom[i+2] = metric.NewGauge("exporter_rewards", metric.DenomList[count], "")
gaugesDenom[i] = utils.NewGauge("exporter_balances", metric.DenomList[count], "")
gaugesDenom[i+1] = utils.NewGauge("exporter_commission", metric.DenomList[count], "")
gaugesDenom[i+2] = utils.NewGauge("exporter_rewards", metric.DenomList[count], "")
prometheus.MustRegister(gaugesDenom[i])
prometheus.MustRegister(gaugesDenom[i+1])
prometheus.MustRegister(gaugesDenom[i+2])
Expand All @@ -49,7 +49,7 @@ func Start(log *zap.Logger) {

// labels
labels := []string{"chainId", "moniker", "operatorAddress", "accountAddress", "consHexAddress"}
gaugesForLabel := metric.NewCounterVec("exporter", "labels", "", labels)
gaugesForLabel := utils.NewCounterVec("exporter", "labels", "", labels)

prometheus.MustRegister(gaugesForLabel)

Expand All @@ -71,6 +71,7 @@ func Start(log *zap.Logger) {

if previousBlockHeight != currentBlockHeight {

fmt.Println("")
log.Info("RPC-Server", zap.Bool("Success", true), zap.String("err", "nil"), zap.String("Get Data", "Block Height: " +fmt.Sprint(currentBlockHeight)))


Expand Down
35 changes: 0 additions & 35 deletions chains/emoney/exporter/metric/types.go

This file was deleted.

6 changes: 4 additions & 2 deletions chains/iov/exporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

rpc "github.com/node-a-team/Cosmos-IE/chains/iov/getData/rpc"
metric "github.com/node-a-team/Cosmos-IE/chains/iov/exporter/metric"
utils "github.com/node-a-team/Cosmos-IE/utils"

"github.com/prometheus/client_golang/prometheus"
)
Expand All @@ -25,13 +26,13 @@ func Start(log *zap.Logger) {

// nomal guages
for i := 0; i < len(gaugesNamespaceList); i++ {
gauges[i] = metric.NewGauge("exporter", gaugesNamespaceList[i], "")
gauges[i] = utils.NewGauge("exporter", gaugesNamespaceList[i], "")
prometheus.MustRegister(gauges[i])
}

// labels
labels := []string{"chainId"}
gaugesForLabel := metric.NewCounterVec("exporter", "labels", "", labels)
gaugesForLabel := utils.NewCounterVec("exporter", "labels", "", labels)

prometheus.MustRegister(gaugesForLabel)

Expand All @@ -53,6 +54,7 @@ func Start(log *zap.Logger) {

if previousBlockHeight != currentBlockHeight {

fmt.Println("")
log.Info("RPC-Server", zap.Bool("Success", true), zap.String("err", "nil"), zap.String("Get Data", "Block Height: " +fmt.Sprint(currentBlockHeight)))


Expand Down
34 changes: 0 additions & 34 deletions chains/iov/exporter/metric/types.go

This file was deleted.

2 changes: 0 additions & 2 deletions chains/iov/getData/rpc/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ func GetData(blockHeight int64, consHexAddr string, log *zap.Logger) *RPCData {
log.Info("RPC-Server", zap.Bool("Success", true), zap.String("err", "nil"), zap.String("Get Data", "Commit Data"),)
}

fmt.Println("consHexAddr: ", consHexAddr)
rd.Commit = getCommit(commitData, consHexAddr)


return rd
}

Expand Down
3 changes: 0 additions & 3 deletions chains/iov/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ func Main(port string) {
log,_ := zap.NewDevelopment()
defer log.Sync()

// cfg.ConfigPath = os.Args[1]

// port := cfg.Init()
rpc.OpenSocket(log)

http.Handle("/metrics", promhttp.Handler())
Expand Down
19 changes: 10 additions & 9 deletions chains/iris/exporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"go.uber.org/zap"
"time"

metric "github.com/node-a-team/cosmos_metric/chains/iris/exporter/metric"
rest "github.com/node-a-team/cosmos_metric/chains/iris/getData/rest"
rpc "github.com/node-a-team/cosmos_metric/chains/iris/getData/rpc"
utils "github.com/node-a-team/cosmos_metric/utils"
metric "github.com/node-a-team/Cosmos-IE/chains/iris/exporter/metric"
rest "github.com/node-a-team/Cosmos-IE/chains/iris/getData/rest"
rpc "github.com/node-a-team/Cosmos-IE/chains/iris/getData/rpc"
utils "github.com/node-a-team/Cosmos-IE/utils"

"github.com/prometheus/client_golang/prometheus"
)
Expand All @@ -26,16 +26,16 @@ func Start(log *zap.Logger) {

// nomal guages
for i := 0; i < len(gaugesNamespaceList); i++ {
gauges[i] = metric.NewGauge("exporter", gaugesNamespaceList[i], "")
gauges[i] = utils.NewGauge("exporter", gaugesNamespaceList[i], "")
prometheus.MustRegister(gauges[i])
}

// denom gagues
count := 0
for i := 0; i < len(metric.DenomList)*3; i += 3 {
gaugesDenom[i] = metric.NewGauge("exporter_balances", metric.DenomList[count], "")
gaugesDenom[i+1] = metric.NewGauge("exporter_commission", metric.DenomList[count], "")
gaugesDenom[i+2] = metric.NewGauge("exporter_rewards", metric.DenomList[count], "")
gaugesDenom[i] = utils.NewGauge("exporter_balances", metric.DenomList[count], "")
gaugesDenom[i+1] = utils.NewGauge("exporter_commission", metric.DenomList[count], "")
gaugesDenom[i+2] = utils.NewGauge("exporter_rewards", metric.DenomList[count], "")
prometheus.MustRegister(gaugesDenom[i])
prometheus.MustRegister(gaugesDenom[i+1])
prometheus.MustRegister(gaugesDenom[i+2])
Expand All @@ -45,7 +45,7 @@ func Start(log *zap.Logger) {

// labels
labels := []string{"chainId", "moniker", "operatorAddress", "accountAddress", "consHexAddress"}
gaugesForLabel := metric.NewCounterVec("exporter", "labels", "", labels)
gaugesForLabel := utils.NewCounterVec("exporter", "labels", "", labels)

prometheus.MustRegister(gaugesForLabel)

Expand All @@ -65,6 +65,7 @@ func Start(log *zap.Logger) {

if previousBlockHeight != currentBlockHeight {

fmt.Println("")
log.Info("RPC-Server", zap.Bool("Success", true), zap.String("err", "nil"), zap.String("Get Data", "Block Height: "+fmt.Sprint(currentBlockHeight)))

restData, consHexAddr := rest.GetData(currentBlockHeight, log)
Expand Down
6 changes: 3 additions & 3 deletions chains/iris/exporter/metric/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package metric
import (
"go.uber.org/zap"

rest "github.com/node-a-team/cosmos_metric/chains/iris/getData/rest"
rpc "github.com/node-a-team/cosmos_metric/chains/iris/getData/rpc"
utils "github.com/node-a-team/cosmos_metric/utils"
rest "github.com/node-a-team/Cosmos-IE/chains/iris/getData/rest"
rpc "github.com/node-a-team/Cosmos-IE/chains/iris/getData/rpc"
utils "github.com/node-a-team/Cosmos-IE/utils"
)

var (
Expand Down
31 changes: 0 additions & 31 deletions chains/iris/exporter/metric/types.go

This file was deleted.

2 changes: 1 addition & 1 deletion chains/iris/getData/rest/delegations.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"go.uber.org/zap"
"strings"

utils "github.com/node-a-team/cosmos_metric/utils"
utils "github.com/node-a-team/Cosmos-IE/utils"
)

/*
Expand Down
2 changes: 1 addition & 1 deletion chains/iris/getData/rest/inflation.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"go.uber.org/zap"
"strings"

utils "github.com/node-a-team/cosmos_metric/utils"
utils "github.com/node-a-team/Cosmos-IE/utils"
)

type param struct {
Expand Down
2 changes: 1 addition & 1 deletion chains/iris/getData/rest/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"go.uber.org/zap"
"os/exec"

utils "github.com/node-a-team/cosmos_metric/utils"
utils "github.com/node-a-team/Cosmos-IE/utils"
)

var (
Expand Down
7 changes: 2 additions & 5 deletions chains/iris/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,15 @@ import (

"github.com/prometheus/client_golang/prometheus/promhttp"

"github.com/node-a-team/cosmos_metric/chains/iris/exporter"
rpc "github.com/node-a-team/cosmos_metric/chains/iris/getData/rpc"
"github.com/node-a-team/Cosmos-IE/chains/iris/exporter"
rpc "github.com/node-a-team/Cosmos-IE/chains/iris/getData/rpc"
)

func Main(port string) {

log, _ := zap.NewDevelopment()
defer log.Sync()

// cfg.ConfigPath = os.Args[1]

// port := cfg.Init()
rpc.OpenSocket(log)

http.Handle("/metrics", promhttp.Handler())
Expand Down
Loading

0 comments on commit 18600de

Please sign in to comment.