Skip to content

reduce info to debug #979

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

Merged
merged 5 commits into from
Jul 15, 2025
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
2 changes: 1 addition & 1 deletion platform/fabric/core/generic/ordering/cft.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (o *CFTBroadcaster) getConnection(ctx context.Context) (*Connection, error)
// If this fails, retry with an existing connection
semContext, cancel := context.WithTimeout(ctx, 1*time.Second)
if err := o.connSem.Acquire(semContext, 1); err != nil {
logger.WarnfContext(ctx, "error while waiting: %w", err)
logger.DebugfContext(ctx, "error while waiting: %w", err)
cancel()
break
}
Expand Down
2 changes: 1 addition & 1 deletion platform/fabric/services/db/driver/sql/common/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ func (db *vaultReader) queryStatus(ctx context.Context, where cond2.Condition, p
Where(where).
Paginated(pagination).
FormatPaginated(db.ci, db.pi)
logger.Infof(query, params)
logger.Debugf(query, params)

rows, err := db.readDB.QueryContext(ctx, query, params...)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion platform/view/services/comm/host/rest/websocket/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"io"

"github.com/gorilla/websocket"
"github.com/hyperledger-labs/fabric-smart-client/platform/common/services/logging"
host2 "github.com/hyperledger-labs/fabric-smart-client/platform/view/services/comm/host"
"github.com/hyperledger-labs/fabric-smart-client/platform/view/services/comm/host/rest"
)
Expand Down Expand Up @@ -125,7 +126,7 @@ func (s *stream) Write(p []byte) (int, error) {
logger.Debugf("Wrote to [%s@%s], but message not ready yet.", s.info.RemotePeerID, s.info.RemotePeerAddress)
return n, nil
}
logger.Debugf("Ready to send to [%s@%s]: [%s]", s.info.RemotePeerID, s.info.RemotePeerAddress, content)
logger.Debugf("Ready to send to [%s@%s]: [%s]", s.info.RemotePeerID, s.info.RemotePeerAddress, logging.Base64(content))
if err := s.conn.WriteMessage(websocket.TextMessage, content); err != nil {
return 0, err
}
Expand Down
4 changes: 2 additions & 2 deletions platform/view/services/comm/session/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ func (j *jsonSession) SendWithContext(ctx context.Context, state interface{}) er
if err != nil {
return err
}
logger.Debugf("json session, send message [%s]", hash.Hashable(v).String())
logger.DebugfContext(ctx, "json session, send message [%s]", hash.Hashable(v).String())
return j.s.SendWithContext(ctx, v)
}

func (j *jsonSession) SendRaw(ctx context.Context, raw []byte) error {
logger.Debugf("json session, send raw message [%s]", hash.Hashable(raw).String())
logger.DebugfContext(ctx, "json session, send raw message [%s]", hash.Hashable(raw).String())
return j.s.SendWithContext(ctx, raw)
}

