UNPKG

dynatrace-api-balancer

Version:

A wrapper around Axios that balances and throttles requests across tenants, clusters and cluster nodes.

97 lines (58 loc) 4.27 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Home</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Home</h1> <h3> </h3> <section> <article><h2>dynatrace-api-balancer</h2> <p>A wrapper around <a href="https://axios-http.com/docs/req_config" title="Axios">Axios</a> that balances and throttles Dynatrace API requests across tenants, clusters and cluster nodes.</p> <h3>Usage</h3> <p>Using <a href="BalancedAPIRequest.html"><code>BalancedAPIRequest</code></a>:</p> <pre class="prettyprint source lang-javascript"><code>const api = new BalancedAPIRequest(limits, tenants); const cancellablePromise = api.fetch(options).then(data => { ... }).catch(err => { ... }); // OR const cancellableEventEmitter = api.fetch(options, (err, data) => { ... }); </code></pre> <p>Using <a href="DirectAPIRequest.html"><code>DirectAPIRequest</code></a>:</p> <pre class="prettyprint source lang-javascript"><code>const api = new DirectAPIRequest(limits); const promise = api.fetch(options).then(data => { ... }).catch(err => { ... }); // OR const eventEmitter = api.fetch(options, (err, data) => { ... }); </code></pre> <p>For convenience aliases have been provided for the following request methods:</p> <ul> <li><code>get(url, options[, onDone])</code></li> <li><code>delete(url, options[, onDone])</code></li> <li><code>post(url, data, options[, onDone])</code></li> <li><code>put(url, data, options[, onDone])</code></li> </ul> <h3>Features</h3> <p>The <a href="DirectAPIRequest.html"><code>DirectAPIRequest</code></a> wrapper responds to and recovers from 429 and 503 errors gracefully (up till specified limits). It also automatically consolidates paged responses (from both v1 and v2 APIs). Finally, it unifies the various types of errors that may happen while initializating a request, issuing it, and processing its response. This greatly simplifies writing code that makes Dynatrace API requests.</p> <p>The <a href="BalancedAPIRequest.html"><code>BalancedAPIRequest</code></a> adds an efficient load balancing, queuing and request throttling layer that protects the Dynatrace cluster from a request overload while ensuring that for each request the best (i.e. most available) cluster node is selected to handle that request. Additionally, it natively supports cancelling any request (or all) if the caller is no longer interested in the response.</p> <p>Note that the interfaces of <a href="BalancedAPIRequest.html"><code>BalancedAPIRequest</code></a> and <a href="DirectAPIRequest.html"><code>DirectAPIRequest</code></a> are virtually identical.</p> <p>The <a href="BalancedAPIRequest.html"><code>BalancedAPIRequest</code></a> is a cornerstone of several Dynatrace ESA solutions, most notably the ETL Service and the API Security Gateway. Additionally, <a href="DirectAPIRequest.html"><code>DirectAPIRequest</code></a> is used by the Dynatrace API Helper, a solution that greatly simplifies the process of writing code to access Dynatrace APIs. Please contact <strong>esa@dynatrace.com</strong> for more information.</p></article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BalancedAPIRequest.html">BalancedAPIRequest</a></li><li><a href="CancellableEventEmitter.html">CancellableEventEmitter</a></li><li><a href="CancellablePromise.html">CancellablePromise</a></li><li><a href="DirectAPIRequest.html">DirectAPIRequest</a></li><li><a href="Throttle.html">Throttle</a></li></ul><h3><a href="global.html">Global</a></h3> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Sun Dec 19 2021 10:28:39 GMT-0600 (Central Standard Time) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>