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.
- A server host that lets you install binary modules
- gmsv_luaerror.dll Installed in your server's lua/bin folder
- An account on sentry.io or a custom sentry installation
- Download and install the correct version of luaerror from your server (eg gmsv_luaerror_linux.dll)
- Set up a project in Sentry
- Find your DSN
- Upload sentry.lua to
lua/includes/modules
on the server - Create
lua/autorun/server/sentry.lua
on the server with the contentsrequire( "sentry" ) sentry.Setup( "YOUR DSN HERE", { server_name = "SHORT NAME FOR SERVER" } )
- Start collecting errors!
You can pass a number of fields to sentry.Setup
:
server_name
: Tags your server in the sentry UI. If you have more than one server, this is useful for filtering between them. If you don't set it, your server's public hostname will be used.environment
: Used for setting up Environments on sentry. Not very useful if you don't run a testing server.release
: Used by the Releases feature in Sentry.tags
: Any additional tags you want every error from this server to be tagged withno_detour
: If you don't want the module to override certain functions (because you've already overriden them) then pass them in here.
sentry.Setup(
"https://key@sentry.io/1337",
{
server_name = "server 7",
environment = "production",
release = "v23",
tags = { foo = "bar" },
no_detour = { "hook.Call" },
}
)
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.
function DoDatabaseSave( ply )
-- snip
end
hook.Add( "PlayerDisconnected", "Save Player Data", function( ply )
sentry.ExecuteInTransaction( "My Save System", DoDatabaseSave, ply )
end)
A generated LDoc file is available at https://lexicality.github.io/gmod-sentry