diff options
author | 2023-02-17 12:02:29 +0100 | |
---|---|---|
committer | 2023-02-17 12:02:29 +0100 | |
commit | 68e6d08c768b789987a753d42f66caf73ce10ee1 (patch) | |
tree | 1c9eb6da6c326266d653de80684c3aec58922638 /internal/federation/dereferencing/status.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/federation/dereferencing/status.go')
-rw-r--r-- | internal/federation/dereferencing/status.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/internal/federation/dereferencing/status.go b/internal/federation/dereferencing/status.go index da4639c5d..56545c5e0 100644 --- a/internal/federation/dereferencing/status.go +++ b/internal/federation/dereferencing/status.go @@ -318,20 +318,20 @@ func (d *deref) populateStatusMentions(ctx context.Context, status *gtsmodel.Sta for _, m := range status.Mentions { if m.ID != "" { // we've already populated this mention, since it has an ID - log.Debug("populateStatusMentions: mention already populated") + log.Debug(ctx, "mention already populated") mentionIDs = append(mentionIDs, m.ID) newMentions = append(newMentions, m) continue } if m.TargetAccountURI == "" { - log.Debug("populateStatusMentions: target URI not set on mention") + log.Debug(ctx, "target URI not set on mention") continue } targetAccountURI, err := url.Parse(m.TargetAccountURI) if err != nil { - log.Debugf("populateStatusMentions: error parsing mentioned account uri %s: %s", m.TargetAccountURI, err) + log.Debugf(ctx, "error parsing mentioned account uri %s: %s", m.TargetAccountURI, err) continue } @@ -342,7 +342,7 @@ func (d *deref) populateStatusMentions(ctx context.Context, status *gtsmodel.Sta if a, err := d.db.GetAccountByURI(ctx, targetAccountURI.String()); err != nil { errs = append(errs, err.Error()) } else { - log.Debugf("populateStatusMentions: got target account %s with id %s through GetAccountByURI", targetAccountURI, a.ID) + log.Debugf(ctx, "got target account %s with id %s through GetAccountByURI", targetAccountURI, a.ID) targetAccount = a } @@ -352,13 +352,13 @@ func (d *deref) populateStatusMentions(ctx context.Context, status *gtsmodel.Sta if a, err := d.GetAccountByURI(ctx, requestingUsername, targetAccountURI, false); err != nil { errs = append(errs, err.Error()) } else { - log.Debugf("populateStatusMentions: got target account %s with id %s through GetRemoteAccount", targetAccountURI, a.ID) + log.Debugf(ctx, "got target account %s with id %s through GetRemoteAccount", targetAccountURI, a.ID) targetAccount = a } } if targetAccount == nil { - log.Debugf("populateStatusMentions: couldn't get target account %s: %s", m.TargetAccountURI, strings.Join(errs, " : ")) + log.Debugf(ctx, "couldn't get target account %s: %s", m.TargetAccountURI, strings.Join(errs, " : ")) continue } @@ -419,13 +419,13 @@ func (d *deref) populateStatusAttachments(ctx context.Context, status *gtsmodel. Blurhash: &a.Blurhash, }) if err != nil { - log.Errorf("populateStatusAttachments: couldn't get remote media %s: %s", a.RemoteURL, err) + log.Errorf(ctx, "couldn't get remote media %s: %s", a.RemoteURL, err) continue } attachment, err := processingMedia.LoadAttachment(ctx) if err != nil { - log.Errorf("populateStatusAttachments: couldn't load remote attachment %s: %s", a.RemoteURL, err) + log.Errorf(ctx, "couldn't load remote attachment %s: %s", a.RemoteURL, err) continue } |