blob: 2f37daae66ab0b28a0544b3e51b27709bb3f4577 [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/influxdb-emitter">
<head>
<meta charset="UTF-8">
<meta name="generator" content="Docusaurus v2.4.1">
<title data-rh="true">InfluxDB 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/26.0.0/development/extensions-contrib/influxdb-emitter"><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="InfluxDB 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/26.0.0/development/extensions-contrib/influxdb-emitter"><link data-rh="true" rel="alternate" href="https://druid.apache.org/docs/26.0.0/development/extensions-contrib/influxdb-emitter" hreflang="en"><link data-rh="true" rel="alternate" href="https://druid.apache.org/docs/26.0.0/development/extensions-contrib/influxdb-emitter" 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.f80751b3.css">
<link rel="preload" href="/assets/js/runtime~main.38900cbf.js" as="script">
<link rel="preload" href="/assets/js/main.5e106d68.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/26.0.0/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>InfluxDB Emitter</h1></header><p>To use this Apache Druid extension, <a href="/docs/26.0.0/development/extensions#loading-extensions">include</a> <code>druid-influxdb-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 href="https://www.influxdata.com/time-series-platform/influxdb/" target="_blank" rel="noopener noreferrer">InfluxDB</a> over HTTP. Currently this emitter only emits service metric events to InfluxDB (See <a href="/docs/26.0.0/operations/metrics">Druid metrics</a> for a list of metrics).
When a metric event is fired it is added to a queue of events. After a configurable amount of time, the events on the queue are transformed to InfluxDB&#x27;s line protocol
and POSTed to the InfluxDB HTTP API. The entire queue is flushed at this point. The queue is also flushed as the emitter is shutdown.</p><p>Note that authentication and authorization must be <a href="https://docs.influxdata.com/influxdb/v1.7/administration/authentication_and_authorization/" target="_blank" rel="noopener noreferrer">enabled</a> on the InfluxDB server.</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 the influxdb emitter are under <code>druid.emitter.influxdb</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.influxdb.hostname</code></td><td>The hostname of the InfluxDB server.</td><td>Yes</td><td>N/A</td></tr><tr><td><code>druid.emitter.influxdb.port</code></td><td>The port of the InfluxDB server.</td><td>No</td><td>8086</td></tr><tr><td><code>druid.emitter.influxdb.protocol</code></td><td>The protocol used to send metrics to InfluxDB. One of http/https</td><td>No</td><td>http</td></tr><tr><td><code>druid.emitter.influxdb.trustStorePath</code></td><td>The path to the trustStore to be used for https</td><td>No</td><td>none</td></tr><tr><td><code>druid.emitter.influxdb.trustStoreType</code></td><td>The trustStore type to be used for https</td><td>No</td><td><code>jks</code></td></tr><tr><td><code>druid.emitter.influxdb.trustStorePassword</code></td><td>The trustStore password to be used for https</td><td>No</td><td>none</td></tr><tr><td><code>druid.emitter.influxdb.databaseName</code></td><td>The name of the database in InfluxDB.</td><td>Yes</td><td>N/A</td></tr><tr><td><code>druid.emitter.influxdb.maxQueueSize</code></td><td>The size of the queue that holds events.</td><td>No</td><td>Integer.MAX_VALUE(=2^31-1)</td></tr><tr><td><code>druid.emitter.influxdb.flushPeriod</code></td><td>How often (in milliseconds) the events queue is parsed into Line Protocol and POSTed to InfluxDB.</td><td>No</td><td>60000</td></tr><tr><td><code>druid.emitter.influxdb.flushDelay</code></td><td>How long (in milliseconds) the scheduled method will wait until it first runs.</td><td>No</td><td>60000</td></tr><tr><td><code>druid.emitter.influxdb.influxdbUserName</code></td><td>The username for authenticating with the InfluxDB database.</td><td>Yes</td><td>N/A</td></tr><tr><td><code>druid.emitter.influxdb.influxdbPassword</code></td><td>The password of the database authorized user</td><td>Yes</td><td>N/A</td></tr><tr><td><code>druid.emitter.influxdb.dimensionWhitelist</code></td><td>A whitelist of metric dimensions to include as tags</td><td>No</td><td><code>[&quot;dataSource&quot;,&quot;type&quot;,&quot;numMetrics&quot;,&quot;numDimensions&quot;,&quot;threshold&quot;,&quot;dimension&quot;,&quot;taskType&quot;,&quot;taskStatus&quot;,&quot;tier&quot;]</code></td></tr></tbody></table><h2 class="anchor anchorWithStickyNavbar_LWe7" id="influxdb-line-protocol">InfluxDB Line Protocol<a href="#influxdb-line-protocol" class="hash-link" aria-label="Direct link to InfluxDB Line Protocol" title="Direct link to InfluxDB Line Protocol"></a></h2><p>An example of how this emitter parses a Druid metric event into InfluxDB&#x27;s <a href="https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_reference/" target="_blank" rel="noopener noreferrer">line protocol</a> is given here:</p><p>The syntax of the line protocol is :</p><p><code>&lt;measurement&gt;[,&lt;tag_key&gt;=&lt;tag_value&gt;[,&lt;tag_key&gt;=&lt;tag_value&gt;]] &lt;field_key&gt;=&lt;field_value&gt;[,&lt;field_key&gt;=&lt;field_value&gt;] [&lt;timestamp&gt;]</code></p><p>where timestamp is in nanoseconds since epoch.</p><p>A typical service metric event as recorded by Druid&#x27;s logging emitter is: <code>Event [{&quot;feed&quot;:&quot;metrics&quot;,&quot;timestamp&quot;:&quot;2017-10-31T09:09:06.857Z&quot;,&quot;service&quot;:&quot;druid/historical&quot;,&quot;host&quot;:&quot;historical001:8083&quot;,&quot;version&quot;:&quot;0.11.0-SNAPSHOT&quot;,&quot;metric&quot;:&quot;query/cache/total/hits&quot;,&quot;value&quot;:34787256}]</code>.</p><p>This event is parsed into line protocol according to these rules:</p><ul><li>The measurement becomes druid_query since query is the first part of the metric.</li><li>The tags are service=druid/historical, hostname=historical001, metric=druid<em>cache_total. (The metric tag is the middle part of the druid metric separated with </em> and preceded by druid_. Another example would be if an event has metric=query/time then there is no middle part and hence no metric tag)</li><li>The field is druid_hits since this is the last part of the metric.</li></ul><p>This gives the following String which can be POSTed to InfluxDB: <code>&quot;druid_query,service=druid/historical,hostname=historical001,metric=druid_cache_total druid_hits=34787256 1509440946857000000&quot;</code></p><p>The InfluxDB emitter has a white list of dimensions
which will be added as a tag to the line protocol string if the metric has a dimension from the white list.
The value of the dimension is sanitized such that every occurrence of a dot or whitespace is replaced with a <code>_</code> .</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></li><li><a href="#influxdb-line-protocol" class="table-of-contents__link toc-highlight">InfluxDB Line Protocol</a></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.38900cbf.js"></script>
<script src="/assets/js/main.5e106d68.js"></script>
</body>
</html>