Skip to content
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

telemetry: improve stack traces, error names, contexts #844

Merged
merged 7 commits into from
Mar 31, 2023

Commits on Mar 29, 2023

  1. redact: package for redacting error messages

    Package redact implements functions to redact sensitive information from
    errors. A basic example is:
    
    	name := "Alex"
    	id := 5
    	err := redact.Errorf("error getting user %s with ID %d",
    		name, Safe(id))
    
    	fmt.Println(err)
    	// error getting user Alex with ID 5
    
    	fmt.Println(redact.Error(err))
    	// error getting user <redacted string> with ID 5
    
    See the package docs and tests for more examples.
    
    This will allow us to get more information in Sentry without sending any
    identifying information.
    gcurtis committed Mar 29, 2023
    Configuration menu
    Copy the full SHA
    7c20c08 View commit details
    Browse the repository at this point in the history

Commits on Mar 30, 2023

  1. redact: add stack trace formatting, don't double redact

    Make `safeError` satisfy `fmt.Format` so that it can print stack traces
    the same way pkgs/errors does. Don't double redact errors so that
    already-redacted output isn't replaced with a placeholder.
    gcurtis committed Mar 30, 2023
    Configuration menu
    Copy the full SHA
    d1536f1 View commit details
    Browse the repository at this point in the history
  2. Fix linter

    gcurtis committed Mar 30, 2023
    Configuration menu
    Copy the full SHA
    1023a08 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    be5d087 View commit details
    Browse the repository at this point in the history
  4. telemetry: improve stack traces, error names, contexts

    Clean up and fix telemetry so that it can be actually useful. This
    commit is rather large because telemetry happens to touch a lot of
    different things.
    
    Example of what it looks like in Sentry: https://jetpack-io.sentry.io/issues/4047374127
    
    Client
    ------
    
    - Remove unnecessary telemetry configuration, such as `InitOpts`. Make
      the `build` package the source of truth for version information and
      link-time variables. Generate a global execution ID once at startup.
    - Standardize the contexts to use names and values recognized by Sentry.
    - Remove arbitrary CLI args and DEVBOX_ environment variables from the
      context, as these were leaking information.
    
    Errors
    ------
    
    - In combination with the `redact` package, errors can now include data
      that has been marked as safe for telemetry.
    - Errors that haven't been marked as safe have a more helpful
      placeholder containing the chain of error types up until the first
      exported error.
    
    Stack Traces
    ------------
    
    - Use the correct file and function names. This allows Sentry to group
      errors correctly.
    - Don't record every wrapped error. This doesn't make sense in Go since
      an error is a value containing the entire message. Otherwise you end
      up with a bunch of error messages that repeat themselves.
    gcurtis committed Mar 30, 2023
    Configuration menu
    Copy the full SHA
    f85f46e View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    b8112f3 View commit details
    Browse the repository at this point in the history
  6. Linter

    gcurtis committed Mar 30, 2023
    Configuration menu
    Copy the full SHA
    799c1c1 View commit details
    Browse the repository at this point in the history