8min

Go Backend

Highlight supports several server frameworks written in Go.

  • go-chi/chi
  • gin-gonic/gin

Usage

First, install and import the go package in your entrypoint.

Shell
|

Add the following lines to your application's main (func main) function:

Go
|
  • This configures highlight to transmit any relevant events or errors as they may happen. You can also customize highlight by using the public highlight methods before calling Start(). However, we still need to associate your users' sessions with potential backend errors. We provide middleware packages that help set this up:

Middleware

Add the following middleware to your router:

Go chi
Go gin
|

Instrumenting Handlers

Great! Now we've configured the highlight client and can track sessions from the frontend to the backend. All we need to do now is instrument our backend code to transmit events or errors where relevant.

Go chi
Go gin
|









Updated 06 Apr 2022
Did this page help?
Yes
No