Skip to content

Find out how terrible your workshop addons are in one easy place

License

Notifications You must be signed in to change notification settings

Lexicality/gmod-sentry

Repository files navigation

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:

  • 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 with
  • no_detour: If you don't want the module to override certain functions (because you've already overriden them) then pass them in here.

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

About

Find out how terrible your workshop addons are in one easy place

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages