blob: 2beb123a8387ffc3ebf793b82723fa9c0e896887 [file] [log] [blame]
<!doctype html>
<html lang="en" dir="ltr" class="docs-wrapper docs-doc-page docs-version-current plugin-docs plugin-id-default docs-doc-id-development/extensions-contrib/graphite">
<head>
<meta charset="UTF-8">
<meta name="generator" content="Docusaurus v2.4.1">
<title data-rh="true">Graphite Emitter | Apache® Druid</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:image" content="https://druid.apache.org/img/druid_nav.png"><meta data-rh="true" name="twitter:image" content="https://druid.apache.org/img/druid_nav.png"><meta data-rh="true" property="og:url" content="https://druid.apache.org/docs/latest/development/extensions-contrib/graphite"><meta data-rh="true" name="docusaurus_locale" content="en"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="docusaurus_version" content="current"><meta data-rh="true" name="docusaurus_tag" content="docs-default-current"><meta data-rh="true" name="docsearch:version" content="current"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-current"><meta data-rh="true" property="og:title" content="Graphite Emitter | Apache® Druid"><meta data-rh="true" name="description" content="&lt;!--"><meta data-rh="true" property="og:description" content="&lt;!--"><link data-rh="true" rel="icon" href="/img/favicon.png"><link data-rh="true" rel="canonical" href="https://druid.apache.org/docs/latest/development/extensions-contrib/graphite"><link data-rh="true" rel="alternate" href="https://druid.apache.org/docs/latest/development/extensions-contrib/graphite" hreflang="en"><link data-rh="true" rel="alternate" href="https://druid.apache.org/docs/latest/development/extensions-contrib/graphite" hreflang="x-default"><link rel="preconnect" href="https://www.google-analytics.com">
<link rel="preconnect" href="https://www.googletagmanager.com">
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-131010415-1"></script>
<script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","UA-131010415-1",{})</script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js"></script><link rel="stylesheet" href="/assets/css/styles.546f39eb.css">
<link rel="preload" href="/assets/js/runtime~main.9a92b840.js" as="script">
<link rel="preload" href="/assets/js/main.6f6dba15.js" as="script">
</head>
<body class="navigation-with-keyboard">
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}return t}()||function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus">
<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top navbar--dark"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="/img/druid_nav.png" alt="Apache® Druid" class="themedImage_ToTc themedImage--light_HNdA"><img src="/img/druid_nav.png" alt="Apache® Druid" class="themedImage_ToTc themedImage--dark_i4oU"></div></a></div><div class="navbar__items navbar__items--right"><a class="navbar__item navbar__link" href="/technology">Technology</a><a class="navbar__item navbar__link" href="/use-cases">Use Cases</a><a class="navbar__item navbar__link" href="/druid-powered">Powered By</a><a class="navbar__item navbar__link" href="/docs/latest/design/">Docs</a><a class="navbar__item navbar__link" href="/community/">Community</a><div class="navbar__item dropdown dropdown--hoverable dropdown--right"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">Apache®</a><ul class="dropdown__menu"><li><a href="https://www.apache.org/" target="_blank" rel="noopener noreferrer" class="dropdown__link">Foundation<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://apachecon.com/?ref=druid.apache.org" target="_blank" rel="noopener noreferrer" class="dropdown__link">Events<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://www.apache.org/licenses/" target="_blank" rel="noopener noreferrer" class="dropdown__link">License<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://www.apache.org/foundation/thanks.html" target="_blank" rel="noopener noreferrer" class="dropdown__link">Thanks<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://www.apache.org/security/" target="_blank" rel="noopener noreferrer" class="dropdown__link">Security<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://www.apache.org/foundation/sponsorship.html" target="_blank" rel="noopener noreferrer" class="dropdown__link">Sponsorship<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><a class="navbar__item navbar__link" href="/downloads/">Download</a><div class="searchBox_ZlJk"><div class="navbar__search"><span aria-label="expand searchbar" role="button" class="search-icon" tabindex="0"></span><input type="search" id="search_input_react" placeholder="Loading..." aria-label="Search" class="navbar__search-input search-bar" disabled=""></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Graphite Emitter</h1></header><p>To use this Apache Druid extension, <a href="/docs/latest/configuration/extensions#loading-extensions">include</a> <code>graphite-emitter</code> in the extensions load list.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="introduction">Introduction<a href="#introduction" class="hash-link" aria-label="Direct link to Introduction" title="Direct link to Introduction"></a></h2><p>This extension emits druid metrics to a graphite carbon server.
Metrics can be sent by using <a href="http://graphite.readthedocs.io/en/latest/feeding-carbon.html#the-plaintext-protocol" target="_blank" rel="noopener noreferrer">plaintext</a> or <a href="http://graphite.readthedocs.io/en/latest/feeding-carbon.html#the-pickle-protocol" target="_blank" rel="noopener noreferrer">pickle</a> protocol.
The pickle protocol is more efficient and supports sending batches of metrics (plaintext protocol send only one metric) in one request; batch size is configurable.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="configuration">Configuration<a href="#configuration" class="hash-link" aria-label="Direct link to Configuration" title="Direct link to Configuration"></a></h2><p>All the configuration parameters for graphite emitter are under <code>druid.emitter.graphite</code>.</p><table><thead><tr><th>property</th><th>description</th><th>required?</th><th>default</th></tr></thead><tbody><tr><td><code>druid.emitter.graphite.hostname</code></td><td>The hostname of the graphite server.</td><td>yes</td><td>none</td></tr><tr><td><code>druid.emitter.graphite.port</code></td><td>The port of the graphite server.</td><td>yes</td><td>none</td></tr><tr><td><code>druid.emitter.graphite.batchSize</code></td><td>Number of events to send as one batch (only for pickle protocol)</td><td>no</td><td>100</td></tr><tr><td><code>druid.emitter.graphite.protocol</code></td><td>Graphite protocol; available protocols: pickle, plaintext.</td><td>no</td><td>pickle</td></tr><tr><td><code>druid.emitter.graphite.eventConverter</code></td><td>Filter and converter of druid events to graphite event (please see next section).</td><td>yes</td><td>none</td></tr><tr><td><code>druid.emitter.graphite.flushPeriod</code></td><td>Queue flushing period in milliseconds.</td><td>no</td><td>1 minute</td></tr><tr><td><code>druid.emitter.graphite.maxQueueSize</code></td><td>Maximum size of the queue used to buffer events.</td><td>no</td><td><code>MAX_INT</code></td></tr><tr><td><code>druid.emitter.graphite.alertEmitters</code></td><td>List of emitters where alerts will be forwarded to. This is a JSON list of emitter names, e.g. <code>[&quot;logging&quot;, &quot;http&quot;]</code></td><td>no</td><td>empty list (no forwarding)</td></tr><tr><td><code>druid.emitter.graphite.requestLogEmitters</code></td><td>List of emitters where request logs (i.e., query logging events sent to emitters when <code>druid.request.logging.type</code> is set to <code>emitter</code>) will be forwarded to. This is a JSON list of emitter names, e.g. <code>[&quot;logging&quot;, &quot;http&quot;]</code></td><td>no</td><td>empty list (no forwarding)</td></tr><tr><td><code>druid.emitter.graphite.emitWaitTime</code></td><td>wait time in milliseconds to try to send the event otherwise emitter will throwing event.</td><td>no</td><td>0</td></tr><tr><td><code>druid.emitter.graphite.waitForEventTime</code></td><td>waiting time in milliseconds if necessary for an event to become available.</td><td>no</td><td>1000 (1 sec)</td></tr></tbody></table><h3 class="anchor anchorWithStickyNavbar_LWe7" id="supported-event-types">Supported event types<a href="#supported-event-types" class="hash-link" aria-label="Direct link to Supported event types" title="Direct link to Supported event types"></a></h3><p>The graphite emitter only emits service metric events to graphite (See <a href="/docs/latest/operations/metrics">Druid Metrics</a> for a list of metrics).</p><p>Alerts and request logs are not sent to graphite. These event types are not well represented in Graphite, which is more suited for timeseries views on numeric metrics, vs. storing non-numeric log events.</p><p>Instead, alerts and request logs are optionally forwarded to other emitter implementations, specified by <code>druid.emitter.graphite.alertEmitters</code> and <code>druid.emitter.graphite.requestLogEmitters</code> respectively.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="druid-to-graphite-event-converter">Druid to Graphite Event Converter<a href="#druid-to-graphite-event-converter" class="hash-link" aria-label="Direct link to Druid to Graphite Event Converter" title="Direct link to Druid to Graphite Event Converter"></a></h3><p>Graphite Event Converter defines a mapping between druid metrics name plus dimensions to a Graphite metric path.
Graphite metric path is organized using the following schema:
<code>&lt;namespacePrefix&gt;.[&lt;druid service name&gt;].[&lt;druid hostname&gt;].&lt;druid metrics dimensions&gt;.&lt;druid metrics name&gt;</code>
Properly naming the metrics is critical to avoid conflicts, confusing data and potentially wrong interpretation later on.</p><p>Example <code>druid.historical.hist-host1_yahoo_com:8080.MyDataSourceName.GroupBy.query/time</code>:</p><ul><li><code>druid</code> -&gt; namespace prefix</li><li><code>historical</code> -&gt; service name</li><li><code>hist-host1.yahoo.com:8080</code> -&gt; druid hostname</li><li><code>MyDataSourceName</code> -&gt; dimension value</li><li><code>GroupBy</code> -&gt; dimension value</li><li><code>query/time</code> -&gt; metric name</li></ul><p>We have two different implementation of event converter:</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="send-all-converter">Send-All converter<a href="#send-all-converter" class="hash-link" aria-label="Direct link to Send-All converter" title="Direct link to Send-All converter"></a></h4><p>The first implementation called <code>all</code>, will send all the druid service metrics events.
The path will be in the form <code>&lt;namespacePrefix&gt;.[&lt;druid service name&gt;].[&lt;druid hostname&gt;].&lt;dimensions values ordered by dimension&#x27;s name&gt;.&lt;metric&gt;</code>
User has control of <code>&lt;namespacePrefix&gt;.[&lt;druid service name&gt;].[&lt;druid hostname&gt;].</code></p><p>You can omit the hostname by setting <code>ignoreHostname=true</code>
<code>druid.SERVICE_NAME.dataSourceName.queryType.query/time</code></p><p>You can omit the service name by setting <code>ignoreServiceName=true</code>
<code>druid.HOSTNAME.dataSourceName.queryType.query/time</code></p><p>Elements in metric name by default are separated by &quot;/&quot;, so graphite will create all metrics on one level. If you want to have metrics in the tree structure, you have to set <code>replaceSlashWithDot=true</code>
Original: <code>druid.HOSTNAME.dataSourceName.queryType.query/time</code>
Changed: <code>druid.HOSTNAME.dataSourceName.queryType.query.time</code></p><div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">druid.emitter.graphite.eventConverter=</span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token property">&quot;type&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token string" style="color:rgb(195, 232, 141)">&quot;all&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> </span><span class="token property">&quot;namespacePrefix&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;druid.test&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> </span><span class="token property">&quot;ignoreHostname&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token boolean" style="color:rgb(255, 88, 116)">true</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> </span><span class="token property">&quot;ignoreServiceName&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token boolean" style="color:rgb(255, 88, 116)">true</span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block"></span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h4 class="anchor anchorWithStickyNavbar_LWe7" id="white-list-based-converter">White-list based converter<a href="#white-list-based-converter" class="hash-link" aria-label="Direct link to White-list based converter" title="Direct link to White-list based converter"></a></h4><p>The second implementation called <code>whiteList</code>, will send only the white listed metrics and dimensions.
Same as for the <code>all</code> converter user has control of <code>&lt;namespacePrefix&gt;.[&lt;druid service name&gt;].[&lt;druid hostname&gt;].</code>
White-list based converter comes with the following default white list map located under resources in <code>./src/main/resources/defaultWhiteListMap.json</code></p><p>Although user can override the default white list map by supplying a property called <code>mapPath</code>.
This property is a String containing the path for the file containing <strong>white list map JSON object</strong>.
For example the following converter will read the map from the file <code>/pathPrefix/fileName.json</code>.</p><div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">druid.emitter.graphite.eventConverter=</span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token property">&quot;type&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token string" style="color:rgb(195, 232, 141)">&quot;whiteList&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> </span><span class="token property">&quot;namespacePrefix&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;druid.test&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> </span><span class="token property">&quot;ignoreHostname&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token boolean" style="color:rgb(255, 88, 116)">true</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> </span><span class="token property">&quot;ignoreServiceName&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token boolean" style="color:rgb(255, 88, 116)">true</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> </span><span class="token property">&quot;mapPath&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token string" style="color:rgb(195, 232, 141)">&quot;/pathPrefix/fileName.json&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block"></span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Druid emits a huge number of metrics we highly recommend to use the <code>whiteList</code> converter</strong></p></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#introduction" class="table-of-contents__link toc-highlight">Introduction</a></li><li><a href="#configuration" class="table-of-contents__link toc-highlight">Configuration</a><ul><li><a href="#supported-event-types" class="table-of-contents__link toc-highlight">Supported event types</a></li><li><a href="#druid-to-graphite-event-converter" class="table-of-contents__link toc-highlight">Druid to Graphite Event Converter</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="margin-bottom--sm"><img src="/img/favicon.png" class="themedImage_ToTc themedImage--light_HNdA footer__logo"><img src="/img/favicon.png" class="themedImage_ToTc themedImage--dark_i4oU footer__logo"></div><div class="footer__copyright">Copyright © 2023 Apache Software Foundation. Except where otherwise noted, licensed under CC BY-SA 4.0. Apache Druid, Druid, and the Druid logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and other countries.</div></div></div></footer></div>
<script src="/assets/js/runtime~main.9a92b840.js"></script>
<script src="/assets/js/main.6f6dba15.js"></script>
</body>
</html>