Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

highlight: share log attributes with trace and handle canceled#61880

Merged
keegancsmith merged 1 commit into
mainfrom
k/trace-logger-highlight
Apr 15, 2024
Merged

highlight: share log attributes with trace and handle canceled#61880
keegancsmith merged 1 commit into
mainfrom
k/trace-logger-highlight

Conversation

@keegancsmith

Copy link
Copy Markdown
Member

While investigating a large number of errors in highlighting I noticed the vast majority where canceled. This commit adds special handling for it and in the process does a few other things to the observability here:

  • Log duration in these errors. This is useful signal to understand if a slow request is being canceled, or we have bad debouncing in a client.
  • Re-use the tracers logger. This has many more fields and avoids duplication.
  • Downgrade cancel error to warning.
  • Include error problem in logs.
  • Factor out the snippet log field creation.

Note I didn't include snippet in the cancel log since it's unlikely to be related to the code being highlighted. Easy to add in if we find that is incorrect.

Test Plan: CI will exercise this code path. Otherwise I will follow-up on dotcom.

While investigating a large number of errors in highlighting I noticed
the vast majority where canceled. This commit adds special handling for
it and in the process does a few other things to the observability here:

- Log duration in these errors. This is useful signal to understand if a
  slow request is being canceled, or we have bad debouncing in a client.
- Re-use the tracers logger. This has many more fields and avoids
  duplication.
- Downgrade cancel error to warning.
- Include error problem in logs.
- Factor out the snippet log field creation.

Note I didn't include snippet in the cancel log since it's unlikely to
be related to the code being highlighted. Easy to add in if we find that
is incorrect.

Test Plan: CI will exercise this code path. Otherwise I will follow-up
on dotcom.
@keegancsmith keegancsmith requested review from a team and camdencheek April 15, 2024 12:43
@cla-bot cla-bot Bot added the cla-signed label Apr 15, 2024
@github-actions github-actions Bot added team/product-platform team/search-platform Issues owned by the search platform team labels Apr 15, 2024
@keegancsmith

Copy link
Copy Markdown
Member Author

@camdencheek any idea why you only emit errors to honeycomb? I am guessing error logging/metrics/traces would be useful here? https://github.com/sourcegraph/sourcegraph/blob/be908b2135b35d3afc5e36434a08a98212657187/internal/highlight/highlight.go#L54

@camdencheek camdencheek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@keegancsmith keegancsmith merged commit b89b99c into main Apr 15, 2024
@keegancsmith keegancsmith deleted the k/trace-logger-highlight branch April 15, 2024 16:33
sourcegraph-release-bot pushed a commit that referenced this pull request Apr 15, 2024
While investigating a large number of errors in highlighting I noticed
the vast majority where canceled. This commit adds special handling for
it and in the process does a few other things to the observability here:

- Log duration in these errors. This is useful signal to understand if a
  slow request is being canceled, or we have bad debouncing in a client.
- Re-use the tracers logger. This has many more fields and avoids
  duplication.
- Downgrade cancel error to warning.
- Include error problem in logs.
- Factor out the snippet log field creation.

Note I didn't include snippet in the cancel log since it's unlikely to
be related to the code being highlighted. Easy to add in if we find that
is incorrect.

Test Plan: CI will exercise this code path. Otherwise I will follow-up
on dotcom.

(cherry picked from commit b89b99c)
keegancsmith added a commit that referenced this pull request Apr 15, 2024
…ndle canceled (#61889)

highlight: share log attributes with trace and handle canceled (#61880)

While investigating a large number of errors in highlighting I noticed
the vast majority where canceled. This commit adds special handling for
it and in the process does a few other things to the observability here:

- Log duration in these errors. This is useful signal to understand if a
  slow request is being canceled, or we have bad debouncing in a client.
- Re-use the tracers logger. This has many more fields and avoids
  duplication.
- Downgrade cancel error to warning.
- Include error problem in logs.
- Factor out the snippet log field creation.

Note I didn't include snippet in the cancel log since it's unlikely to
be related to the code being highlighted. Easy to add in if we find that
is incorrect.

Test Plan: CI will exercise this code path. Otherwise I will follow-up
on dotcom.

(cherry picked from commit b89b99c)

Co-authored-by: Keegan Carruthers-Smith <keegan.csmith@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants