honeybadger-io / honeybadger-crystal

Crystal library for reporting errors to Honeybadger.io :gem: :zap:
https://www.honeybadger.io/for/crystal/?utm_source=github&utm_medium=readme&utm_campaign=crystal&utm_content=website-url
MIT License
16 stars 6 forks source link

Breadcrumbs API #6

Open joshuap opened 3 years ago

joshuap commented 3 years ago

The client should have a public add_breadcrumb() method that stores an array of breadcrumbs. There should also be a public clear() method (see also: #4) to reset the breadcrumbs to the default ([]).

Supported config options:

Example:

# Supported configuration options w/ defaults:
Honeybadger.configure({
  # optional
  breadcrumbs_enabled: true,

  # optional
  # The max number of breadcrumbs to store at one time.
  # The oldest breadcrumbs should be dropped as newer breadcrumbs are added.
    max_breadcrumbs: 40
})

# Adding a breadcrumb:
Honeybadger.add_breadcrumb(
    "Email Sent",
    metadata: {
        user: user.id,
        message: message
    }
)

# Clearing context and breadcrumbs:
Honeybadger.clear()

Resources

jgaskins commented 3 months ago

With what I'm doing with events in #37, I was thinking I might also take a swing at this one since events and breadcrumbs seem pretty similar. Is the client library spec link still accurate? If so, it appears not to be public.

subzero10 commented 2 months ago

I was thinking I might also take a swing at this one since events and breadcrumbs seem pretty similar.

Indeed, they are similar in the way that they are queued locally and sent to the API in batches. However, there are a couple of things to clarify here (probably you are already aware, but I guess there's no harm repeating just in case 😄):

  1. Breadcrumbs are sent along with an error/notice. Events will have to be sent either when a threshold in terms of size or time has passed (as you are already doing in #37).
  2. There's a max number of breadcrumbs stored in the local queue. If the number is exceeded, the older breadcrumbs are dropped. This is not the case for the Events API.

Is the client library spec link still accurate? If so, it appears not to be public.

Hey @jgaskins, the client library spec link should be OK now.