Created
January 14, 2025 14:32
-
-
Save stympy/2f2631cac90384a9b0bcfbd621c348f0 to your computer and use it in GitHub Desktop.
Reporting events to Honeybadger Insignts from Crystal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "http/server" | |
require "honeybadger" | |
Honeybadger.configure do |config| | |
config.api_key = "replaceme" | |
config.environment = "production" | |
end | |
server = HTTP::Server.new do |context| | |
context.response.content_type = "text/plain" | |
context.response.print "Hello world! The time is #{Time.local}" | |
Honeybadger.event( | |
name: "greeting.sent", | |
user_id: 123 | |
) | |
end | |
address = server.bind_tcp 8080 | |
puts "Listening on http://#{address}" | |
server.listen |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment