{"id":23340225,"url":"https://github.com/sierrasoftworks/sentry-go","last_synced_at":"2025-04-09T23:42:31.057Z","repository":{"id":57487248,"uuid":"124578201","full_name":"SierraSoftworks/sentry-go","owner":"SierraSoftworks","description":"A beautifully simple Sentry client which makes reporting errors a joy! Full support for breadcrumbs and stacktraces with an elegant and easy to remember API.","archived":false,"fork":false,"pushed_at":"2024-03-04T01:56:16.000Z","size":2869,"stargazers_count":20,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-06-21T00:18:01.370Z","etag":null,"topics":["breadcrumbs","errors","getsentry","golang","hacktoberfest","raven","raven-go","sentry","sentry-client","stacktrace"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/SierraSoftworks/sentry-go/v2","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SierraSoftworks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-09T18:27:00.000Z","updated_at":"2022-12-31T16:01:24.000Z","dependencies_parsed_at":"2024-03-04T02:47:35.974Z","dependency_job_id":"7502dc5f-39dd-4cd1-9c8b-91aa8346106b","html_url":"https://github.com/SierraSoftworks/sentry-go","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SierraSoftworks%2Fsentry-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SierraSoftworks%2Fsentry-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SierraSoftworks%2Fsentry-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SierraSoftworks%2Fsentry-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SierraSoftworks","download_url":"https://codeload.github.com/SierraSoftworks/sentry-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248131470,"owners_count":21052819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["breadcrumbs","errors","getsentry","golang","hacktoberfest","raven","raven-go","sentry","sentry-client","stacktrace"],"created_at":"2024-12-21T04:20:40.490Z","updated_at":"2025-04-09T23:42:31.036Z","avatar_url":"https://github.com/SierraSoftworks.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sentry-go [![Build Status](https://travis-ci.org/SierraSoftworks/sentry-go.svg?branch=master)](https://travis-ci.org/SierraSoftworks/sentry-go) [![](https://godoc.org/gopkg.in/SierraSoftworks/sentry-go.v1?status.svg)](http://godoc.org/gopkg.in/SierraSoftworks/sentry-go.v1) [![codecov](https://codecov.io/gh/SierraSoftworks/sentry-go/branch/master/graph/badge.svg)](https://codecov.io/gh/SierraSoftworks/sentry-go)\r\n**A robust Sentry client for Go applications**\r\n\r\nThis library is a re-imagining of how Go applications should interact\r\nwith a Sentry server. It aims to offer a concise, easy to understand and\r\neasy to extend toolkit for sending events to Sentry, with a strong emphasis\r\non being easy to use.\r\n\r\n## Features\r\n - **A beautiful API** which makes it obvious exactly what the best way to\r\n   solve a problem is.\r\n - **Comprehensive** coverage of the various objects that can be sent to Sentry\r\n   so you won't be left wondering why everyone else gets to play with Breadcrumbs\r\n   but you still can't...\r\n - **StackTrace Support** using the official `pkg/errors` stacktrace provider,\r\n   for maximum compatibility and easy integration with other libraries.\r\n - **HTTP Context Helpers** to let you quickly expose HTTP request context as\r\n   part of your errors - with optional support for sending cookies, headers and\r\n   payload data.\r\n - **Extensive documentation** which makes figuring out the right way to use\r\n   something as easy as possible without the need to go diving into the code.\r\n\r\nIn addition to the features listed above, the library offers support for a number\r\nof more advanced use cases, including sending events to multiple different Sentry\r\nDSNs, derived client contexts, custom interface types and custom transports.\r\n\r\n## Versions\r\nThis package follows SemVer and uses [gopkg.in](https://gopkg.in) to provide access\r\nto those versions.\r\n\r\n - [sentry-go.v0](https://gopkg.in/SierraSoftworks/sentry-go.v0) - `import (\"gopkg.in/SierraSoftworks/sentry-go.v0\")`\r\n\r\n   This version is the latest `master` branch. You should avoid depending on this version unless you\r\n   are performing active development against `sentry-go`.\r\n - [**sentry-go.v1**](https://gopkg.in/SierraSoftworks/sentry-go.v1) - `import (\"gopkg.in/SierraSoftworks/sentry-go.v1\")`\r\n\r\n   This version of `sentry-go` maintains API compatibility with the package's v1 API. If you used\r\n   `sentry-go` for a project prior to 2019-09-25 then this is the version you should retain until\r\n   you can update your code. It will receive bug and security fixes.\r\n\r\n - [**sentry-go.v2**](https://gopkg.in/SierraSoftworks/sentry-go.v2) - `import (\"gopkg.in/SierraSoftworks/sentry-go.v2\")`\r\n\r\n   This version is the most recent release of `sentry-go` and will maintain API compatibility. If you\r\n   are creating a project that relies on `sentry-go` then this is the version you should use.\r\n\r\n## Examples\r\n\r\n### Breadcrumbs and Exceptions\r\n```go\r\npackage main\r\n\r\nimport (\r\n    \"fmt\"\r\n\r\n    \"gopkg.in/SierraSoftworks/sentry-go.v2\"\r\n    \"github.com/pkg/errors\"\r\n)\r\n\r\nfunc main() {\r\n    sentry.AddDefaultOptions(\r\n        sentry.DSN(\"...\"), // If you don't override this, it'll be fetched from $SENTRY_DSN\r\n        sentry.Release(\"v1.0.0\"),\r\n    )\r\n\r\n    cl := sentry.NewClient()\r\n\r\n    sentry.DefaultBreadcrumbs().NewDefault(nil).WithMessage(\"Application started\").WithCategory(\"log\")\r\n\r\n    err := errors.New(\"error with a stacktrace\")\r\n\r\n    id := cl.Capture(\r\n        sentry.Message(\"Example exception submission to Sentry\"),\r\n        sentry.ExceptionForError(err),\r\n    ).Wait().EventID()\r\n    fmt.Println(\"Sent event to Sentry: \", id)\r\n}\r\n```\r\n\r\n### HTTP Request Context\r\n```go\r\npackage main\r\n\r\nimport (\r\n    \"net/http\"\r\n    \"os\"\r\n    \r\n    \"gopkg.in/SierraSoftworks/sentry-go.v2\"\r\n)\r\n\r\nfunc main() {\r\n    cl := sentry.NewClient(\r\n        sentry.Release(\"v1.0.0\"),\r\n    )\r\n\r\n    http.HandleFunc(\"/\", func(res http.ResponseWriter, req *http.Request) {\r\n        cl := cl.With(\r\n            sentry.HTTPRequest(req).WithHeaders(),\r\n        )\r\n\r\n        res.Header().Set(\"Content-Type\", \"application/json\")\r\n        res.WriteHeader(404)\r\n        res.Write([]byte(`{\"error\":\"Not Found\",\"message\":\"We could not find the route you requested, please check your URL and try again.\"}`))\r\n\r\n        cl.Capture(\r\n            sentry.Message(\"Route Not Found: [%s] %s\", req.Method, req.URL.Path),\r\n            sentry.Level(sentry.Warning),\r\n        )\r\n    })\r\n\r\n    if err := http.ListenAndServe(\":8080\", nil); err != nil {\r\n        cl.Capture(\r\n            sentry.ExceptionForError(err),\r\n            sentry.Level(sentry.Fatal),\r\n            sentry.Extra(map[string]interface{}{\r\n                \"port\": 8080,\r\n            }),\r\n        )\r\n\r\n        os.Exit(1)\r\n    }\r\n}\r\n```\r\n\r\n## Advanced Use Cases\r\n\r\n### Custom SendQueues\r\nThe default send queue provided by this library is a serial, buffered, queue\r\nwhich waits for a request to complete before sending the next. This works well\r\nto limit the potential for clients DoSing your Sentry server, but might not\r\nbe what you want.\r\n\r\nFor situations where you'd prefer to use a different type of queue algorithm,\r\nthis library allows you to change the queue implementation both globally and\r\non a per-client basis. You may also opt to use multiple send queues spread\r\nbetween different clients to impose custom behaviour for different portions\r\nof your application.\r\n\r\n```go\r\nimport \"gopkg.in/SierraSoftworks/sentry-go.v2\"\r\n\r\nfunc main() {\r\n    // Configure a new global send queue\r\n    sentry.AddDefaultOptions(\r\n        sentry.UseSendQueue(sentry.NewSequentialSendQueue(10)),\r\n    )\r\n\r\n    cl := sentry.NewClient()\r\n    cl.Capture(sentry.Message(\"Sent over the global queue\"))\r\n\r\n    // Create a client with its own send queue\r\n    cl2 := sentry.NewClient(\r\n        UseSendQueue(sentry.NewSequentialSendQueue(100)),\r\n    )\r\n    cl2.Capture(sentry.Message(\"Sent over the client's queue\"))\r\n}\r\n```\r\n\r\nSendQueue implementations must implement the `SendQueue` interface, which\r\nrequires it to provide both the `Enqueue` and `Shutdown` methods.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsierrasoftworks%2Fsentry-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsierrasoftworks%2Fsentry-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsierrasoftworks%2Fsentry-go/lists"}