diff options
author | 2023-02-17 12:02:29 +0100 | |
---|---|---|
committer | 2023-02-17 12:02:29 +0100 | |
commit | 68e6d08c768b789987a753d42f66caf73ce10ee1 (patch) | |
tree | 1c9eb6da6c326266d653de80684c3aec58922638 /internal/processing/statustimeline.go | |
parent | [bugfix] Set 'discoverable' properly on API accounts (#1511) (diff) | |
download | gotosocial-68e6d08c768b789987a753d42f66caf73ce10ee1.tar.xz |
[feature] Add a request ID and include it in logs (#1476)
This adds a lightweight form of tracing to GTS. Each incoming request is
assigned a Request ID which we then pass on and log in all our log
lines. Any function that gets called downstream from an HTTP handler
should now emit a requestID=value pair whenever it logs something.
Co-authored-by: kim <grufwub@gmail.com>
Diffstat (limited to 'internal/processing/statustimeline.go')
-rw-r--r-- | internal/processing/statustimeline.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/internal/processing/statustimeline.go b/internal/processing/statustimeline.go index 447a2a000..45a1c4508 100644 --- a/internal/processing/statustimeline.go +++ b/internal/processing/statustimeline.go @@ -72,7 +72,7 @@ func StatusFilterFunction(database db.DB, filter visibility.Filter) timeline.Fil timelineable, err := filter.StatusHometimelineable(ctx, status, requestingAccount) if err != nil { - log.Warnf("error checking hometimelineability of status %s for account %s: %s", status.ID, timelineAccountID, err) + log.Warnf(ctx, "error checking hometimelineability of status %s for account %s: %s", status.ID, timelineAccountID, err) } return timelineable, nil // we don't return the error here because we want to just skip this item if something goes wrong @@ -257,7 +257,7 @@ func (p *processor) filterPublicStatuses(ctx context.Context, authed *oauth.Auth targetAccount := >smodel.Account{} if err := p.db.GetByID(ctx, s.AccountID, targetAccount); err != nil { if err == db.ErrNoEntries { - log.Debugf("filterPublicStatuses: skipping status %s because account %s can't be found in the db", s.ID, s.AccountID) + log.Debugf(ctx, "skipping status %s because account %s can't be found in the db", s.ID, s.AccountID) continue } return nil, gtserror.NewErrorInternalError(fmt.Errorf("filterPublicStatuses: error getting status author: %s", err)) @@ -265,7 +265,7 @@ func (p *processor) filterPublicStatuses(ctx context.Context, authed *oauth.Auth timelineable, err := p.filter.StatusPublictimelineable(ctx, s, authed.Account) if err != nil { - log.Debugf("filterPublicStatuses: skipping status %s because of an error checking status visibility: %s", s.ID, err) + log.Debugf(ctx, "skipping status %s because of an error checking status visibility: %s", s.ID, err) continue } if !timelineable { @@ -274,7 +274,7 @@ func (p *processor) filterPublicStatuses(ctx context.Context, authed *oauth.Auth apiStatus, err := p.tc.StatusToAPIStatus(ctx, s, authed.Account) if err != nil { - log.Debugf("filterPublicStatuses: skipping status %s because it couldn't be converted to its api representation: %s", s.ID, err) + log.Debugf(ctx, "skipping status %s because it couldn't be converted to its api representation: %s", s.ID, err) continue } @@ -290,7 +290,7 @@ func (p *processor) filterFavedStatuses(ctx context.Context, authed *oauth.Auth, targetAccount := >smodel.Account{} if err := p.db.GetByID(ctx, s.AccountID, targetAccount); err != nil { if err == db.ErrNoEntries { - log.Debugf("filterFavedStatuses: skipping status %s because account %s can't be found in the db", s.ID, s.AccountID) + log.Debugf(ctx, "skipping status %s because account %s can't be found in the db", s.ID, s.AccountID) continue } return nil, gtserror.NewErrorInternalError(fmt.Errorf("filterPublicStatuses: error getting status author: %s", err)) @@ -298,7 +298,7 @@ func (p *processor) filterFavedStatuses(ctx context.Context, authed *oauth.Auth, timelineable, err := p.filter.StatusVisible(ctx, s, authed.Account) if err != nil { - log.Debugf("filterFavedStatuses: skipping status %s because of an error checking status visibility: %s", s.ID, err) + log.Debugf(ctx, "skipping status %s because of an error checking status visibility: %s", s.ID, err) continue } if !timelineable { @@ -307,7 +307,7 @@ func (p *processor) filterFavedStatuses(ctx context.Context, authed *oauth.Auth, apiStatus, err := p.tc.StatusToAPIStatus(ctx, s, authed.Account) if err != nil { - log.Debugf("filterFavedStatuses: skipping status %s because it couldn't be converted to its api representation: %s", s.ID, err) + log.Debugf(ctx, "skipping status %s because it couldn't be converted to its api representation: %s", s.ID, err) continue } |