{"componentChunkName":"component---src-templates-platform-tsx","path":"/platforms/go/configuration/filtering/","result":{"data":{"file":{"id":"243dc9f5-236c-5913-a9b9-396055e4fd53","relativePath":"common/configuration/filtering.mdx","sourceInstanceName":"platforms","childMarkdownRemark":null,"childMdx":{"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"title\": \"Filtering and Sampling Events\",\n  \"sidebar_order\": 5,\n  \"description\": \"Learn more about how to configure your SDK to filter and sample events reported to Sentry.\",\n  \"notoc\": true,\n  \"notSupported\": [\"perl\"]\n};\n\nvar makeShortcode = function makeShortcode(name) {\n  return function MDXDefaultShortcode(props) {\n    console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n    return mdx(\"div\", props);\n  };\n};\n\nvar PlatformContent = makeShortcode(\"PlatformContent\");\nvar PlatformSection = makeShortcode(\"PlatformSection\");\nvar CodeTabs = makeShortcode(\"CodeTabs\");\nvar CodeBlock = makeShortcode(\"CodeBlock\");\nvar PlatformLink = makeShortcode(\"PlatformLink\");\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, [\"components\"]);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"p\", null, \"Adding Sentry to your app gives you a great deal of very valuable information about errors and performance you wouldn't otherwise get. And lots of information is good -- as long as it's the right information, at a reasonable volume.\"), mdx(\"p\", null, \"The Sentry SDKs have several configuration options to help you control this, allowing you to both filter out events you don't want and to take a representative sample of those you do.\"), mdx(\"p\", null, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"Note:\"), \": The Sentry UI also offers methods to filter events, by using \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"/product/error-monitoring/filtering/\"\n  }), \"Inbound Filters\"), \". We recommend filtering at the client level though, because it removes the overhead of sending events you don't actually want.\"), mdx(\"h2\", {\n    \"id\": \"filtering-error-events\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h2\"\n  }, {\n    \"href\": \"#filtering-error-events\",\n    \"aria-label\": \"filtering error events permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"Filtering Error Events\"), mdx(\"p\", null, \"Configure your SDK to filter error events by using the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"beforeSend\"), \" callback method and configuring, enabling, or disabling integrations.\"), mdx(\"h3\", {\n    \"id\": \"using-beforesend\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h3\"\n  }, {\n    \"href\": \"#using-beforesend\",\n    \"aria-label\": \"using beforesend permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"Using \", mdx(\"inlineCode\", {\n    parentName: \"h3\"\n  }, \"beforeSend\")), mdx(\"p\", null, \"All Sentry SDKs support the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"beforeSend\"), \" callback method. \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"beforeSend\"), \" is called immediately before the event is sent to the server, so it\\u2019s the final place where you can edit its data. It receives the event object as a parameter, so you can use that to modify the event\\u2019s data or drop it completely (by returning \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"null\"), \") based on custom logic and the data available on the event.\"), mdx(PlatformContent, {\n    includePath: \"configuration/before-send\",\n    mdxType: \"PlatformContent\"\n  }), mdx(\"p\", null, \"Note also that breadcrumbs can be filtered, as discussed in \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"/product/error-monitoring/breadcrumbs/\"\n  }), \"our Breadcrumbs documentation\"), \".\"), mdx(\"h4\", {\n    \"id\": \"event-hints\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h4\"\n  }, {\n    \"href\": \"#event-hints\",\n    \"aria-label\": \"event hints permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"Event Hints\"), mdx(\"p\", null, \"The\\xA0\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"before-send\"), \"\\xA0callback is passed both the\\xA0\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"event\"), \"\\xA0and a second argument,\\xA0\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"hint\"), \",\\xA0that holds one or more hints.\"), mdx(\"p\", null, \"Typically a \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"hint\"), \" holds the original exception so that additional data can be extracted or grouping is affected.\\xA0In this example, the fingerprint is forced to a common value if an exception of a certain type has been caught:\"), mdx(PlatformContent, {\n    includePath: \"configuration/before-send-hint\",\n    mdxType: \"PlatformContent\"\n  }), mdx(\"p\", null, \"When the SDK creates an event or breadcrumb for transmission, that transmission is typically created from some sort of source object. For instance, an error event is typically created from a log record or exception instance. For better customization, SDKs send these objects to certain callbacks (\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"beforeSend\"), \",\\xA0\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"beforeBreadcrumb\"), \"\\xA0or the event processor system in the SDK).\"), mdx(\"h3\", {\n    \"id\": \"using-hints\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h3\"\n  }, {\n    \"href\": \"#using-hints\",\n    \"aria-label\": \"using hints permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"Using Hints\"), mdx(\"p\", null, \"Hints are available in two places:\"), mdx(\"ol\", null, mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"beforeSend\"), \" / \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"beforeBreadcrumb\")), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"eventProcessors\"))), mdx(\"p\", null, \"Event and breadcrumb\\xA0\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"hints\"), \"\\xA0are objects containing various information used to put together an event or a breadcrumb. Typically \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"hints\"), \" hold the original exception so that additional data can be extracted or grouping can be affected.\"), mdx(\"p\", null, \"For events, such as\\xA0\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"event_id\"), \",\\xA0\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"originalException\"), \", \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"syntheticException\"), \"\\xA0(used internally to generate cleaner stack trace), and any other arbitrary\\xA0\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"data\"), \"\\xA0that you attach.\"), mdx(\"p\", null, \"For breadcrumbs, the use of \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"hints\"), \" is implementation dependent. For XHR requests, the hint contains the xhr object itself; for user interactions the hint contains the DOM element and event name and so forth.\"), mdx(\"p\", null, \"In this example, the fingerprint is forced to a common value if an exception of a certain type has been caught:\"), mdx(PlatformContent, {\n    includePath: \"configuration/before-send-fingerprint\",\n    mdxType: \"PlatformContent\"\n  }), mdx(\"h4\", {\n    \"id\": \"hints-for-events\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h4\"\n  }, {\n    \"href\": \"#hints-for-events\",\n    \"aria-label\": \"hints for events permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"Hints for Events\"), mdx(\"p\", null, mdx(\"dl\", {\n    parentName: \"p\"\n  }, mdx(\"dt\", {\n    parentName: \"dl\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"dt\"\n  }, \"originalException\")), mdx(\"dd\", {\n    parentName: \"dl\"\n  }, \"The original exception that caused the Sentry SDK to create the event. This is useful for changing how the Sentry SDK groups events or to extract additional information.\"))), mdx(\"p\", null, mdx(\"dl\", {\n    parentName: \"p\"\n  }, mdx(\"dt\", {\n    parentName: \"dl\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"dt\"\n  }, \"syntheticException\")), mdx(\"dd\", {\n    parentName: \"dl\"\n  }, \"When a string or a non-error object is raised, Sentry creates a synthetic exception so you can get a basic stack trace. This exception is stored here for further data extraction.\"))), mdx(\"h4\", {\n    \"id\": \"hints-for-breadcrumbs\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h4\"\n  }, {\n    \"href\": \"#hints-for-breadcrumbs\",\n    \"aria-label\": \"hints for breadcrumbs permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"Hints for Breadcrumbs\"), mdx(\"p\", null, mdx(\"dl\", {\n    parentName: \"p\"\n  }, mdx(\"dt\", {\n    parentName: \"dl\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"dt\"\n  }, \"event\")), mdx(\"dd\", {\n    parentName: \"dl\"\n  }, \"For breadcrumbs created from browser events, the Sentry SDK often supplies the event to the breadcrumb as a hint. This, for instance, can be used to extract data from the target DOM element into a breadcrumb.\"))), mdx(\"p\", null, mdx(\"dl\", {\n    parentName: \"p\"\n  }, mdx(\"dt\", {\n    parentName: \"dl\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"dt\"\n  }, \"level\"), \"\\xA0/\\xA0\", mdx(\"inlineCode\", {\n    parentName: \"dt\"\n  }, \"input\")), mdx(\"dd\", {\n    parentName: \"dl\"\n  }, \"For breadcrumbs created from console log interceptions. This holds the original console log level and the original input data to the log function.\"))), mdx(\"p\", null, mdx(\"dl\", {\n    parentName: \"p\"\n  }, mdx(\"dt\", {\n    parentName: \"dl\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"dt\"\n  }, \"response\"), \"\\xA0/\\xA0\", mdx(\"inlineCode\", {\n    parentName: \"dt\"\n  }, \"input\")), mdx(\"dd\", {\n    parentName: \"dl\"\n  }, \"For breadcrumbs created from HTTP requests. This holds the response object (from the fetch API) and the input parameters to the fetch function.\"))), mdx(\"p\", null, mdx(\"dl\", {\n    parentName: \"p\"\n  }, mdx(\"dt\", {\n    parentName: \"dl\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"dt\"\n  }, \"request\"), \"\\xA0/\\xA0\", mdx(\"inlineCode\", {\n    parentName: \"dt\"\n  }, \"response\"), \"\\xA0/\\xA0\", mdx(\"inlineCode\", {\n    parentName: \"dt\"\n  }, \"event\")), mdx(\"dd\", {\n    parentName: \"dl\"\n  }, \"For breadcrumbs created from HTTP requests. This holds the request and response object (from the node HTTP API) as well as the node event (\", mdx(\"inlineCode\", {\n    parentName: \"dd\"\n  }, \"response\"), \"\\xA0or\\xA0\", mdx(\"inlineCode\", {\n    parentName: \"dd\"\n  }, \"error\"), \").\"))), mdx(\"p\", null, mdx(\"dl\", {\n    parentName: \"p\"\n  }, mdx(\"dt\", {\n    parentName: \"dl\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"dt\"\n  }, \"xhr\")), mdx(\"dd\", {\n    parentName: \"dl\"\n  }, \"For breadcrumbs created from HTTP requests done via the legacy\\xA0\", mdx(\"inlineCode\", {\n    parentName: \"dd\"\n  }, \"XMLHttpRequest\"), \"\\xA0API. This holds the original xhr object.\"))), mdx(PlatformContent, {\n    includePath: \"configuration/decluttering\",\n    mdxType: \"PlatformContent\"\n  }), mdx(\"h2\", {\n    \"id\": \"sampling-error-events\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h2\"\n  }, {\n    \"href\": \"#sampling-error-events\",\n    \"aria-label\": \"sampling error events permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"Sampling Error Events\"), mdx(\"p\", null, \"To send a representative sample of your errors to Sentry, set the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"sampleRate\"), \" option in your SDK configuration to a number between \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"0\"), \" (0% of errors sent) and \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"1\"), \" (100% of errors sent). This is a static rate, which will apply equally to all errors. For example, to sample 25% of your errors:\"), mdx(PlatformContent, {\n    includePath: \"configuration/sample-rate\",\n    mdxType: \"PlatformContent\"\n  }), mdx(\"p\", null, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"Note:\"), \" The error sample rate is not dynamic; changing it requires re-deployment. In addition, setting an SDK sample rate limits visibility into the source of events. Setting a rate limit for your project (which only drops events when volume is high) may better suit your needs.\"), mdx(PlatformSection, {\n    supported: [\"javascript\", \"node\"],\n    notSupported: [\"react-native\"],\n    mdxType: \"PlatformSection\"\n  }, mdx(\"markdown\", null, mdx(\"h2\", {\n    \"id\": \"filtering-transaction-events\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h2\"\n  }, {\n    \"href\": \"#filtering-transaction-events\",\n    \"aria-label\": \"filtering transaction events permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"Filtering Transaction Events\"), mdx(\"p\", null, \"To prevent certain transactions from being reported to Sentry, use the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"tracesSampler\"), \" configuration option, which allows you to provide a function to evaluate the current transaction and drop it if it's not one you want. (It also allows you to sample different transactions at different rates.)\"), mdx(\"p\", null, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"Note:\"), \" The \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"tracesSampler\"), \" and \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"tracesSampleRate\"), \" config options are mutually exclusive. If you define a \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"tracesSampler\"), \" to filter out certain transactions, you must also handle the case of non-filtered transactions by returning the rate at which you'd like them sampled.\"), mdx(\"p\", null, \"In its simplest form, used just for filtering, it looks like this:\"), mdx(\"div\", {\n    \"className\": \"code-tabs-wrapper\"\n  }, mdx(CodeTabs, {\n    mdxType: \"CodeTabs\"\n  }, mdx(CodeBlock, {\n    language: \"javascript\",\n    title: \"\",\n    filename: \"\",\n    mdxType: \"CodeBlock\"\n  }, mdx(\"div\", _extends({\n    parentName: \"div\"\n  }, {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"javascript\"\n  }), mdx(\"pre\", _extends({\n    parentName: \"div\"\n  }, {\n    \"className\": \"language-javascript\"\n  }), mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-javascript\"\n  }), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token function-variable function\"\n  }), \"tracesSampler\"), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token operator\"\n  }), \":\"), \" \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token parameter\"\n  }), \"samplingContext\"), \" \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token operator\"\n  }), \"=>\"), \" \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \"{\"), \"\\n  \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token keyword\"\n  }), \"if\"), \" \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \"(\"), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token string\"\n  }), \"\\\"...\\\"\"), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \")\"), \" \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \"{\"), \"\\n    \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token keyword\"\n  }), \"return\"), \" \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token number\"\n  }), \"0\"), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \";\"), \" \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token comment\"\n  }), \"// Drop this transaction, by setting its sample rate to 0%\"), \"\\n  \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \"}\"), \" \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token keyword\"\n  }), \"else\"), \" \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \"{\"), \"\\n    \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token keyword\"\n  }), \"return\"), \" \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token number\"\n  }), \"0.2\"), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \";\"), \" \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token comment\"\n  }), \"// Default sample rate for all others (replaces tracesSampleRate )\"), \"\\n  \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \"}\"), \"\\n\", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \"}\"), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \";\"))))))), mdx(\"p\", null, \"To learn more about the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"tracesSampler\"), \" option, please see \", mdx(PlatformLink, {\n    to: \"/performance/sampling/\",\n    mdxType: \"PlatformLink\"\n  }, \"Sampling Transactions\"), \".\"))), mdx(\"h2\", {\n    \"id\": \"sampling-transaction-events\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h2\"\n  }, {\n    \"href\": \"#sampling-transaction-events\",\n    \"aria-label\": \"sampling transaction events permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"Sampling Transaction Events\"), mdx(\"p\", null, \"For Sentry's Performance Monitoring, we\\xA0recommend sampling your data for two reasons. First, though capturing a single trace involves minimal overhead, capturing traces for every single page load, or every single API request, has the potential to add an undesirable amount of load to your system. Second, enabling sampling allows you to better manage the number of events sent to Sentry, so you can tailor it to your organization's needs.\"), mdx(\"p\", null, \"When choosing a sampling rate, the goal is not to collect\\xA0\", mdx(\"em\", {\n    parentName: \"p\"\n  }, \"too\"), \"\\xA0much data, but to collect sufficient data so you can draw meaningful conclusions. If you\\u2019re not sure what rate to choose, start with a low value and gradually increase it as you learn more about your traffic patterns and volume, until you\\u2019ve found a rate that balances performance and volume concerns with data accuracy.\"), mdx(\"p\", null, \"To set a sample rate for your transactions, provide a number between \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"0\"), \" (0% of transactions sent) and \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"1\"), \" (100% of transactions sent) to the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"tracesSampleRate\"), \" configuration option. For example, including \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"tracesSampleRate: 0.2\"), \" in your SDK config will cause the SDK to only send 20% of possible transaction events.\"));\n}\n;\nMDXContent.isMDXComponent = true;","tableOfContents":{"items":[{"url":"#filtering-error-events","title":"Filtering Error Events","items":[{"url":"#using-beforesend","title":"Using beforeSend","items":[{"url":"#event-hints","title":"Event Hints"}]},{"url":"#using-hints","title":"Using Hints","items":[{"url":"#hints-for-events","title":"Hints for Events"},{"url":"#hints-for-breadcrumbs","title":"Hints for Breadcrumbs"}]}]},{"url":"#sampling-error-events","title":"Sampling Error Events"},{"url":"#filtering-transaction-events","title":"Filtering Transaction Events"},{"url":"#sampling-transaction-events","title":"Sampling Transaction Events"}]},"internal":{"type":"Mdx"}}}},"pageContext":{"excerpt":"Adding Sentry to your app gives you a great deal of very valuable information about errors and performance you wouldn't otherwise get. And lots of information is good -- as long as it's the right information, at a reasonable volume. The Sentry SDKs have several configuration options to help you control this, allowing you to both filter out events you don't want and to take a representative sample of those you do. Note: : The Sentry UI also offers methods to filter events, by using  Inbound Filters . We recommend filtering at the client level though, because it removes the overhead of sending events you don't actually want. Filtering Error Events Configure your SDK to filter error events by using the  beforeSend  callback method and configuring, enabling, or disabling integrations. Using  beforeSend All Sentry SDKs support the  beforeSend  callback method.  beforeSend  is called immediately before the event is sent to the server, so it’s the final place where you can edit its data. It receives the event object as a parameter, so you can use that to modify the event’s data or drop it completely (by returning  null ) based on custom logic and the data available on the event. Note also that breadcrumbs can be filtered, as discussed in  our Breadcrumbs documentation . Event Hints The  before-send  callback is passed both the  event  and a second argument,  hint , that holds one or more hints. Typically a  hint  holds the original exception so that additional data can be extracted or grouping is affected. In this example, the fingerprint is forced to a common value if an exception of a certain type has been caught: When the SDK creates an event or breadcrumb for transmission, that transmission is typically created from some sort of source object. For instance, an error event is typically created from a log record or exception instance. For better customization, SDKs send these objects to certain callbacks ( beforeSend ,  beforeBreadcrumb  or the event processor system in the SDK). Using Hints Hints are available in two places: beforeSend  /  beforeBreadcrumb eventProcessors Event and breadcrumb  hints  are objects containing various information used to put together an event or a breadcrumb. Typically  hints  hold the original exception so that additional data can be extracted or grouping can be affected. For events, such as  event_id ,  originalException ,  syntheticException  (used internally to generate cleaner stack trace), and any other arbitrary  data  that you attach. For breadcrumbs, the use of  hints  is implementation dependent. For XHR requests, the hint contains the xhr object itself; for user interactions the hint contains the DOM element and event name and so forth. In this example, the fingerprint is forced to a common value if an exception of a certain type has been caught: Hints for Events originalException : The original exception that caused the Sentry SDK to create the event. This is useful for changing how the Sentry SDK groups events or to extract additional information. syntheticException : When a string or a non-error object is raised, Sentry creates a synthetic exception so you can get a basic stack trace. This exception is stored here for further data extraction. Hints for Breadcrumbs event : For breadcrumbs created from browser events, the Sentry SDK often supplies the event to the breadcrumb as a hint. This, for instance, can be used to extract data from the target DOM element into a breadcrumb. level  /  input : For breadcrumbs created from console log interceptions. This holds the original console log level and the original input data to the log function. response  /  input : For breadcrumbs created from HTTP requests. This holds the response object (from the fetch API) and the input parameters to the fetch function. request  /  response  /  event : For breadcrumbs created from HTTP requests. This holds the request and response object (from the node HTTP API) as well as the node event ( response  or  error ). xhr : For breadcrumbs created from HTTP requests done via the legacy  XMLHttpRequest  API. This holds the original xhr object. Sampling Error Events To send a representative sample of your errors to Sentry, set the  sampleRate  option in your SDK configuration to a number between  0  (0% of errors sent) and  1  (100% of errors sent). This is a static rate, which will apply equally to all errors. For example, to sample 25% of your errors: Note:  The error sample rate is not dynamic; changing it requires re-deployment. In addition, setting an SDK sample rate limits visibility into the source of events. Setting a rate limit for your project (which only drops events when volume is high) may better suit your needs. Filtering Transaction Events To prevent certain transactions from being reported to Sentry, use the  tracesSampler  configuration option, which allows you to provide a function to evaluate the current transaction and drop it if it's not one you want. (It also allows you to…","title":"Filtering and Sampling Events","description":"Learn more about how to configure your SDK to filter and sample events reported to Sentry.","notoc":true,"sidebar_order":5,"notSupported":["perl"],"platform":{"name":"go","title":"Go"},"id":"243dc9f5-236c-5913-a9b9-396055e4fd53"}},"staticQueryHashes":["1218203755","1222113826","1222113826","1766336459","2158593473","2404336828","2472290386","2764967025","3818502851","4015007367","4192517163","4264099332","518019976"]}