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

Add documentation for sending events to Insights #38

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,29 @@ For an example of identifying users in HTTP handlers, see [demo/http_context.cr]

[Learn more about context data in Honeybadger](https://docs.honeybadger.io/guides/errors/#context-data)

### Sending Events to Honeybadger Insights

You can send custom events to [Honeybadger Insights](https://docs.honeybadger.io/guides/insights/) to track important business metrics and user actions in your application:

```crystal
# Send a simple event
Honeybadger.event(name: "user.signup")

# Send an event with properties
Honeybadger.event(
name: "order.completed",
total: 99.99,
items: ["book", "shirt"],
user_id: 123
)
```
robacarp marked this conversation as resolved.
Show resolved Hide resolved

Events are buffered and sent in batches to optimize performance. The buffer is flushed when either:
- 60 seconds have elapsed
- The buffer size exceeds 5MB

Events are sent asynchronously by default, so they won't block your application's execution.

## Configuration

To set configuration options, use the `Honeybadger.configure` method:
Expand Down
Loading