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

Slog Handler Elastic APM Integration #1597

Merged
merged 3 commits into from
Apr 24, 2024

Commits on Apr 22, 2024

  1. Slog Handler Elastic APM Integration

    Implemented a slog handler that attached trace/correlation logs (if
    available) to the log message. Also will report specific log level logs
    as errors through an apm tracer.
    
    Add documentation links and clean up comments
    cmenke authored and charliemenke committed Apr 22, 2024
    Configuration menu
    Copy the full SHA
    815703c View commit details
    Browse the repository at this point in the history
  2. Multi Error Reporting, Custom Report Attrs, and Clean Up

    Implemented ability to report multiple apm errors from one log. If a user adds
    multiple "reportable" error attributes to the log msg (default is "error" & "err"),
    instead of trying to join the errors into one or discarding one, the apmslog
    handler will report both errors.
    
    Added ability for a user to define what slog attribute keys they want to report
    as errors. Because there is no standard way in slog to attach an error to a msg
    log, I wanted to add the ability for the user to decide what is and what is not
    going to be reported. By default, slog attribute keys that are "error" or "err"
    are reported, but with the new `WithErrorRecordAttrs(keys)` function a user
    can define which keys will be reported.
    
    Cleaned up `ApmHandler` struct and methods. Since we want the user to use the
    included `NewApmHandler` function and its functional option functions, I
    decided to make all Struct fields private.
    
    Additionally added a check on if the `ApmHandler`'s `tracer` field is nill before
    trying to use it. It is still possible for a user to pass in a nil tracer using
    the `WithTracer` functional option.
    
    New tests and documentation added.
    cmenke authored and charliemenke committed Apr 22, 2024
    Configuration menu
    Copy the full SHA
    09e015c View commit details
    Browse the repository at this point in the history

Commits on Apr 23, 2024

  1. goimports formatting

    charliemenke committed Apr 23, 2024
    Configuration menu
    Copy the full SHA
    74a4d04 View commit details
    Browse the repository at this point in the history