Lexicality / gmod-sentry

Find out how terrible your workshop addons are in one easy place
https://lexicality.github.io/gmod-sentry/
Apache License 2.0
38 stars 3 forks source link
garrysmod sentry-client

Sentry integration for Garry's Mod

Track errors as they happen on your server, find out which workshop addon is making your players quit and track bugs without having to rely on user reports.

Requirements

Setup

  1. Download and install the correct version of luaerror from your server (eg gmsv_luaerror_linux.dll)
  2. Set up a project in Sentry
  3. Find your DSN
  4. Upload sentry.lua to lua/includes/modules on the server
  5. Create lua/autorun/server/sentry.lua on the server with the contents
    require( "sentry" )
    sentry.Setup( "YOUR DSN HERE", { server_name = "SHORT NAME FOR SERVER" } )
  6. Start collecting errors!

Customisation

sentry.Setup()

You can pass a number of fields to sentry.Setup:

Example:

sentry.Setup(
    "https://key@sentry.io/1337",
    {
        server_name = "server 7",
        environment = "production",
        release = "v23",
        tags = { foo = "bar" },
        no_detour = { "hook.Call" },
    }
)

Transactions

By default this module will detour a number of Lua entry points to attempt to instrument as many things with useful transaction names as possible.

This means your errors will be tagged with things such as hook/PlayerInitialSpawn/DarkRP_DoorData or net/GModSave, but you may wish to use your own names for functions. You can use sentry.ExecuteInTransaction to do this.

Example:

function DoDatabaseSave( ply )
    -- snip
end
hook.Add( "PlayerDisconnected", "Save Player Data", function( ply )
    sentry.ExecuteInTransaction( "My Save System", DoDatabaseSave, ply )
end)

Documentation

A generated LDoc file is available at https://lexicality.github.io/gmod-sentry