The offical Trebble SDK for Go using Fiber
- Sign in to Treblle.
- Create a Treblle project.
go get github.com/RafaelPiloto10/treblle-go-fiber/trebble_fiber@latest
Configure Treblle at the start of your main()
function:
package main
import (
treblle_fiber "github.com/RafaelPiloto10/treblle-go-fiber/trebble_fiber"
)
func main() {
treblle_fiber.Configure(treblle_fiber.Configuration{
APIKey: "YOUR API KEY HERE",
ProjectID: "YOUR PROJECT ID HERE",
KeysToMask: []string{"password", "card_number"}, // optional, mask fields you don't want sent to Treblle
ServerURL: "https://rocknrolla.treblle.com", // optional, don't use default server URL
IgnorePrefix: []string{"/pi"}, // optional, ignore routes that start with these prefixes
IgnoreExact: []string{"/ping"}, // optional, ignore routes that match exactly
}
// rest of your program.
}
After that, just use the middleware with any of your handlers:
app := fiber.New(fiber.Config{})
app.Use(treblle_fiber.Middleware())
app.Listen("localhost:3000")
See the docs to learn more.