{"id":400671,"date":"2022-01-28T17:45:26","date_gmt":"2022-01-28T14:45:26","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/how-to-use-gitlabs-built-in-sentry-error-tracking-service-cloudsavvy-it\/"},"modified":"2022-01-28T17:45:26","modified_gmt":"2022-01-28T14:45:26","slug":"how-to-use-gitlabs-built-in-sentry-error-tracking-service-cloudsavvy-it","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/how-to-use-gitlabs-built-in-sentry-error-tracking-service-cloudsavvy-it\/","title":{"rendered":"#How to Use GitLab\u2019s Built-In Sentry Error Tracking Service \u2013 CloudSavvy IT"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a264ab2528e1\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a264ab2528e1\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-gitlabs-built-in-sentry-error-tracking-service-cloudsavvy-it\/#Getting_Started\" >Getting Started<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-gitlabs-built-in-sentry-error-tracking-service-cloudsavvy-it\/#Configuring_the_Client\" >Configuring the Client<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-gitlabs-built-in-sentry-error-tracking-service-cloudsavvy-it\/#Testing_Your_Integration\" >Testing Your Integration<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-gitlabs-built-in-sentry-error-tracking-service-cloudsavvy-it\/#Limitations\" >Limitations<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-gitlabs-built-in-sentry-error-tracking-service-cloudsavvy-it\/#Summary\" >Summary<\/a><\/li><\/ul><\/nav><\/div>\n<p><strong>&#8220;#How to Use GitLab\u2019s Built-In Sentry Error Tracking Service \u2013 CloudSavvy IT&#8221;<\/strong><\/p>\n<div id=\"article-content-area\">\n<img loading=\"lazy\" decoding=\"async\" class=\"type:primaryImage aligncenter size-full wp-image-11268\" data-pagespeed-lazy-srcset=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/05\/c64ced0e.jpeg?width=398&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1 400w, https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/05\/c64ced0e.jpeg?width=1198&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1 1200w\" sizes=\"auto, 400w, 1200w\" data-pagespeed-lazy-src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/05\/c64ced0e.jpeg?width=1198&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Graphic showing the GitLab and Sentry logos\" width=\"1602\" height=\"902\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/sentry.io\">Sentry<\/a> is a popular error-tracking platform that gives you real-time visibility into issues in your production environments. GitLab\u2019s Error Reporting feature lets you bring Sentry reports into your source control platform, offering a centralized view that unifies Sentry errors and GitLab issues.<\/p>\n<p>The feature originally relied on an integration with an existing Sentry service, either the official Sentry.io or your own self-hosted server. This changed with GitLab 14.4 which added a lightweight <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/docs.gitlab.com\/ee\/operations\/error_tracking.html#integrated-error-tracking\">Sentry-compatible backend<\/a> to GitLab itself. You no longer need an actual Sentry installation to get error reports into GitLab.<\/p>\n<p>Here\u2019s how to get started with the integrated Sentry backend. Before we proceed, it\u2019s worth mentioning that this capability might not be right for you if you\u2019re already acquainted with the Sentry dashboard. GitLab\u2019s backend is a barebones solution which surfaces errors as a simple list. It\u2019s best for smaller <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">app<\/a>lications where you don\u2019t want the overhead of managing a separate Sentry project.<\/p>\n<h2 id=\"getting-started\"><span class=\"ez-toc-section\" id=\"Getting_Started\"><\/span>Getting Started<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Create a new project on GitLab.com or your own GitLab server. Navigate to Settings &gt; Monitor in your project\u2019s sidebar and then expand the \u201cError tracking\u201d section. Enable the checkbox under \u201cEnable error tracking\u201d. Make sure the \u201cError tracking backend\u201d radio button is set to \u201cGitLab\u201d. Press the blue \u201cSave changes\u201d button to continue.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-15236\" data-pagespeed-lazy-src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2022\/01\/90bb1e74.jpg?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"1024\" height=\"523\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>\u00a0<\/p>\n<p>The page will reload. Now you can expand the \u201cError tracking\u201d section again to reveal your DSN string. This URL is used to configure your Sentry client library to send events to the GitLab server.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-15237\" data-pagespeed-lazy-src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2022\/01\/3082ad3f.jpg?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"1024\" height=\"523\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>\u00a0<\/p>\n<h2 id=\"configuring-the-client\"><span class=\"ez-toc-section\" id=\"Configuring_the_Client\"><\/span>Configuring the Client<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Now you can add Sentry to your code. Here\u2019s a basic example using the official Sentry client library for Node.js. You can install the package by running <code>npm install @sentry\/node<\/code>. Documentation on all the available clients is available <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/docs.sentry.io\/clients\">from Sentry<\/a>.<\/p>\n<div class=\"wp-geshi-highlight-wrap5\">\n<div class=\"wp-geshi-highlight-wrap4\">\n<div class=\"wp-geshi-highlight-wrap3\">\n<div class=\"wp-geshi-highlight-wrap2\">\n<div class=\"wp-geshi-highlight-wrap\">\n<div class=\"wp-geshi-highlight\">\n<div class=\"javascript\">\n<pre class=\"de1\"><span class=\"kw1\">const<\/span> sentry <span class=\"sy0\">=<\/span> require<span class=\"br0\">(<\/span><span class=\"st0\">\"@sentry\/node\"<\/span><span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span>\n\u00a0\nsentry.<span class=\"me1\">init<\/span><span class=\"br0\">(<\/span><span class=\"br0\">{<\/span>\n    dsn<span class=\"sy0\">:<\/span> <span class=\"st0\">\"https:\/\/glet_abc123@gitlab.example.com\/api\/v4\/error_tracking\/collector\/1\"<\/span>\n<span class=\"br0\">}<\/span><span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>Replace the DSN value with the string you copied from the GitLab UI. The part before the <code>@<\/code> is a special authentication token that permits access to the GitLab server. The remainder consists of the unique error tracking ingest API endpoint for your project.<\/p>\n<h2 id=\"testing-your-integration\"><span class=\"ez-toc-section\" id=\"Testing_Your_Integration\"><\/span>Testing Your Integration<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Official Sentry client libraries start capturing unhandled errors as soon as they\u2019re configured with a DSN. If any following code throws an error that you don\u2019t catch, the event will be reported to your GitLab server.<\/p>\n<p>You can test the integration by manually capturing events. Here\u2019s an example that creates and reports an <code>Error<\/code>instance:<\/p>\n<div class=\"wp-geshi-highlight-wrap5\">\n<div class=\"wp-geshi-highlight-wrap4\">\n<div class=\"wp-geshi-highlight-wrap3\">\n<div class=\"wp-geshi-highlight-wrap2\">\n<div class=\"wp-geshi-highlight-wrap\">\n<div class=\"wp-geshi-highlight\">\n<div class=\"javascript\">\n<pre class=\"de1\">Sentry.<span class=\"me1\">captureException<\/span><span class=\"br0\">(<\/span><span class=\"kw1\">new<\/span> Error<span class=\"br0\">(<\/span><span class=\"st0\">\"Sentry test\"<\/span><span class=\"br0\">)<\/span><span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>Use your project\u2019s sidebar in the GitLab web UI to navigate to the Monitor &gt; Error Tracking page. The error you captured should show up in the list. Click its entry to view the full report and stack trace.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-15233\" data-pagespeed-lazy-src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2022\/01\/ec750bf7.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"1268\" height=\"648\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>GitLab issues can be created from reports using the blue \u201cCreate issue\u201d button in the top-right. This lets you assign re<a href=\"https:\/\/buradabiliyorum.com\/en\/category\/social-mediaa\/\" data-internallinksmanager029f6b8e52c=\"1\" title=\"Social Media\" target=\"_blank\" rel=\"noopener\">media<\/a>tion work to team members and start a discussion on the problem. The issue will retain a link to the error report and the stack trace will show inline below the issue\u2019s description.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-15231\" data-pagespeed-lazy-src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2022\/01\/28cfc765.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"1268\" height=\"648\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Once you\u2019re done patching an issue, use the Error Tracking page to mark it as resolved. Issues can also be ignored if you don\u2019t intend to remedy them, perhaps because they were transient or logged by an outdated client.<\/p>\n<h2 id=\"limitations\"><span class=\"ez-toc-section\" id=\"Limitations\"><\/span>Limitations<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>GitLab\u2019s integrated Sentry backend is currently intended for small-scale situations where deploying Sentry is seen as too complex or unnecessary. The full Sentry platform is a broad system that can take time to configure and maintain. GitLab\u2019s integration is a single checkbox in your project\u2019s settings but this simplicity comes at a cost.<\/p>\n<p>The Error Tracking list is your only view into reports. You can\u2019t currently graph them, view changes in report volumes over time, or filter by individual users or clients. Detailed information shown by the Sentry UI, such as browser and server data, isn\u2019t currently supported or surfaced anywhere in GitLab.<\/p>\n<p>You should also be aware that GitLab can\u2019t yet send emails for new error reports. You must manually monitor the Error Tracking page to stay ahead of the events being generated by your deployments.<\/p>\n<p>As GitLab implements the core features of the Sentry API, it\u2019s compatible with most major SDKs and client libraries. As of GitLab 14.5, it\u2019s confirmed to work with Ruby, JavaScript, Java, and Python; other languages either have partial support or <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/gitlab.com\/gitlab-org\/gitlab\/-\/issues\/340178\">will be added<\/a> in future GitLab releases.<\/p>\n<h2 id=\"summary\"><span class=\"ez-toc-section\" id=\"Summary\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>GitLab\u2019s Sentry backend provides a simple way to capture error reports from your application and store them alongside your code. Although its current limitations render it unsuitable for all but the simplest of use cases, it\u2019s still a compelling option for smaller sites and personal projects that don\u2019t need the complexity of a full Sentry service.<\/p>\n<p>The integrated backend could also be useful when testing Sentry integration with your code. If you\u2019re setting up a new client, or modifying settings of an existing one, you could use your GitLab server as a temporary backend so you don\u2019t pollute your primary Sentry deployment.<\/p>\n<p>GitLab\u2019s Error Tracking component remains <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/gitlab.com\/gitlab-org\/gitlab\/-\/issues\/329596\">in development<\/a> and is due to be expanded over subsequent milestones. This should see it evolve into a more fully fledged option that can replace standalone Sentry in a broader set of environments.\n<\/div>\n<blockquote><p><strong><span style=\"color: #ff6600;\">If you liked the article, do not forget to share it with your friends. Follow us on\u00a0<span style=\"color: #ff0000;\"><a style=\"color: #ff0000;\" href=\"https:\/\/news.google.com\/publications\/CAAqBwgKMLG0nwswvr63Aw\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google News<\/a><\/span>\u00a0too, click on the star and choose us from your favorites.<\/span><\/strong><\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.cloudsavvyit.com\/15229\/how-to-use-gitlabs-built-in-sentry-error-tracking-service\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;#How to Use GitLab\u2019s Built-In Sentry Error Tracking Service \u2013 CloudSavvy IT&#8221; Sentry is a popular error-tracking platform that gives you real-time visibility into issues in your production environments. GitLab\u2019s Error Reporting feature lets you bring Sentry reports into your source control platform, offering a centralized view that unifies Sentry errors and GitLab issues. The&#8230;<\/p>\n","protected":false},"author":1,"featured_media":400672,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/05\/c64ced0e.jpeg","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-400671","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/400671","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=400671"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/400671\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/400672"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=400671"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=400671"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=400671"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}