[#135] get-object: Add tracing spans
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
5af9f58469
commit
0920d848d0
80 changed files with 523 additions and 231 deletions
|
@ -102,7 +102,7 @@ func initApp(ctx context.Context, c *cfg) {
|
|||
initAndLog(c, "container", func(c *cfg) { initContainerService(ctx, c) })
|
||||
initAndLog(c, "session", initSessionService)
|
||||
initAndLog(c, "reputation", func(c *cfg) { initReputationService(ctx, c) })
|
||||
initAndLog(c, "notification", initNotifications)
|
||||
initAndLog(c, "notification", func(c *cfg) { initNotifications(ctx, c) })
|
||||
initAndLog(c, "object", initObjectService)
|
||||
initAndLog(c, "tree", initTreeService)
|
||||
initAndLog(c, "control", initControlService)
|
||||
|
|
|
@ -23,7 +23,7 @@ type notificationSource struct {
|
|||
defaultTopic string
|
||||
}
|
||||
|
||||
func (n *notificationSource) Iterate(epoch uint64, handler func(topic string, addr oid.Address)) {
|
||||
func (n *notificationSource) Iterate(ctx context.Context, epoch uint64, handler func(topic string, addr oid.Address)) {
|
||||
log := n.l.With(zap.Uint64("epoch", epoch))
|
||||
|
||||
listRes, err := n.e.ListContainers(engine.ListContainersPrm{})
|
||||
|
@ -51,7 +51,7 @@ func (n *notificationSource) Iterate(epoch uint64, handler func(topic string, ad
|
|||
}
|
||||
|
||||
for _, a := range selectRes.AddressList() {
|
||||
err = n.processAddress(a, handler)
|
||||
err = n.processAddress(ctx, a, handler)
|
||||
if err != nil {
|
||||
log.Error("notificator: could not process object",
|
||||
zap.Stringer("address", a),
|
||||
|
@ -66,13 +66,14 @@ func (n *notificationSource) Iterate(epoch uint64, handler func(topic string, ad
|
|||
}
|
||||
|
||||
func (n *notificationSource) processAddress(
|
||||
ctx context.Context,
|
||||
a oid.Address,
|
||||
h func(topic string, addr oid.Address),
|
||||
) error {
|
||||
var prm engine.HeadPrm
|
||||
prm.WithAddress(a)
|
||||
|
||||
res, err := n.e.Head(prm)
|
||||
res, err := n.e.Head(ctx, prm)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -108,7 +109,7 @@ func (n notificationWriter) Notify(topic string, address oid.Address) {
|
|||
}
|
||||
}
|
||||
|
||||
func initNotifications(c *cfg) {
|
||||
func initNotifications(ctx context.Context, c *cfg) {
|
||||
if nodeconfig.Notification(c.appCfg).Enabled() {
|
||||
topic := nodeconfig.Notification(c.appCfg).DefaultTopic()
|
||||
pubKey := hex.EncodeToString(c.cfgNodeInfo.localInfo.PublicKey())
|
||||
|
@ -151,7 +152,7 @@ func initNotifications(c *cfg) {
|
|||
addNewEpochAsyncNotificationHandler(c, func(e event.Event) {
|
||||
ev := e.(netmap.NewEpoch)
|
||||
|
||||
n.ProcessEpoch(ev.EpochNumber())
|
||||
n.ProcessEpoch(ctx, ev.EpochNumber())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue