Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TrustStore: Add metrics #3628

Merged
merged 2 commits into from
Jan 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions go/beacon_srv/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ go_library(
"//go/lib/infra/modules/idiscovery:go_default_library",
"//go/lib/infra/modules/itopo:go_default_library",
"//go/lib/infra/modules/trust:go_default_library",
"//go/lib/infra/modules/trust/trustdbmetrics:go_default_library",
"//go/lib/keyconf:go_default_library",
"//go/lib/log:go_default_library",
"//go/lib/periodic:go_default_library",
Expand Down
7 changes: 5 additions & 2 deletions go/beacon_srv/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import (
"github.com/scionproto/scion/go/lib/infra/modules/idiscovery"
"github.com/scionproto/scion/go/lib/infra/modules/itopo"
"github.com/scionproto/scion/go/lib/infra/modules/trust"
"github.com/scionproto/scion/go/lib/infra/modules/trust/trustdbmetrics"
"github.com/scionproto/scion/go/lib/keyconf"
"github.com/scionproto/scion/go/lib/log"
"github.com/scionproto/scion/go/lib/periodic"
Expand Down Expand Up @@ -144,6 +145,7 @@ func realMain() int {
log.Crit("Error initializing trust database", "err", err)
return 1
}
trustDB = trustdbmetrics.WithMetrics(string(cfg.TrustDB.Backend()), trustDB)
defer trustDB.Close()
inserter := trust.ForwardingInserter{
BaseInserter: trust.BaseInserter{DB: trustDB},
Expand All @@ -157,6 +159,7 @@ func realMain() int {
DB: trustDB,
Inserter: inserter,
RPC: trust.DefaultRPC{Msgr: msgr},
IA: topo.IA(),
},
Router: trust.LocalRouter{IA: topo.IA()},
}
Expand All @@ -180,8 +183,8 @@ func realMain() int {
defer store.Close()
intfs = ifstate.NewInterfaces(topo.IFInfoMap(), ifstate.Config{})
prometheus.MustRegister(ifstate.NewCollector(intfs))
msgr.AddHandler(infra.ChainRequest, trustStore.NewChainReqHandler())
msgr.AddHandler(infra.TRCRequest, trustStore.NewTRCReqHandler())
msgr.AddHandler(infra.ChainRequest, trustStore.NewChainReqHandler(topo.IA()))
msgr.AddHandler(infra.TRCRequest, trustStore.NewTRCReqHandler(topo.IA()))
msgr.AddHandler(infra.IfStateReq, ifstate.NewHandler(intfs))
msgr.AddHandler(infra.SignedRev, revocation.NewHandler(store,
trust.NewVerifier(trustStore), 5*time.Second))
Expand Down
1 change: 1 addition & 0 deletions go/cert_srv/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ go_library(
"//go/lib/infra/modules/idiscovery:go_default_library",
"//go/lib/infra/modules/itopo:go_default_library",
"//go/lib/infra/modules/trust:go_default_library",
"//go/lib/infra/modules/trust/trustdbmetrics:go_default_library",
"//go/lib/keyconf:go_default_library",
"//go/lib/log:go_default_library",
"//go/lib/periodic:go_default_library",
Expand Down
11 changes: 7 additions & 4 deletions go/cert_srv/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import (
"github.com/scionproto/scion/go/lib/infra/modules/idiscovery"
"github.com/scionproto/scion/go/lib/infra/modules/itopo"
"github.com/scionproto/scion/go/lib/infra/modules/trust"
"github.com/scionproto/scion/go/lib/infra/modules/trust/trustdbmetrics"
"github.com/scionproto/scion/go/lib/keyconf"
"github.com/scionproto/scion/go/lib/log"
"github.com/scionproto/scion/go/lib/periodic"
Expand Down Expand Up @@ -129,6 +130,7 @@ func realMain() int {
log.Crit("Error initializing trust database", "err", err)
return 1
}
trustDB = trustdbmetrics.WithMetrics(string(cfg.TrustDB.Backend()), trustDB)
defer trustDB.Close()
inserter := trust.DefaultInserter{
BaseInserter: trust.BaseInserter{DB: trustDB},
Expand All @@ -140,6 +142,7 @@ func realMain() int {
DB: trustDB,
Inserter: inserter,
RPC: trust.DefaultRPC{Msgr: msgr},
IA: topo.IA(),
},
Router: trust.AuthRouter{
ISD: topo.IA().I,
Expand Down Expand Up @@ -172,10 +175,10 @@ func realMain() int {
return 1
}

msgr.AddHandler(infra.ChainRequest, trustStore.NewChainReqHandler())
msgr.AddHandler(infra.TRCRequest, trustStore.NewTRCReqHandler())
msgr.AddHandler(infra.Chain, trustStore.NewChainPushHandler())
msgr.AddHandler(infra.TRC, trustStore.NewTRCPushHandler())
msgr.AddHandler(infra.ChainRequest, trustStore.NewChainReqHandler(topo.IA()))
msgr.AddHandler(infra.TRCRequest, trustStore.NewTRCReqHandler(topo.IA()))
msgr.AddHandler(infra.Chain, trustStore.NewChainPushHandler(topo.IA()))
msgr.AddHandler(infra.TRC, trustStore.NewTRCPushHandler(topo.IA()))
msgr.UpdateSigner(signer, []infra.MessageType{infra.ChainIssueRequest})
msgr.UpdateVerifier(trust.NewVerifier(trustStore))

Expand Down
1 change: 1 addition & 0 deletions go/cs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ go_library(
"//go/lib/infra/modules/idiscovery:go_default_library",
"//go/lib/infra/modules/itopo:go_default_library",
"//go/lib/infra/modules/trust:go_default_library",
"//go/lib/infra/modules/trust/trustdbmetrics:go_default_library",
"//go/lib/keyconf:go_default_library",
"//go/lib/log:go_default_library",
"//go/lib/pathdb:go_default_library",
Expand Down
11 changes: 7 additions & 4 deletions go/cs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import (
"github.com/scionproto/scion/go/lib/infra/modules/idiscovery"
"github.com/scionproto/scion/go/lib/infra/modules/itopo"
"github.com/scionproto/scion/go/lib/infra/modules/trust"
"github.com/scionproto/scion/go/lib/infra/modules/trust/trustdbmetrics"
"github.com/scionproto/scion/go/lib/keyconf"
"github.com/scionproto/scion/go/lib/log"
"github.com/scionproto/scion/go/lib/pathdb"
Expand Down Expand Up @@ -179,6 +180,7 @@ func realMain() int {
log.Crit("Error initializing trust database", "err", err)
return 1
}
trustDB = trustdbmetrics.WithMetrics(string(cfg.TrustDB.Backend()), trustDB)
defer trustDB.Close()
inserter := trust.DefaultInserter{
BaseInserter: trust.BaseInserter{DB: trustDB},
Expand All @@ -190,6 +192,7 @@ func realMain() int {
DB: trustDB,
Inserter: inserter,
RPC: trust.DefaultRPC{Msgr: msgr},
IA: topo.IA(),
},
Router: trust.AuthRouter{
ISD: topo.IA().I,
Expand Down Expand Up @@ -230,10 +233,10 @@ func realMain() int {
defer beaconStore.Close()
intfs = ifstate.NewInterfaces(topo.IFInfoMap(), ifstate.Config{})
prometheus.MustRegister(ifstate.NewCollector(intfs))
msgr.AddHandler(infra.ChainRequest, trustStore.NewChainReqHandler())
msgr.AddHandler(infra.TRCRequest, trustStore.NewTRCReqHandler())
msgr.AddHandler(infra.Chain, trustStore.NewChainPushHandler())
msgr.AddHandler(infra.TRC, trustStore.NewTRCPushHandler())
msgr.AddHandler(infra.ChainRequest, trustStore.NewChainReqHandler(topo.IA()))
msgr.AddHandler(infra.TRCRequest, trustStore.NewTRCReqHandler(topo.IA()))
msgr.AddHandler(infra.Chain, trustStore.NewChainPushHandler(topo.IA()))
msgr.AddHandler(infra.TRC, trustStore.NewTRCPushHandler(topo.IA()))
msgr.AddHandler(infra.IfStateReq, ifstate.NewHandler(intfs))
msgr.AddHandler(infra.Seg, beaconing.NewHandler(topo.IA(), intfs, beaconStore,
trust.NewVerifier(trustStore)))
Expand Down
2 changes: 2 additions & 0 deletions go/lib/infra/modules/trust/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ go_library(
"handlers.go",
"inserter.go",
"inspector.go",
"metrics.go",
"provider.go",
"recurser.go",
"resolver.go",
Expand All @@ -28,6 +29,7 @@ go_library(
"//go/lib/infra/messenger:go_default_library",
"//go/lib/infra/modules/db:go_default_library",
"//go/lib/infra/modules/trust/internal/decoded:go_default_library",
"//go/lib/infra/modules/trust/internal/metrics:go_default_library",
"//go/lib/keyconf:go_default_library",
"//go/lib/log:go_default_library",
"//go/lib/scrypto:go_default_library",
Expand Down
Loading