Expand Down
10 changes: 5 additions & 5 deletions platform/view/services/endpoint/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func (r *Service) Resolve(ctx context.Context, id view.Identity) (view.Identity,
if resolver == nil {
return nil, nil, raw, nil
}
logger.Debugf("resolved [%s] to [%s] with ports [%v]", id, resolver.GetId(), resolver.GetAddresses())
logger.DebugfContext(ctx, "resolved [%s] to [%s] with ports [%v]", id, resolver.GetId(), resolver.GetAddresses())
out := map[PortName]string{}
for name, s := range resolver.GetAddresses() {
out[name] = s
Expand All @@ -148,11 +148,11 @@ func (r *Service) GetResolver(ctx context.Context, id view.Identity) (*Resolver,

func (r *Service) Bind(ctx context.Context, longTerm view.Identity, ephemeral view.Identity) error {
if longTerm.Equal(ephemeral) {
logger.Debugf("cannot bind [%s] to [%s], they are the same", longTerm, ephemeral)
logger.DebugfContext(ctx, "cannot bind [%s] to [%s], they are the same", longTerm, ephemeral)
return nil
}

logger.Debugf("bind [%s] to [%s]", ephemeral, longTerm)
logger.DebugfContext(ctx, "bind [%s] to [%s]", ephemeral, longTerm)

if err := r.bindingKVS.PutBinding(ctx, ephemeral, longTerm); err != nil {
return errors.WithMessagef(err, "failed storing binding of [%s] to [%s]", ephemeral.UniqueID(), longTerm.UniqueID())
Expand Down Expand Up @@ -410,12 +410,12 @@ func (r *Service) resolver(ctx context.Context, party view.Identity) (*Resolver,
if err == nil {
return resolver, nil
}
logger.Debugf("resolving via binding for %s", party)
logger.DebugfContext(ctx, "resolving via binding for %s", party)
party, err = r.bindingKVS.GetLongTerm(ctx, party)
if err != nil {
return nil, err
}
logger.Debugf("continue to [%s]", party)
logger.DebugfContext(ctx, "continue to [%s]", party)
resolver, err = r.resolverByIdentity(party)
if err != nil {
return nil, errors.Wrapf(err, "failed getting identity for [%s]", party)
Expand Down
10 changes: 5 additions & 5 deletions platform/view/services/sig/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (o *Service) RegisterSigner(ctx context.Context, identity view.Identity, si
s, ok := o.signers[idHash]
o.mutex.RUnlock()
if ok {
logger.Debugf("another signer bound to [%s]:[%s][%s] from [%s]", identity, logging.Identifier(s), logging.Identifier(signer), string(s.DebugStack))
logger.DebugfContext(ctx, "another signer bound to [%s]:[%s][%s] from [%s]", identity, logging.Identifier(s), logging.Identifier(signer), string(s.DebugStack))
return nil
}

Expand All @@ -83,7 +83,7 @@ func (o *Service) RegisterSigner(ctx context.Context, identity view.Identity, si
s, ok = o.signers[idHash]
if ok {
o.mutex.Unlock()
logger.Debugf("another signer bound to [%s]:[%s][%s] from [%s]", identity, logging.Identifier(s), logging.Identifier(signer), string(s.DebugStack))
logger.DebugfContext(ctx, "another signer bound to [%s]:[%s][%s] from [%s]", identity, logging.Identifier(s), logging.Identifier(signer), string(s.DebugStack))
return nil
}

Expand All @@ -107,7 +107,7 @@ func (o *Service) RegisterSigner(ctx context.Context, identity view.Identity, si
return err
}
}
logger.Debugf("signer for [%s][%s] registered, no verifier passed", idHash, logging.Identifier(signer))
logger.DebugfContext(ctx, "signer for [%s][%s] registered, no verifier passed", idHash, logging.Identifier(signer))
return nil
}

Expand Down Expand Up @@ -193,12 +193,12 @@ func (o *Service) AreMe(ctx context.Context, identities ...view.Identity) []stri
func (o *Service) Info(ctx context.Context, id view.Identity) string {
auditInfo, err := o.GetAuditInfo(ctx, id)
if err != nil {
logger.Debugf("failed getting audit info for [%s]", id)
logger.DebugfContext(ctx, "failed getting audit info for [%s]", id)
return fmt.Sprintf("unable to identify identity : [%s][%s]", id.UniqueID(), string(id))
}
info, err := o.deserializer.Info(id, auditInfo)
if err != nil {
logger.Debugf("failed getting info for [%s]", id)
logger.DebugfContext(ctx, "failed getting info for [%s]", id)
return fmt.Sprintf("unable to identify identity : [%s][%s]", id.UniqueID(), string(id))
}
return info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (db *AuditInfoStore) PutAuditInfo(ctx context.Context, id view.Identity, in
if err != nil {
return errors.Wrapf(err, "failed executing query [%s]", query)
}
logger.Debugf("Signer [%s] registered", id)
logger.DebugfContext(ctx, "signer [%s] registered", id)
return nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (db *BindingStore) GetLongTerm(ctx context.Context, ephemeral view.Identity
if err != nil {
return nil, errors.Wrapf(err, "failed getting wallet id for identity [%v]", ephemeral)
}
logger.Debugf("found wallet id for identity [%v]: %v", ephemeral, result)
logger.DebugfContext(ctx, "found wallet id for identity [%v]: %v", ephemeral, result)
return result, nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (db *SignerInfoStore) FilterExistingSigners(ctx context.Context, ids ...vie
}
existingSigners = append(existingSigners, inverseMap[idHash])
}
logger.Debugf("Found %d out of %d signers", len(existingSigners), len(ids))
logger.DebugfContext(ctx, "Found %d out of %d signers", len(existingSigners), len(ids))
return existingSigners, nil
}

Expand All @@ -80,7 +80,7 @@ func (db *SignerInfoStore) PutSigner(ctx context.Context, id view.Identity) erro
logger.Debug(query, params)
_, err := db.writeDB.ExecContext(ctx, query, params...)
if err == nil {
logger.Debugf("Signer [%s] registered", id)
logger.DebugfContext(ctx, "Signer [%s] registered", id)
return nil
}
if errors.Is(db.errorWrapper.WrapError(err), driver.UniqueKeyViolation) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ func (db *SimpleKeyDataStore) PutData(ctx context.Context, key string, data []by
}

if rowsAffected, err := result.RowsAffected(); err == nil && rowsAffected == 0 {
logger.Debugf("Entry for key [%s] was already in the database. Skipped", key)
logger.DebugfContext(ctx, "Entry for key [%s] was already in the database. Skipped", key)
}
logger.Debugf("Data [%s] registered", key)
logger.DebugfContext(ctx, "Data [%s] registered", key)
return nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ func (db *KeyValueStore) SetStatesWithTx(ctx context.Context, tx dbTransaction,
for pkey, val := range kvs {
// Get rawVal
if len(val) == 0 {
logger.Debugf("set key [%s:%s] to nil value, will be deleted instead", ns, pkey)
logger.DebugfContext(ctx, "set key [%s:%s] to nil value, will be deleted instead", ns, pkey)
deleted = append(deleted, pkey)
} else {
logger.Debugf("set state [%s,%s]", ns, pkey)
logger.DebugfContext(ctx, "set state [%s,%s]", ns, pkey)
// Overwrite rawVal
upserted[pkey] = append([]byte(nil), val...)
}
Expand Down
8 changes: 4 additions & 4 deletions platform/view/services/storage/driver/sql/postgres/binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ func newBindingStore(readDB, writeDB *sql.DB, table string) *BindingStore {
}
}
func (db *BindingStore) PutBinding(ctx context.Context, ephemeral, longTerm view.Identity) error {
logger.Debugf("Put binding for pair [%s:%s]", ephemeral.UniqueID(), longTerm.UniqueID())
logger.DebugfContext(ctx, "Put binding for pair [%s:%s]", ephemeral.UniqueID(), longTerm.UniqueID())
if lt, err := db.GetLongTerm(ctx, longTerm); err != nil {
return err
} else if lt != nil && !lt.IsNone() {
logger.Debugf("Replacing [%s] with long term [%s]", longTerm.UniqueID(), lt.UniqueID())
logger.DebugfContext(ctx, "Replacing [%s] with long term [%s]", longTerm.UniqueID(), lt.UniqueID())
longTerm = lt
} else {
logger.Debugf("Id [%s] is an unregistered long term ID", longTerm.UniqueID())
logger.DebugfContext(ctx, "Id [%s] is an unregistered long term ID", longTerm.UniqueID())
}
query := fmt.Sprintf(`
INSERT INTO %s (ephemeral_hash, long_term_id)
Expand All @@ -56,7 +56,7 @@ func (db *BindingStore) PutBinding(ctx context.Context, ephemeral, longTerm view
logger.Debug(query, ephemeral.UniqueID(), longTerm.UniqueID())
_, err := db.writeDB.ExecContext(ctx, query, ephemeral.UniqueID(), longTerm, longTerm.UniqueID(), longTerm)
if err == nil {
logger.Debugf("Long-term and ephemeral ids registered [%s,%s]", longTerm, ephemeral)
logger.DebugfContext(ctx, "Long-term and ephemeral ids registered [%s,%s]", longTerm, ephemeral)
return nil
}
if errors.Is(db.errorWrapper.WrapError(err), driver.UniqueKeyViolation) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ func (h *notificationHandler) parsePayload(s string) (driver.Operation, map[driv
return operation, payload, nil
}

func (h *notificationHandler) HandleNotification(_ context.Context, notification *pgconn.Notification, _ *pgx.Conn) error {
func (h *notificationHandler) HandleNotification(ctx context.Context, notification *pgconn.Notification, _ *pgx.Conn) error {
if notification == nil || len(notification.Payload) == 0 {
logger.Warnf("nil event received on table [%s], investigate the possible cause", h.table)
return nil
}
logger.Debugf("new event received on table [%s]: %s", notification.Channel, notification.Payload)
logger.DebugfContext(ctx, "new event received on table [%s]: %s", notification.Channel, notification.Payload)
op, vals, err := h.parsePayload(notification.Payload)
if err != nil {
logger.Errorf("Failed parsing payload [%s]: %v", notification.Payload, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ func sqlOpen(dataSourceName string, tracing *common2.TracingConfig) (*sql.DB, er
if tracing == nil {
return sql.Open(driverName, dataSourceName)
}
return otelsql.Open(driverName, dataSourceName, otelsql.WithAttributes(semconv.DBSystemPostgreSQL))
return otelsql.Open(driverName, dataSourceName,
otelsql.WithAttributes(semconv.DBSystemPostgreSQL),
)
}

type Opts struct {
Expand Down
8 changes: 4 additions & 4 deletions platform/view/services/storage/driver/sql/sqlite/binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ func newBindingStore(readDB *sql.DB, writeDB common2.WriteDB, table string) *Bin
}
}
func (db *BindingStore) PutBinding(ctx context.Context, ephemeral, longTerm view.Identity) error {
logger.Debugf("Put binding for pair [%s:%s]", ephemeral.UniqueID(), longTerm.UniqueID())
logger.DebugfContext(ctx, "Put binding for pair [%s:%s]", ephemeral.UniqueID(), longTerm.UniqueID())
if lt, err := db.GetLongTerm(ctx, longTerm); err != nil {
return err
} else if lt != nil && !lt.IsNone() {
logger.Debugf("Replacing [%s] with long term [%s]", longTerm.UniqueID(), lt.UniqueID())
logger.DebugfContext(ctx, "Replacing [%s] with long term [%s]", longTerm.UniqueID(), lt.UniqueID())
longTerm = lt
} else {
logger.Debugf("Id [%s] is an unregistered long term ID", longTerm.UniqueID())
logger.DebugfContext(ctx, "Id [%s] is an unregistered long term ID", longTerm.UniqueID())
}
query := fmt.Sprintf(`
BEGIN;
Expand All @@ -62,7 +62,7 @@ func (db *BindingStore) PutBinding(ctx context.Context, ephemeral, longTerm view
logger.Debug(query, ephemeral.UniqueID(), longTerm.UniqueID())
_, err := db.writeDB.ExecContext(ctx, query, ephemeral.UniqueID(), longTerm, longTerm.UniqueID(), longTerm)
if err == nil {
logger.Debugf("Long-term and ephemeral ids registered [%s,%s]", longTerm, ephemeral)
logger.DebugfContext(ctx, "Long-term and ephemeral ids registered [%s,%s]", longTerm, ephemeral)
return nil
}
if errors.Is(db.errorWrapper.WrapError(err), driver.UniqueKeyViolation) {
Expand Down
8 changes: 4 additions & 4 deletions platform/view/services/storage/kvs/kvs.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func (o *KVS) Get(ctx context.Context, id string, state interface{}) error {
} else if !ok {
raw, err = o.store.GetState(ctx, o.namespace, id)
if err != nil {
logger.Debugf("failed retrieving state [%s,%s]", o.namespace, id)
logger.DebugfContext(ctx, "failed retrieving state [%s,%s]", o.namespace, id)
return errors.Wrapf(err, "failed retrieving state [%s,%s]", o.namespace, id)
}
if len(raw) == 0 {
Expand All @@ -172,16 +172,16 @@ func (o *KVS) Get(ctx context.Context, id string, state interface{}) error {
}

if err := json.Unmarshal(raw, state); err != nil {
logger.Debugf("failed retrieving state [%s,%s], cannot unmarshal state, error [%s]", o.namespace, id, err)
logger.DebugfContext(ctx, "failed retrieving state [%s,%s], cannot unmarshal state, error [%s]", o.namespace, id, err)
return errors.Wrapf(err, "failed retrieving state [%s,%s], cannot unmarshal state", o.namespace, id)
}

logger.Debugf("got state [%s,%s] successfully", o.namespace, id)
logger.DebugfContext(ctx, "got state [%s,%s] successfully", o.namespace, id)
return nil
}

func (o *KVS) Delete(ctx context.Context, id string) error {
logger.Debugf("delete state [%s,%s]", o.namespace, id)
logger.DebugfContext(ctx, "delete state [%s,%s]", o.namespace, id)

if err := o.store.DeleteState(ctx, o.namespace, id); err != nil {
return err
Expand Down
14 changes: 7 additions & 7 deletions platform/view/services/view/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func (c *ctx) GetSession(caller view.View, party view.Identity, boundToViews ...

// a session is available, return it
if s != nil {
logger.Debugf("[%s] Reusing session [%s:%s]", c.me, viewId, party)
logger.DebugfContext(c.context, "[%s] Reusing session [%s:%s]", c.me, viewId, party)
return s, nil
}

Expand Down Expand Up @@ -235,10 +235,10 @@ func (c *ctx) GetSessionByID(id string, party view.Identity) (view.Session, erro

func (c *ctx) Session() view.Session {
if c.session == nil {
logger.Debugf("[%s] No default current Session", c.me)
logger.DebugfContext(c.context, "[%s] No default current Session", c.me)
return nil
}
logger.Debugf("[%s] Current Session [%s]", c.me, logging.Eval(c.session.Info))
logger.DebugfContext(c.context, "[%s] Current Session [%s]", c.me, logging.Eval(c.session.Info))
return c.session
}

Expand Down Expand Up @@ -314,7 +314,7 @@ func (c *ctx) newSessionByID(sessionID, contextID string, party view.Identity) (
}

func (c *ctx) cleanup() {
logger.Debugf("cleaning up context [%s][%d]", c.ID(), len(c.errorCallbackFuncs))
logger.DebugfContext(c.context, "cleaning up context [%s][%d]", c.ID(), len(c.errorCallbackFuncs))
for _, callbackFunc := range c.errorCallbackFuncs {
c.safeInvoke(callbackFunc)
}
Expand All @@ -323,7 +323,7 @@ func (c *ctx) cleanup() {
func (c *ctx) safeInvoke(f func()) {
defer func() {
if r := recover(); r != nil {
logger.Debugf("function [%s] panicked [%s]", f, r)
logger.DebugfContext(c.context, "function [%s] panicked [%s]", f, r)
}
}()
f()
Expand All @@ -341,7 +341,7 @@ func (c *ctx) resolve(id view.Identity) (view.Identity, error) {
}

func (c *ctx) createSession(caller view.View, party view.Identity, aliases ...view.View) (view.Session, error) {
logger.Infof("create session [%s][%s], [%s:%s]", c.me, c.id, getViewIdentifier(caller), party)
logger.DebugfContext(c.context, "create session [%s][%s], [%s:%s]", c.me, c.id, getViewIdentifier(caller), party)

s, err := c.newSession(caller, c.id, party)
if err != nil {
Expand Down Expand Up @@ -388,7 +388,7 @@ func runViewOn(v view.View, opts []view.RunViewOption, ctx localContext) (res in
initiator = v
}

logger.Warnf("Start view %s", GetName(v))
logger.DebugfContext(ctx.Context(), "Start view %s", GetName(v))
newCtx, span := ctx.StartSpanFrom(ctx.Context(), GetName(v), tracing.WithAttributes(
tracing.String(ViewLabel, GetIdentifier(v)),
tracing.String(InitiatorViewLabel, GetIdentifier(initiator)),
Expand Down
Loading
Loading