From bdea686a15b2ec2fff457bfcd03acba3ac60a432 Mon Sep 17 00:00:00 2001 From: Daniel Betancur Date: Thu, 13 Oct 2022 09:19:06 +0200 Subject: [PATCH] Adding dist for tags --- .gitignore | 1 - dist/README.md | 30 + dist/config/config.d.ts | 14 + dist/config/config.html | 24 + dist/config/config.js | 52 ++ dist/config/config.js.map | 1 + dist/config/config.ts | 53 ++ dist/datasource/config_ctrl.d.ts | 12 + dist/datasource/config_ctrl.js | 40 ++ dist/datasource/config_ctrl.js.map | 1 + dist/datasource/config_ctrl.ts | 35 + dist/datasource/datasource.d.ts | 23 + dist/datasource/datasource.js | 193 ++++++ dist/datasource/datasource.js.map | 1 + dist/datasource/datasource.ts | 193 ++++++ dist/datasource/img/new_relic_logo.png | Bin 0 -> 9542 bytes dist/datasource/module.d.ts | 7 + dist/datasource/module.js | 29 + dist/datasource/module.js.map | 1 + dist/datasource/module.ts | 14 + dist/datasource/partials/config.html | 16 + dist/datasource/partials/query.editor.html | 53 ++ dist/datasource/partials/query.options.html | 13 + dist/datasource/plugin.json | 23 + dist/datasource/query_ctrl.d.ts | 20 + dist/datasource/query_ctrl.js | 104 +++ dist/datasource/query_ctrl.js.map | 1 + dist/datasource/query_ctrl.ts | 96 +++ dist/img/new_relic_logo.png | Bin 0 -> 9542 bytes dist/module.d.ts | 2 + dist/module.js | 13 + dist/module.js.map | 1 + dist/module.ts | 5 + dist/plugin.json | 31 + dist/typings/es6-shim/es6-shim.d.ts | 668 ++++++++++++++++++++ dist/typings/tsd.d.ts | 21 + 36 files changed, 1790 insertions(+), 1 deletion(-) create mode 100644 dist/README.md create mode 100644 dist/config/config.d.ts create mode 100644 dist/config/config.html create mode 100644 dist/config/config.js create mode 100644 dist/config/config.js.map create mode 100644 dist/config/config.ts create mode 100644 dist/datasource/config_ctrl.d.ts create mode 100644 dist/datasource/config_ctrl.js create mode 100644 dist/datasource/config_ctrl.js.map create mode 100644 dist/datasource/config_ctrl.ts create mode 100644 dist/datasource/datasource.d.ts create mode 100644 dist/datasource/datasource.js create mode 100644 dist/datasource/datasource.js.map create mode 100644 dist/datasource/datasource.ts create mode 100644 dist/datasource/img/new_relic_logo.png create mode 100644 dist/datasource/module.d.ts create mode 100644 dist/datasource/module.js create mode 100644 dist/datasource/module.js.map create mode 100644 dist/datasource/module.ts create mode 100644 dist/datasource/partials/config.html create mode 100644 dist/datasource/partials/query.editor.html create mode 100644 dist/datasource/partials/query.options.html create mode 100644 dist/datasource/plugin.json create mode 100644 dist/datasource/query_ctrl.d.ts create mode 100644 dist/datasource/query_ctrl.js create mode 100644 dist/datasource/query_ctrl.js.map create mode 100644 dist/datasource/query_ctrl.ts create mode 100644 dist/img/new_relic_logo.png create mode 100644 dist/module.d.ts create mode 100644 dist/module.js create mode 100644 dist/module.js.map create mode 100644 dist/module.ts create mode 100644 dist/plugin.json create mode 100644 dist/typings/es6-shim/es6-shim.d.ts create mode 100644 dist/typings/tsd.d.ts diff --git a/.gitignore b/.gitignore index 9fccba7..75f5fcb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ node_modules package-lock.json -dist grafana-plugins \ No newline at end of file diff --git a/dist/README.md b/dist/README.md new file mode 100644 index 0000000..10ff27a --- /dev/null +++ b/dist/README.md @@ -0,0 +1,30 @@ +# New Relic APM Datasource - Custom Plugin +This is a simple datasource for use with the New Relic APM API. + +## Major Update Notice +This datasource plugin has been converted to a full app plugin to allow for more secure handling of +new relic API keys. If you have previously used the old datasource plugin version, you will need to +configure this application with your api key, and then create a new datasource. + +## Supported Version Information +This datasource has been tested with 4.2 stable. + +## To install and use + +1. Add the contents of this repository to your grafana plugins directory (default /var/lib/grafana/plugins) and then restart the grafana server. + +2. Create a new app and configure it with your API key + +2. Create a new datasource and select NewRelic from the drop down. + +3. Create a new panel and set the datasource to NewRelic. Metrics take a namespace and optional value configuration. The namespaces must be exact match of the metric name, which can be found for your application [here](https://rpm.newrelic.com/api/explore/applications/metric_names) + +This datasource supports aliases and altering the group by interval. +![Alias](http://i.imgur.com/sV0bEoA.png) + +If you leave the value field blank, you will get a separate group for each value of the metric. You can access the value as $value in the alias. + +## Build +npm install +npm install -g grunt-cli +grunt diff --git a/dist/config/config.d.ts b/dist/config/config.d.ts new file mode 100644 index 0000000..8613186 --- /dev/null +++ b/dist/config/config.d.ts @@ -0,0 +1,14 @@ +/// +export declare class NewRelicAppConfigCtrl { + private backendSrv; + appModel: any; + appEditCtrl: any; + jsonData: any; + apiValidated: boolean; + apiError: boolean; + constructor($scope: any, $injector: any, backendSrv: any); + preUpdate(): Promise; + reset(): void; + validateApiConnection(): any; + static templateUrl: string; +} diff --git a/dist/config/config.html b/dist/config/config.html new file mode 100644 index 0000000..6b039ac --- /dev/null +++ b/dist/config/config.html @@ -0,0 +1,24 @@ +

New Relic API Credentials

+ +
+
+
+ + + The API key generated for authorization in the APM dashboard. + + + + +
+
+ +
+ +
+
+
+ reset +
+
+
\ No newline at end of file diff --git a/dist/config/config.js b/dist/config/config.js new file mode 100644 index 0000000..fd90d68 --- /dev/null +++ b/dist/config/config.js @@ -0,0 +1,52 @@ +/// +System.register([], function(exports_1) { + var NewRelicAppConfigCtrl; + return { + setters:[], + execute: function() { + NewRelicAppConfigCtrl = (function () { + function NewRelicAppConfigCtrl($scope, $injector, backendSrv) { + this.backendSrv = backendSrv; + this.backendSrv = backendSrv; + console.log(this); + this.appEditCtrl.setPreUpdateHook(this.preUpdate.bind(this)); + if (!this.appModel.jsonData) { + this.appModel.jsonData = {}; + } + if (!this.appModel.secureJsonData) { + this.appModel.secureJsonData = {}; + } + if (this.appModel.enabled && this.appModel.jsonData.tokenSet) { + this.validateApiConnection(); + } + } + NewRelicAppConfigCtrl.prototype.preUpdate = function () { + if (this.appModel.secureJsonData.apiKey) { + this.appModel.jsonData.tokenSet = true; + } + return Promise.resolve(); + }; + NewRelicAppConfigCtrl.prototype.reset = function () { + this.appModel.jsonData.tokenSet = false; + this.appModel.secureJsonData = {}; + this.apiValidated = false; + }; + NewRelicAppConfigCtrl.prototype.validateApiConnection = function () { + var _this = this; + var promise = this.backendSrv.get('/api/plugin-proxy/newrelic-app/v2/applications.json'); + promise.then(function () { + _this.apiValidated = true; + }, function () { + _this.apiValidated = false; + _this.apiError = true; + }); + return promise; + }; + NewRelicAppConfigCtrl.templateUrl = 'config/config.html'; + return NewRelicAppConfigCtrl; + })(); + exports_1("NewRelicAppConfigCtrl", NewRelicAppConfigCtrl); + } + } +}); +//# sourceMappingURL=config.js.map \ No newline at end of file diff --git a/dist/config/config.js.map b/dist/config/config.js.map new file mode 100644 index 0000000..edd40a6 --- /dev/null +++ b/dist/config/config.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config.js","sourceRoot":"","sources":["config.ts"],"names":["NewRelicAppConfigCtrl","NewRelicAppConfigCtrl.constructor","NewRelicAppConfigCtrl.preUpdate","NewRelicAppConfigCtrl.reset","NewRelicAppConfigCtrl.validateApiConnection"],"mappings":"AAAA,2CAA2C;;;;;;YAE3C;gBAOEA,+BAAYA,MAAMA,EAAEA,SAASA,EAAUA,UAAUA;oBAAVC,eAAUA,GAAVA,UAAUA,CAAAA;oBAC/CA,IAAIA,CAACA,UAAUA,GAAGA,UAAUA,CAACA;oBAC7BA,OAAOA,CAACA,GAAGA,CAACA,IAAIA,CAACA,CAACA;oBAElBA,IAAIA,CAACA,WAAWA,CAACA,gBAAgBA,CAACA,IAAIA,CAACA,SAASA,CAACA,IAAIA,CAACA,IAAIA,CAACA,CAACA,CAACA;oBAE7DA,EAAEA,CAACA,CAACA,CAACA,IAAIA,CAACA,QAAQA,CAACA,QAAQA,CAACA,CAACA,CAACA;wBAC5BA,IAAIA,CAACA,QAAQA,CAACA,QAAQA,GAAGA,EAAEA,CAACA;oBAC9BA,CAACA;oBACDA,EAAEA,CAACA,CAACA,CAACA,IAAIA,CAACA,QAAQA,CAACA,cAAcA,CAACA,CAACA,CAACA;wBAClCA,IAAIA,CAACA,QAAQA,CAACA,cAAcA,GAAGA,EAAEA,CAACA;oBACpCA,CAACA;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end of file diff --git a/dist/config/config.ts b/dist/config/config.ts new file mode 100644 index 0000000..b0909ff --- /dev/null +++ b/dist/config/config.ts @@ -0,0 +1,53 @@ +/// + +export class NewRelicAppConfigCtrl { + appModel: any; + appEditCtrl: any; + jsonData: any; + apiValidated: boolean; + apiError: boolean; + + constructor($scope, $injector, private backendSrv) { + this.backendSrv = backendSrv; + console.log(this); + + this.appEditCtrl.setPreUpdateHook(this.preUpdate.bind(this)); + + if (!this.appModel.jsonData) { + this.appModel.jsonData = {}; + } + if (!this.appModel.secureJsonData) { + this.appModel.secureJsonData = {}; + } + + if (this.appModel.enabled && this.appModel.jsonData.tokenSet) { + this.validateApiConnection(); + } + } + + preUpdate() { + if (this.appModel.secureJsonData.apiKey) { + this.appModel.jsonData.tokenSet = true; + } + return Promise.resolve(); + } + + reset() { + this.appModel.jsonData.tokenSet = false; + this.appModel.secureJsonData = {}; + this.apiValidated = false; + } + + validateApiConnection() { + var promise = this.backendSrv.get('/api/plugin-proxy/newrelic-app/v2/applications.json'); + promise.then(() => { + this.apiValidated = true; + }, () => { + this.apiValidated = false; + this.apiError = true; + }); + return promise; + } + + static templateUrl = 'config/config.html'; +} diff --git a/dist/datasource/config_ctrl.d.ts b/dist/datasource/config_ctrl.d.ts new file mode 100644 index 0000000..2713420 --- /dev/null +++ b/dist/datasource/config_ctrl.d.ts @@ -0,0 +1,12 @@ +/// +export declare class NewRelicDSConfigCtrl { + private backendSrv; + static templateUrl: string; + name: string; + current: any; + types: any; + apps: any[]; + constructor($scope: any, $injector: any, backendSrv: any); + getApplications(): any; + loadApplications(): void; +} diff --git a/dist/datasource/config_ctrl.js b/dist/datasource/config_ctrl.js new file mode 100644 index 0000000..4ec9b97 --- /dev/null +++ b/dist/datasource/config_ctrl.js @@ -0,0 +1,40 @@ +/// +System.register([], function(exports_1) { + var NewRelicDSConfigCtrl; + return { + setters:[], + execute: function() { + NewRelicDSConfigCtrl = (function () { + function NewRelicDSConfigCtrl($scope, $injector, backendSrv) { + this.backendSrv = backendSrv; + this.backendSrv = backendSrv; + this.loadApplications(); + } + NewRelicDSConfigCtrl.prototype.getApplications = function () { + var promise = this.backendSrv.get('api/plugin-proxy/newrelic-app/v2/applications.json'); + return promise.then(function (result) { + if (result && result.applications) { + return result.applications; + } + else { + return []; + } + }); + }; + NewRelicDSConfigCtrl.prototype.loadApplications = function () { + var _this = this; + this.getApplications().then(function (apps) { + apps = apps.map(function (app) { + return { name: app.name, id: app.id.toString() }; + }); + _this.apps = apps; + }); + }; + NewRelicDSConfigCtrl.templateUrl = 'datasource/partials/config.html'; + return NewRelicDSConfigCtrl; + })(); + exports_1("NewRelicDSConfigCtrl", NewRelicDSConfigCtrl); + } + } +}); +//# sourceMappingURL=config_ctrl.js.map \ No newline at end of file diff --git a/dist/datasource/config_ctrl.js.map b/dist/datasource/config_ctrl.js.map new file mode 100644 index 0000000..07f403e --- /dev/null +++ b/dist/datasource/config_ctrl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config_ctrl.js","sourceRoot":"","sources":["config_ctrl.ts"],"names":["NewRelicDSConfigCtrl","NewRelicDSConfigCtrl.constructor","NewRelicDSConfigCtrl.getApplications","NewRelicDSConfigCtrl.loadApplications"],"mappings":"AAAA,2CAA2C;;;;;;YAE3C;gBAOEA,8BAAYA,MAAMA,EAAEA,SAASA,EAAUA,UAAUA;oBAAVC,eAAUA,GAAVA,UAAUA,CAAAA;oBAC/CA,IAAIA,CAACA,UAAUA,GAAGA,UAAUA,CAACA;oBAC7BA,IAAIA,CAACA,gBAAgBA,EAAEA,CAACA;gBAC1BA,CAACA;gBAEDD,8CAAeA,GAAfA;oBACEE,IAAIA,OAAOA,GAAGA,IAAIA,CAACA,UAAUA,CAACA,GAAGA,CAACA,oDAAoDA,CAACA,CAACA;oBACxFA,MAAMA,CAACA,OAAOA,CAACA,IAAIA,CAACA,UAAAA,MAAMA;wBACxBA,EAAEA,CAACA,CAACA,MAAMA,IAAIA,MAAMA,CAACA,YAAYA,CAACA,CAACA,CAACA;4BAClCA,MAAMA,CAACA,MAAMA,CAACA,YAAYA,CAACA;wBAC7BA,CAACA;wBAACA,IAAIA,CAACA,CAACA;4BACNA,MAAMA,CAACA,EAAEA,CAACA;wBACZA,CAACA;oBACHA,CAACA,CAACA,CAACA;gBACLA,CAACA;gBAEDF,+CAAgBA,GAAhBA;oBAAAG,iBAOCA;oBANCA,IAAIA,CAACA,eAAeA,EAAEA,CAACA,IAAIA,CAACA,UAAAA,IAAIA;wBAC9BA,IAAIA,GAAGA,IAAIA,CAACA,GAAGA,CAACA,UAAAA,GAAGA;4BACjBA,MAAMA,CAACA,EAAEA,IAAIA,EAAEA,GAAGA,CAACA,IAAIA,EAAEA,EAAEA,EAAEA,GAAGA,CAACA,EAAEA,CAACA,QAAQA,EAAEA,EAAEA,CAACA;wBACnDA,CAACA,CAACA,CAACA;wBACHA,KAAIA,CAACA,IAAIA,GAAGA,IAAIA,CAACA;oBACnBA,CAACA,CAACA,CAACA;gBACLA,CAACA;gBA7BMH,gCAAWA,GAAGA,iCAAiCA,CAACA;gBA+BzDA,2BAACA;YAADA,CAACA,AAhCD,IAgCC;YAhCD,uDAgCC,CAAA"} \ No newline at end of file diff --git a/dist/datasource/config_ctrl.ts b/dist/datasource/config_ctrl.ts new file mode 100644 index 0000000..1c3ce23 --- /dev/null +++ b/dist/datasource/config_ctrl.ts @@ -0,0 +1,35 @@ +/// + +export class NewRelicDSConfigCtrl { + static templateUrl = 'datasource/partials/config.html'; + name: string; + current: any; + types: any; + apps: any[]; + + constructor($scope, $injector, private backendSrv) { + this.backendSrv = backendSrv; + this.loadApplications(); + } + + getApplications() { + var promise = this.backendSrv.get('api/plugin-proxy/newrelic-app/v2/applications.json'); + return promise.then(result => { + if (result && result.applications) { + return result.applications; + } else { + return []; + } + }); + } + + loadApplications() { + this.getApplications().then(apps => { + apps = apps.map(app => { + return { name: app.name, id: app.id.toString() }; + }); + this.apps = apps; + }); + } + +} diff --git a/dist/datasource/datasource.d.ts b/dist/datasource/datasource.d.ts new file mode 100644 index 0000000..47c5a58 --- /dev/null +++ b/dist/datasource/datasource.d.ts @@ -0,0 +1,23 @@ +/// +declare class NewRelicDatasource { + private $q; + private backendSrv; + private templateSrv; + name: string; + appId: any; + baseApiUrl: string; + /** @ngInject */ + constructor(instanceSettings: any, $q: any, backendSrv: any, templateSrv: any); + query(options: any): Promise<{}>; + testDatasource(): any; + _convertToSeconds(interval: any): number; + _parseMetricResults(results: any): any[]; + _parseseacrhTarget(metric: any): any[]; + _getTargetSeries(target: any, metric: any): any[]; + _parseTargetAlias(metric: any, value: any): any; + makeMultipleRequests(requests: any): Promise<{}>; + getMetricNames(application_id: any): any; + getApplications(value?: number, extResult?: any[]): any; + makeApiRequest(request: any): any; +} +export { NewRelicDatasource }; diff --git a/dist/datasource/datasource.js b/dist/datasource/datasource.js new file mode 100644 index 0000000..cffe601 --- /dev/null +++ b/dist/datasource/datasource.js @@ -0,0 +1,193 @@ +System.register(['moment'], function(exports_1) { + var moment_1; + var NewRelicDatasource; + return { + setters:[ + function (moment_1_1) { + moment_1 = moment_1_1; + }], + execute: function() { + NewRelicDatasource = (function () { + /** @ngInject */ + function NewRelicDatasource(instanceSettings, $q, backendSrv, templateSrv) { + this.$q = $q; + this.backendSrv = backendSrv; + this.templateSrv = templateSrv; + this.name = instanceSettings.name; + this.appId = instanceSettings.jsonData.app_id; + this.baseApiUrl = 'api/plugin-proxy/newrelic-app'; + this.backendSrv = backendSrv; + } + NewRelicDatasource.prototype.query = function (options) { + var _this = this; + var requests = []; + options.targets.forEach(function (target) { + var value = target.value || null; + var type = target.type || 'applications'; + /* Todo: clean up defaulting app_id based on datasource config */ + var app_id = target.app_id || _this.appId; + var id = type === 'applications' ? app_id : target.server_id; + var request = { + refId: target.refId, + alias: target.alias, + url: '/v2/' + type + '/' + id + '/metrics/data.json', + params: { + names: [target.target], + to: options.range.to, + from: options.range.from, + period: _this._convertToSeconds(options.interval || "60s") + } + }; + if (value) { + request.params["values"] = [value]; + } + if (id) { + requests.push(request); + } + }); + return this.makeMultipleRequests(requests); + }; + NewRelicDatasource.prototype.testDatasource = function () { + var url = '/v2/applications/' + this.appId + '.json'; + return this.makeApiRequest({ url: url }).then(function () { + return { status: "success", message: "Data source is working", title: "Success" }; + }); + }; + NewRelicDatasource.prototype._convertToSeconds = function (interval) { + var seconds = parseInt(interval); + var unit = interval.slice(-1).toLowerCase(); + switch (unit) { + case "s": + break; + case "m": + seconds = seconds * 60; + break; + case "h": + seconds = seconds * 3600; + break; + case "d": + seconds = seconds * 86400; + break; + } + return seconds; + }; + NewRelicDatasource.prototype._parseMetricResults = function (results) { + var _this = this; + var targetList = []; + var metrics = results.response.metric_data.metrics; + metrics.forEach(function (metric) { + metric.alias = results.alias; + targetList = targetList.concat(_this._parseseacrhTarget(metric)); + }); + return targetList; + }; + NewRelicDatasource.prototype._parseseacrhTarget = function (metric) { + var _this = this; + var targets = Object.keys(metric.timeslices[0].values); + var targetData = []; + targets.forEach(function (target) { + targetData.push({ + target: _this._parseTargetAlias(metric, target), + datapoints: _this._getTargetSeries(target, metric) + }); + }); + return targetData; + }; + NewRelicDatasource.prototype._getTargetSeries = function (target, metric) { + var series = []; + metric.timeslices.forEach(function (slice) { + series.push([slice.values[target], moment_1.default(slice.to).valueOf()]); + }); + return series; + }; + NewRelicDatasource.prototype._parseTargetAlias = function (metric, value) { + if (metric.alias) { + return metric.alias.replace(/\$value/g, value); + } + else { + return metric.name + ":" + value; + } + }; + NewRelicDatasource.prototype.makeMultipleRequests = function (requests) { + var _this = this; + return new Promise(function (resolve, reject) { + var mergedResults = { + data: [] + }; + var promises = []; + requests.forEach(function (request) { + promises.push(_this.makeApiRequest(request)); + }); + return Promise.all(promises).then(function (data) { + data.forEach(function (result) { + mergedResults.data = mergedResults.data.concat(_this._parseMetricResults(result)); + }); + resolve(mergedResults); + }); + }); + }; + NewRelicDatasource.prototype.getMetricNames = function (application_id) { + if (!application_id) { + application_id = this.appId; + } + var request = { + url: '/v2/applications/' + application_id + '/metrics.json' + }; + return this.makeApiRequest(request) + .then(function (result) { + if (result && result.response && result.response.metrics) { + return result.response.metrics; + } + else { + return []; + } + }); + }; + NewRelicDatasource.prototype.getApplications = function (value, extResult) { + var _this = this; + if (value === void 0) { value = 1; } + if (extResult === void 0) { extResult = []; } + var request = { + url: '/v2/applications.json?page=' + value + }; + return this.makeApiRequest(request) + .then(function (result) { + if (result && result.response && result.response.applications && result.response.applications.length > 0) { + return _this.getApplications(value + 1, result.response.applications).then(function (resultInt) { + return extResult.concat(resultInt); + }); + } + else { + return extResult; + } + }); + }; + NewRelicDatasource.prototype.makeApiRequest = function (request) { + var options = { + method: "get", + url: this.baseApiUrl + request.url, + params: request.params, + data: request.data, + }; + return this.backendSrv.datasourceRequest(options) + .then(function (result) { + return { response: result.data, refId: request.refId, alias: request.alias }; + }) + .catch(function (err) { + if (err.status !== 0 || err.status >= 300) { + if (err.data && err.data.error) { + throw { message: 'New Relic Error Response: ' + err.data.error.title, data: err.data, config: err.config }; + } + else { + throw { message: 'New Relic Error: ' + err.message, data: err.data, config: err.config }; + } + } + }); + }; + return NewRelicDatasource; + })(); + exports_1("NewRelicDatasource", NewRelicDatasource); + } + } +}); +//# sourceMappingURL=datasource.js.map \ No newline at end of file diff --git a/dist/datasource/datasource.js.map b/dist/datasource/datasource.js.map new file mode 100644 index 0000000..46eebe1 --- /dev/null +++ b/dist/datasource/datasource.js.map @@ -0,0 +1 @@ +{"version":3,"file":"datasource.js","sourceRoot":"","sources":["datasource.ts"],"names":["NewRelicDatasource","NewRelicDatasource.constructor","NewRelicDatasource.query","NewRelicDatasource.testDatasource","NewRelicDatasource._convertToSeconds","NewRelicDatasource._parseMetricResults","NewRelicDatasource._parseseacrhTarget","NewRelicDatasource._getTargetSeries","NewRelicDatasource._parseTargetAlias","NewRelicDatasource.makeMultipleRequests","NewRelicDatasource.getMetricNames","NewRelicDatasource.getApplications","NewRelicDatasource.makeApiRequest"],"mappings":";;;;;;;;;YAGA;gBAKEA,gB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UAAAA,MAAMA;wBACVA,MAAMA,CAACA,EAACA,QAAQA,EAAEA,MAAMA,CAACA,IAAIA,EAAEA,KAAKA,EAAEA,OAAOA,CAACA,KAAKA,EAAEA,KAAKA,EAAEA,OAAOA,CAACA,KAAKA,EAAEA,CAACA;oBAC9EA,CAACA,CAACA;yBACDA,KAAKA,CAACA,UAAAA,GAAGA;wBACRA,EAAEA,CAACA,CAACA,GAAGA,CAACA,MAAMA,KAAKA,CAACA,IAAIA,GAAGA,CAACA,MAAMA,IAAIA,GAAGA,CAACA,CAACA,CAACA;4BAC1CA,EAAEA,CAACA,CAACA,GAAGA,CAACA,IAAIA,IAAIA,GAAGA,CAACA,IAAIA,CAACA,KAAKA,CAACA,CAACA,CAACA;gCAC/BA,MAAMA,EAAEA,OAAOA,EAAEA,4BAA4BA,GAAGA,GAAGA,CAACA,IAAIA,CAACA,KAAKA,CAACA,KAAKA,EAAEA,IAAIA,EAAEA,GAAGA,CAACA,IAAIA,EAAEA,MAAMA,EAAEA,GAAGA,CAACA,MAAMA,EAAEA,CAACA;4BAC7GA,CAACA;4BAACA,IAAIA,CAACA,CAACA;gCACNA,MAAMA,EAAEA,OAAOA,EAAEA,mBAAmBA,GAAGA,GAAGA,CAACA,OAAOA,EAAEA,IAAIA,EAAEA,GAAGA,CAACA,IAAIA,EAAEA,MAAMA,EAAEA,GAAGA,CAACA,MAAMA,EAAEA,CAACA;4BAC3FA,CAACA;wBACHA,CAACA;oBACHA,CAACA,CAACA,CAACA;gBACLA,CAACA;gBAEHZ,yBAACA;YAADA,CAACA,AA3LD,IA2LC;YAEO,mDAAkB"} \ No newline at end of file diff --git a/dist/datasource/datasource.ts b/dist/datasource/datasource.ts new file mode 100644 index 0000000..085964d --- /dev/null +++ b/dist/datasource/datasource.ts @@ -0,0 +1,193 @@ +/// +import moment from 'moment'; + +class NewRelicDatasource { + name: string; + appId: any; + baseApiUrl: string; + + /** @ngInject */ + constructor(instanceSettings, private $q, private backendSrv, private templateSrv) { + this.name = instanceSettings.name; + this.appId = instanceSettings.jsonData.app_id; + this.baseApiUrl = 'api/plugin-proxy/newrelic-app'; + this.backendSrv = backendSrv; + } + + query(options) { + var requests = []; + + options.targets.forEach(target => { + var value = target.value || null; + var type = target.type || 'applications'; + /* Todo: clean up defaulting app_id based on datasource config */ + var app_id = target.app_id || this.appId; + var id = type === 'applications' ? app_id : target.server_id; + var request = { + refId: target.refId, + alias: target.alias, + url: '/v2/' + type + '/' + id + '/metrics/data.json', + params: { + names: [target.target], + to: options.range.to, + from: options.range.from, + period: this._convertToSeconds(options.interval || "60s") + } + }; + if (value) { + request.params["values"] = [value]; + } + if (id) { + requests.push(request); + } + }); + return this.makeMultipleRequests(requests); + } + + testDatasource() { + var url = '/v2/applications/' + this.appId + '.json'; + + return this.makeApiRequest({url: url}).then(() => { + return { status: "success", message: "Data source is working", title: "Success" }; + }); + } + + _convertToSeconds(interval) { + var seconds: number = parseInt(interval); + var unit: string = interval.slice(-1).toLowerCase(); + switch (unit) { + case "s": + break; + case "m": + seconds = seconds * 60; + break; + case "h": + seconds = seconds * 3600; + break; + case "d": + seconds = seconds * 86400; + break; + } + return seconds; + } + + _parseMetricResults(results) { + var targetList = []; + var metrics = results.response.metric_data.metrics; + metrics.forEach(metric => { + metric.alias = results.alias; + targetList = targetList.concat(this._parseseacrhTarget(metric)); + }); + return targetList; + } + + _parseseacrhTarget(metric) { + var targets = Object.keys(metric.timeslices[0].values); + var targetData = []; + targets.forEach(target => { + targetData.push({ + target: this._parseTargetAlias(metric, target), + datapoints: this._getTargetSeries(target, metric) + }); + }); + return targetData; + } + + _getTargetSeries(target, metric) { + var series = []; + metric.timeslices.forEach(function(slice){ + series.push([slice.values[target], moment(slice.to).valueOf()]); + }); + return series; + } + + _parseTargetAlias(metric, value) { + if (metric.alias) { + return metric.alias.replace(/\$value/g, value); + } else { + return metric.name + ":" + value; + } + } + + makeMultipleRequests(requests) { + return new Promise((resolve, reject) => { + var mergedResults = { + data: [] + }; + var promises = []; + requests.forEach(request => { + promises.push(this.makeApiRequest(request)); + }); + + return Promise.all(promises).then(data => { + data.forEach(result => { + mergedResults.data = mergedResults.data.concat(this._parseMetricResults(result)); + }); + resolve(mergedResults); + }); + }); + } + + getMetricNames(application_id) { + if (!application_id) { + application_id = this.appId; + } + + let request = { + url: '/v2/applications/' + application_id + '/metrics.json' + }; + + return this.makeApiRequest(request) + .then(result => { + if (result && result.response && result.response.metrics) { + return result.response.metrics; + } else { + return []; + } + }); + } + + getApplications(value = 1, extResult = []) { + let request = { + url: '/v2/applications.json?page='+value + }; + + return this.makeApiRequest(request) + .then(result => { + if (result && result.response && result.response.applications && result.response.applications.length > 0) { + return this.getApplications(value+1, result.response.applications).then(resultInt => { + return extResult.concat(resultInt); + } + ) + } else { + return extResult; + } + }); + } + + makeApiRequest(request) { + var options: any = { + method: "get", + url: this.baseApiUrl + request.url, + params: request.params, + data: request.data, + }; + + return this.backendSrv.datasourceRequest(options) + .then(result => { + return {response: result.data, refId: request.refId, alias: request.alias }; + }) + .catch(err => { + if (err.status !== 0 || err.status >= 300) { + if (err.data && err.data.error) { + throw { message: 'New Relic Error Response: ' + err.data.error.title, data: err.data, config: err.config }; + } else { + throw { message: 'New Relic Error: ' + err.message, data: err.data, config: err.config }; + } + } + }); + } + +} + +export {NewRelicDatasource}; diff --git a/dist/datasource/img/new_relic_logo.png b/dist/datasource/img/new_relic_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..9ae03c1193f30d2ab3ad39a3640cddb125bde1ff GIT binary patch literal 9542 zcmZ{K1ymf%x-|~LA`sjmI1KL2;O-Dy28V&c9fAdScemid-9m7;;1Jwl2p)cN?tSl` zch>!9O?6j&wRi1rf8Euq*P01aR+Pd(B|wFNfx(cG2CBZC?Oz)98>E+`0A!Z*<%D1% zsvrsjQyYW!XpHzWe&ryo;{*ePhV`ex!lY;7y z7xc?A?tCv@JCL(6nY*2>y%V3iAjMw@zL)-=Fo1&WFNm{^AceMqGMP9S0wUvN=3r)_ z5JD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ts new file mode 100644 index 0000000..53e5fc4 --- /dev/null +++ b/dist/datasource/module.d.ts @@ -0,0 +1,7 @@ +import { NewRelicDSConfigCtrl } from './config_ctrl'; +import { NewRelicDatasource } from './datasource'; +import { NewRelicQueryCtrl } from './query_ctrl'; +declare class NewRelicQueryOptionsCtrl { + static templateUrl: string; +} +export { NewRelicDatasource as Datasource, NewRelicQueryCtrl as QueryCtrl, NewRelicQueryOptionsCtrl as QueryOptionsCtrl, NewRelicDSConfigCtrl as ConfigCtrl }; diff --git a/dist/datasource/module.js b/dist/datasource/module.js new file mode 100644 index 0000000..dc5d548 --- /dev/null +++ b/dist/datasource/module.js @@ -0,0 +1,29 @@ +System.register(['./config_ctrl', './datasource', './query_ctrl'], function(exports_1) { + var config_ctrl_1, datasource_1, query_ctrl_1; + var NewRelicQueryOptionsCtrl; + return { + setters:[ + function (config_ctrl_1_1) { + config_ctrl_1 = config_ctrl_1_1; + }, + function (datasource_1_1) { + datasource_1 = datasource_1_1; + }, + function (query_ctrl_1_1) { + query_ctrl_1 = query_ctrl_1_1; + }], + execute: function() { + NewRelicQueryOptionsCtrl = (function () { + function NewRelicQueryOptionsCtrl() { + } + NewRelicQueryOptionsCtrl.templateUrl = 'datasource/partials/query.options.html'; + return NewRelicQueryOptionsCtrl; + })(); + exports_1("Datasource", datasource_1.NewRelicDatasource); + exports_1("QueryCtrl", query_ctrl_1.NewRelicQueryCtrl); + exports_1("QueryOptionsCtrl", NewRelicQueryOptionsCtrl); + exports_1("ConfigCtrl", config_ctrl_1.NewRelicDSConfigCtrl); + } + } +}); +//# sourceMappingURL=module.js.map \ No newline at end of file diff --git a/dist/datasource/module.js.map b/dist/datasource/module.js.map new file mode 100644 index 0000000..36084f4 --- /dev/null +++ b/dist/datasource/module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"module.js","sourceRoot":"","sources":["module.ts"],"names":["NewRelicQueryOptionsCtrl","NewRelicQueryOptionsCtrl.constructor"],"mappings":";;;;;;;;;;;;;;;YAIA;gBAAAA;gBAEAC,CAACA;gBADQD,oCAAWA,GAAGA,wCAAwCA,CAACA;gBAChEA,+BAACA;YAADA,CAACA,AAFD,IAEC;YAGuB,wDAAU;YACX,sDAAS;YACF,uDAAgB;YACpB,2DAAU"} \ No newline at end of file diff --git a/dist/datasource/module.ts b/dist/datasource/module.ts new file mode 100644 index 0000000..dc3b15e --- /dev/null +++ b/dist/datasource/module.ts @@ -0,0 +1,14 @@ +import {NewRelicDSConfigCtrl} from './config_ctrl'; +import {NewRelicDatasource} from './datasource'; +import {NewRelicQueryCtrl} from './query_ctrl'; + +class NewRelicQueryOptionsCtrl { + static templateUrl = 'datasource/partials/query.options.html'; +} + +export { + NewRelicDatasource as Datasource, + NewRelicQueryCtrl as QueryCtrl, + NewRelicQueryOptionsCtrl as QueryOptionsCtrl, + NewRelicDSConfigCtrl as ConfigCtrl +}; diff --git a/dist/datasource/partials/config.html b/dist/datasource/partials/config.html new file mode 100644 index 0000000..692bcae --- /dev/null +++ b/dist/datasource/partials/config.html @@ -0,0 +1,16 @@ +

NewRelic API Credentials

+ +
+
+ + +
+
diff --git a/dist/datasource/partials/query.editor.html b/dist/datasource/partials/query.editor.html new file mode 100644 index 0000000..9e17459 --- /dev/null +++ b/dist/datasource/partials/query.editor.html @@ -0,0 +1,53 @@ + +
+
+ + + + + + + +
+
+ +
+
+ +
+ + + +
+ +
+ + + +
+
+
+
+ +
+
+ + +
+
+
diff --git a/dist/datasource/partials/query.options.html b/dist/datasource/partials/query.options.html new file mode 100644 index 0000000..0ad3949 --- /dev/null +++ b/dist/datasource/partials/query.options.html @@ -0,0 +1,13 @@ +
+
+
+
+ + Group by time interval + + +
+
+
+
diff --git a/dist/datasource/plugin.json b/dist/datasource/plugin.json new file mode 100644 index 0000000..d814348 --- /dev/null +++ b/dist/datasource/plugin.json @@ -0,0 +1,23 @@ +{ + "name": "NewRelic Data Source", + "type": "datasource", + "id": "newrelic-ds", + + "metrics": true, + "annotations": false, + + "info": { + "author": { + "name": "Paul", + "url": "https://callrail.com" + }, + "logos": { + "small": "img/new_relic_logo.png", + "large": "img/new_relic_logo.png" + }, + "dependencies": { + "grafanaVersion": "^3.0.1", + "plugins": [ ] + } + } +} diff --git a/dist/datasource/query_ctrl.d.ts b/dist/datasource/query_ctrl.d.ts new file mode 100644 index 0000000..636eef9 --- /dev/null +++ b/dist/datasource/query_ctrl.d.ts @@ -0,0 +1,20 @@ +/// +import { QueryCtrl } from 'app/plugins/sdk'; +declare class NewRelicQueryCtrl extends QueryCtrl { + static templateUrl: string; + refresh: any; + metric_types: any; + datasource: any; + type: any; + metrics: any[]; + apps: any[]; + /** @ngInject **/ + constructor($scope: any, $injector: any); + getMetrics(): any; + getMetricNamespaces(): any; + getMetricValues(): any; + getApplications(): any; + reset(): void; + onChangeInternal(): void; +} +export { NewRelicQueryCtrl }; diff --git a/dist/datasource/query_ctrl.js b/dist/datasource/query_ctrl.js new file mode 100644 index 0000000..e58be8c --- /dev/null +++ b/dist/datasource/query_ctrl.js @@ -0,0 +1,104 @@ +System.register(['app/plugins/sdk', 'lodash'], function(exports_1) { + var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + var sdk_1, lodash_1; + var NewRelicQueryCtrl; + return { + setters:[ + function (sdk_1_1) { + sdk_1 = sdk_1_1; + }, + function (lodash_1_1) { + lodash_1 = lodash_1_1; + }], + execute: function() { + NewRelicQueryCtrl = (function (_super) { + __extends(NewRelicQueryCtrl, _super); + /** @ngInject **/ + function NewRelicQueryCtrl($scope, $injector) { + _super.call(this, $scope, $injector); + this.metric_types = [ + { value: 'applications', label: 'Application' }, + { value: 'servers', label: 'Server' } + ]; + var target_defaults = { + type: 'applications', + app_id: null, + target: 'Select namespace', + value: 'Select metric' + }; + lodash_1.default.defaultsDeep(this.target, target_defaults); + this.getMetrics(); + this.getApplications(); + } + ; + NewRelicQueryCtrl.prototype.getMetrics = function () { + var _this = this; + if (this.metrics) { + return Promise.resolve(this.metrics); + } + else { + return this.datasource.getMetricNames(this.target.app_id) + .then(function (metrics) { + _this.metrics = metrics; + return metrics; + }); + } + }; + NewRelicQueryCtrl.prototype.getMetricNamespaces = function () { + return this.getMetrics().then(function (metrics) { + return lodash_1.default.map(metrics, function (metric) { + return { text: metric.name, value: metric.name }; + }); + }); + }; + NewRelicQueryCtrl.prototype.getMetricValues = function () { + var name = this.target.target; + return this.getMetrics().then(function (metrics) { + var ns = lodash_1.default.find(metrics, { name: name }); + if (ns) { + return lodash_1.default.map(ns.values, function (val) { + return { text: val, value: val }; + }); + } + else { + return []; + } + }); + }; + NewRelicQueryCtrl.prototype.getApplications = function () { + var _this = this; + if (this.apps) { + return Promise.resolve(this.apps); + } + else { + return this.datasource.getApplications() + .then(function (apps) { + apps = lodash_1.default.map(apps, function (app) { + return { name: app.name, id: app.id }; + }); + apps.push({ name: 'Default', id: null }); + _this.apps = apps; + return apps; + }); + } + }; + NewRelicQueryCtrl.prototype.reset = function () { + this.metrics = null; + this.getMetrics(); + this.refresh(); + }; + NewRelicQueryCtrl.prototype.onChangeInternal = function () { + this.refresh(); + }; + NewRelicQueryCtrl.templateUrl = 'datasource/partials/query.editor.html'; + return NewRelicQueryCtrl; + })(sdk_1.QueryCtrl); + exports_1("NewRelicQueryCtrl", NewRelicQueryCtrl); + } + } +}); +//# sourceMappingURL=query_ctrl.js.map \ No newline at end of file diff --git a/dist/datasource/query_ctrl.js.map b/dist/datasource/query_ctrl.js.map new file mode 100644 index 0000000..2973ae8 --- /dev/null +++ b/dist/datasource/query_ctrl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"query_ctrl.js","sourceRoot":"","sources":["query_ctrl.ts"],"names":["NewRelicQueryCtrl","NewRelicQueryCtrl.constructor","NewRelicQueryCtrl.getMetrics","NewRelicQueryCtrl.getMetricNamespaces","NewRelicQueryCtrl.getMetricValues","NewRelicQueryCtrl.getApplications","NewRelicQueryCtrl.reset","NewRelicQueryCtrl.onChangeInternal"],"mappings":";;;;;;;;;;;;;;;;;YAIA;gBAAgCA,qCAASA;gBASvCA,iBAAiBA;gBACjBA,2BAAYA,MAAMA,EAAEA,SAASA;oBAC3BC,kBAAMA,MAAMA,EAAEA,SAASA,CAACA,CAACA;oBACzBA,IAAIA,CAACA,YAAYA,GAAGA;wBAClBA,EAAEA,KAAKA,EAAEA,cAAcA,EAAEA,KAAKA,EAAEA,aAAaA,EAAEA;wBAC/CA,EAAEA,KAAKA,EAAEA,SAASA,EAAEA,KAAKA,EAAEA,QAAQA,EAACA;qBACrCA,CAACA;oBAEFA,IAAIA,eAAeA,GAAGA;wBACpBA,IAAIA,EAAEA,cAAcA;wBACpBA,MAAMA,EAAEA,IAAIA;wBACZA,MAAMA,EAAEA,kBAAkBA;wBAC1BA,KAAKA,EAAEA,eAAeA;qBACvBA,CAAAA;oBACDA,gBAACA,CAACA,YAAYA,CAACA,IAAIA,CAACA,MAAMA,EAAEA,eAAeA,CAACA,CAACA;oBAE7CA,IAAIA,CAACA,UAAUA,EAAEA,CAACA;oBAClBA,IAAIA,CAACA,eAAeA,EAAEA,CAACA;gBACzBA,CAACA;;gBAEDD,sCAAUA,GAAVA;oBAAAE,iBAUCA;oBATCA,EAAEA,CAACA,CAACA,IAAIA,CAACA,OAAOA,CAACA,CAACA,CAACA;wBACjBA,MAAMA,CAACA,OAAOA,CAACA,OAAOA,CAACA,IAAIA,CAACA,OAAOA,CAACA,CAACA;oBACvCA,CAACA;oBAACA,IAAIA,CAACA,CAACA;wBACNA,MAAMA,CAACA,IAAIA,CAACA,UAAUA,CAACA,cAAcA,CAACA,IAAIA,CAACA,MAAMA,CAACA,MAAMA,CAACA;6BACxDA,IAAIA,CAACA,UAAAA,OAAOA;4BACXA,KAAIA,CAACA,OAAOA,GAAGA,OAAOA,CAACA;4BACvBA,MAAMA,CAACA,OAAOA,CAACA;wBACjBA,CAACA,CAACA,CAACA;oBACLA,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CAACA,IAAIA,CAACA,CAACA;oBACpCA,CAACA;oBAACA,IAAIA,CAACA,CAACA;wBACNA,MAAMA,CAACA,IAAIA,CAACA,UAAUA,CAACA,eAAeA,EAAEA;6BACvCA,IAAIA,CAACA,UAAAA,IAAIA;4BACRA,IAAIA,GAAGA,gBAACA,CAACA,GAAGA,CAACA,IAAIA,EAAEA,UAAAA,GAAGA;gCACpBA,MAAMA,CAACA,EAAEA,IAAIA,EAAEA,GAAGA,CAACA,IAAIA,EAAEA,EAAEA,EAAEA,GAAGA,CAACA,EAAEA,EAAEA,CAACA;4BACxCA,CAACA,CAACA,CAACA;4BACHA,IAAIA,CAACA,IAAIA,CAACA,EAAEA,IAAIA,EAAEA,SAASA,EAAEA,EAAEA,EAAEA,IAAIA,EAAEA,CAACA,CAACA;4BACzCA,KAAIA,CAACA,IAAIA,GAAGA,IAAIA,CAACA;4BAEjBA,MAAMA,CAACA,IAAIA,CAACA;wBACdA,CAACA,CAACA,CAACA;oBACLA,CAACA;gBACHA,CAACA;gBAEDL,iCAAKA,GAALA;oBACEM,IAAIA,CAACA,OAAOA,GAAGA,IAAIA,CAACA;oBACpBA,IAAIA,CAACA,UAAUA,EAAEA,CAACA;oBAClBA,IAAIA,CAACA,OAAOA,EAAEA,CAACA;gBACjBA,CAACA;gBAEDN,4CAAgBA,GAAhBA;oBACEO,IAAIA,CAACA,OAAOA,EAAEA,CAACA;gBACjBA,CAACA;gBAvFMP,6BAAWA,GAAGA,uCAAuCA,CAACA;gBAwF/DA,wBAACA;YAADA,CAACA,AAzFD,EAAgC,eAAS,EAyFxC;YAEO,iDAAiB"} \ No newline at end of file diff --git a/dist/datasource/query_ctrl.ts b/dist/datasource/query_ctrl.ts new file mode 100644 index 0000000..572dd5f --- /dev/null +++ b/dist/datasource/query_ctrl.ts @@ -0,0 +1,96 @@ +/// +import {QueryCtrl} from 'app/plugins/sdk'; +import _ from 'lodash'; + +class NewRelicQueryCtrl extends QueryCtrl { + static templateUrl = 'datasource/partials/query.editor.html'; + refresh: any; + metric_types: any; + datasource: any; + type: any; + metrics: any[]; + apps: any[]; + + /** @ngInject **/ + constructor($scope, $injector) { + super($scope, $injector); + this.metric_types = [ + { value: 'applications', label: 'Application' }, + { value: 'servers', label: 'Server'} + ]; + + let target_defaults = { + type: 'applications', + app_id: null, + target: 'Select namespace', + value: 'Select metric' + } + _.defaultsDeep(this.target, target_defaults); + + this.getMetrics(); + this.getApplications(); + }; + + getMetrics() { + if (this.metrics) { + return Promise.resolve(this.metrics); + } else { + return this.datasource.getMetricNames(this.target.app_id) + .then(metrics => { + this.metrics = metrics; + return metrics; + }); + } + } + + getMetricNamespaces() { + return this.getMetrics().then(metrics => { + return _.map(metrics, metric => { + return { text: metric.name, value: metric.name }; + }); + }); + } + + getMetricValues() { + let name = this.target.target; + return this.getMetrics().then(metrics => { + let ns = _.find(metrics, {name: name}); + if (ns) { + return _.map(ns.values, val => { + return { text: val, value: val }; + }); + } else { + return []; + } + }); + } + + getApplications() { + if (this.apps) { + return Promise.resolve(this.apps); + } else { + return this.datasource.getApplications() + .then(apps => { + apps = _.map(apps, app => { + return { name: app.name, id: app.id }; + }); + apps.push({ name: 'Default', id: null }); + this.apps = apps; + + return apps; + }); + } + } + + reset() { + this.metrics = null; + this.getMetrics(); + this.refresh(); + } + + onChangeInternal() { + this.refresh(); + } +} + +export {NewRelicQueryCtrl}; diff --git a/dist/img/new_relic_logo.png b/dist/img/new_relic_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..9ae03c1193f30d2ab3ad39a3640cddb125bde1ff GIT binary patch literal 9542 zcmZ{K1ymf%x-|~LA`sjmI1KL2;O-Dy28V&c9fAdScemid-9m7;;1Jwl2p)cN?tSl` zch>!9O?6j&wRi1rf8Euq*P01aR+Pd(B|wFNfx(cG2CBZC?Oz)98>E+`0A!Z*<%D1% zsvrsjQyYW!XpHzWe&ryo;{*ePhV`ex!lY;7y z7xc?A?tCv@JCL(6nY*2>y%V3iAjMw@zL)-=Fo1&WFNm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dist/module.d.ts b/dist/module.d.ts new file mode 100644 index 0000000..b01fe34 --- /dev/null +++ b/dist/module.d.ts @@ -0,0 +1,2 @@ +import { NewRelicAppConfigCtrl } from './config/config'; +export { NewRelicAppConfigCtrl as ConfigCtrl }; diff --git a/dist/module.js b/dist/module.js new file mode 100644 index 0000000..141ac24 --- /dev/null +++ b/dist/module.js @@ -0,0 +1,13 @@ +System.register(['./config/config'], function(exports_1) { + var config_1; + return { + setters:[ + function (config_1_1) { + config_1 = config_1_1; + }], + execute: function() { + exports_1("ConfigCtrl", config_1.NewRelicAppConfigCtrl); + } + } +}); +//# sourceMappingURL=module.js.map \ No newline at end of file diff --git a/dist/module.js.map b/dist/module.js.map new file mode 100644 index 0000000..5bd4b11 --- /dev/null +++ b/dist/module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"module.js","sourceRoot":"","sources":["module.ts"],"names":[],"mappings":";;;;;;;;YAG2B,uDAAU"} \ No newline at end of file diff --git a/dist/module.ts b/dist/module.ts new file mode 100644 index 0000000..ca1f0b5 --- /dev/null +++ b/dist/module.ts @@ -0,0 +1,5 @@ +import {NewRelicAppConfigCtrl} from './config/config'; + +export { + NewRelicAppConfigCtrl as ConfigCtrl +}; diff --git a/dist/plugin.json b/dist/plugin.json new file mode 100644 index 0000000..49e7167 --- /dev/null +++ b/dist/plugin.json @@ -0,0 +1,31 @@ +{ + "name": "NewRelic App", + "type": "app", + "id": "newrelic-app", + + "routes": [ + { + "path": "v2/*", + "method": "*", + "url": "https://api.newrelic.com/v2", + "headers": [ + {"name": "X-Api-Key", "content": "{{.SecureJsonData.apiKey}}"} + ] + } + ], + + "info": { + "author": { + "name": "Paul", + "url": "https://callrail.com" + }, + "logos": { + "small": "img/new_relic_logo.png", + "large": "img/new_relic_logo.png" + }, + "dependencies": { + "grafanaVersion": "^3.0.1", + "plugins": [ ] + } + } +} diff --git a/dist/typings/es6-shim/es6-shim.d.ts b/dist/typings/es6-shim/es6-shim.d.ts new file mode 100644 index 0000000..1c3df0e --- /dev/null +++ b/dist/typings/es6-shim/es6-shim.d.ts @@ -0,0 +1,668 @@ +// Type definitions for es6-shim v0.31.2 +// Project: https://github.com/paulmillr/es6-shim +// Definitions by: Ron Buckton +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare type PropertyKey = string | number | symbol; + +interface IteratorResult { + done: boolean; + value?: T; +} + +interface IterableShim { + /** + * Shim for an ES6 iterable. Not intended for direct use by user code. + */ + "_es6-shim iterator_"(): Iterator; +} + +interface Iterator { + next(value?: any): IteratorResult; + return?(value?: any): IteratorResult; + throw?(e?: any): IteratorResult; +} + +interface IterableIteratorShim extends IterableShim, Iterator { + /** + * Shim for an ES6 iterable iterator. Not intended for direct use by user code. + */ + "_es6-shim iterator_"(): IterableIteratorShim; +} + +interface StringConstructor { + /** + * Return the String value whose elements are, in order, the elements in the List elements. + * If length is 0, the empty string is returned. + */ + fromCodePoint(...codePoints: number[]): string; + + /** + * String.raw is intended for use as a tag function of a Tagged Template String. When called + * as such the first argument will be a well formed template call site object and the rest + * parameter will contain the substitution values. + * @param template A well-formed template string call site representation. + * @param substitutions A set of substitution values. + */ + raw(template: TemplateStringsArray, ...substitutions: any[]): string; +} + +interface String { + /** + * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point + * value of the UTF-16 encoded code point starting at the string element at position pos in + * the String resulting from converting this object to a String. + * If there is no element at that position, the result is undefined. + * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. + */ + codePointAt(pos: number): number; + + /** + * Returns true if searchString appears as a substring of the result of converting this + * object to a String, at one or more positions that are + * greater than or equal to position; otherwise, returns false. + * @param searchString search string + * @param position If position is undefined, 0 is assumed, so as to search all of the String. + */ + includes(searchString: string, position?: number): boolean; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * endPosition – length(this). Otherwise returns false. + */ + endsWith(searchString: string, endPosition?: number): boolean; + + /** + * Returns a String value that is made from count copies appended together. If count is 0, + * T is the empty String is returned. + * @param count number of copies to append + */ + repeat(count: number): string; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * position. Otherwise returns false. + */ + startsWith(searchString: string, position?: number): boolean; + + /** + * Returns an HTML anchor element and sets the name attribute to the text value + * @param name + */ + anchor(name: string): string; + + /** Returns a HTML element */ + big(): string; + + /** Returns a HTML element */ + blink(): string; + + /** Returns a HTML element */ + bold(): string; + + /** Returns a HTML element */ + fixed(): string + + /** Returns a HTML element and sets the color attribute value */ + fontcolor(color: string): string + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: number): string; + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: string): string; + + /** Returns an HTML element */ + italics(): string; + + /** Returns an HTML element and sets the href attribute value */ + link(url: string): string; + + /** Returns a HTML element */ + small(): string; + + /** Returns a HTML element */ + strike(): string; + + /** Returns a HTML element */ + sub(): string; + + /** Returns a HTML element */ + sup(): string; + + /** + * Shim for an ES6 iterable. Not intended for direct use by user code. + */ + "_es6-shim iterator_"(): IterableIteratorShim; +} + +interface ArrayConstructor { + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(iterable: IterableShim, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + */ + from(arrayLike: ArrayLike): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + */ + from(iterable: IterableShim): Array; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: T[]): Array; +} + +interface Array { + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: T) => boolean, thisArg?: any): number; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: T, start?: number, end?: number): T[]; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): T[]; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIteratorShim<[number, T]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIteratorShim; + + /** + * Returns an list of values in the array + */ + values(): IterableIteratorShim; + + /** + * Shim for an ES6 iterable. Not intended for direct use by user code. + */ + "_es6-shim iterator_"(): IterableIteratorShim; +} + +interface NumberConstructor { + /** + * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 + * that is representable as a Number value, which is approximately: + * 2.2204460492503130808472633361816 x 10‍−‍16. + */ + EPSILON: number; + + /** + * Returns true if passed value is finite. + * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a + * number. Only finite values of the type number, result in true. + * @param number A numeric value. + */ + isFinite(number: number): boolean; + + /** + * Returns true if the value passed is an integer, false otherwise. + * @param number A numeric value. + */ + isInteger(number: number): boolean; + + /** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a + * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter + * to a number. Only values of the type number, that are also NaN, result in true. + * @param number A numeric value. + */ + isNaN(number: number): boolean; + + /** + * Returns true if the value passed is a safe integer. + * @param number A numeric value. + */ + isSafeInteger(number: number): boolean; + + /** + * The value of the largest integer n such that n and n + 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. + */ + MAX_SAFE_INTEGER: number; + + /** + * The value of the smallest integer n such that n and n − 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). + */ + MIN_SAFE_INTEGER: number; + + /** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ + parseFloat(string: string): number; + + /** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ + parseInt(string: string, radix?: number): number; +} + +interface ObjectConstructor { + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects to copy properties from. + */ + assign(target: any, ...sources: any[]): any; + + /** + * Returns true if the values are the same value, false otherwise. + * @param value1 The first value. + * @param value2 The second value. + */ + is(value1: any, value2: any): boolean; + + /** + * Sets the prototype of a specified object o to object proto or null. Returns the object o. + * @param o The object to change its prototype. + * @param proto The value of the new prototype or null. + * @remarks Requires `__proto__` support. + */ + setPrototypeOf(o: any, proto: any): any; +} + +interface RegExp { + /** + * Returns a string indicating the flags of the regular expression in question. This field is read-only. + * The characters in this string are sequenced and concatenated in the following order: + * + * - "g" for global + * - "i" for ignoreCase + * - "m" for multiline + * - "u" for unicode + * - "y" for sticky + * + * If no flags are set, the value is the empty string. + */ + flags: string; +} + +interface Math { + /** + * Returns the number of leading zero bits in the 32-bit binary representation of a number. + * @param x A numeric expression. + */ + clz32(x: number): number; + + /** + * Returns the result of 32-bit multiplication of two numbers. + * @param x First number + * @param y Second number + */ + imul(x: number, y: number): number; + + /** + * Returns the sign of the x, indicating whether x is positive, negative or zero. + * @param x The numeric expression to test + */ + sign(x: number): number; + + /** + * Returns the base 10 logarithm of a number. + * @param x A numeric expression. + */ + log10(x: number): number; + + /** + * Returns the base 2 logarithm of a number. + * @param x A numeric expression. + */ + log2(x: number): number; + + /** + * Returns the natural logarithm of 1 + x. + * @param x A numeric expression. + */ + log1p(x: number): number; + + /** + * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of + * the natural logarithms). + * @param x A numeric expression. + */ + expm1(x: number): number; + + /** + * Returns the hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cosh(x: number): number; + + /** + * Returns the hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sinh(x: number): number; + + /** + * Returns the hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tanh(x: number): number; + + /** + * Returns the inverse hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + acosh(x: number): number; + + /** + * Returns the inverse hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + asinh(x: number): number; + + /** + * Returns the inverse hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + atanh(x: number): number; + + /** + * Returns the square root of the sum of squares of its arguments. + * @param values Values to compute the square root for. + * If no arguments are passed, the result is +0. + * If there is only one argument, the result is the absolute value. + * If any argument is +Infinity or -Infinity, the result is +Infinity. + * If any argument is NaN, the result is NaN. + * If all arguments are either +0 or −0, the result is +0. + */ + hypot(...values: number[]): number; + + /** + * Returns the integral part of the a numeric expression, x, removing any fractional digits. + * If x is already an integer, the result is x. + * @param x A numeric expression. + */ + trunc(x: number): number; + + /** + * Returns the nearest single precision float representation of a number. + * @param x A numeric expression. + */ + fround(x: number): number; + + /** + * Returns an implementation-dependent approximation to the cube root of number. + * @param x A numeric expression. + */ + cbrt(x: number): number; +} + +interface PromiseLike { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; +} + +/** + * Represents the completion of an asynchronous operation + */ +interface Promise { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; + + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: (reason: any) => T | PromiseLike): Promise; + catch(onrejected?: (reason: any) => void): Promise; +} + +interface PromiseConstructor { + /** + * A reference to the prototype. + */ + prototype: Promise; + + /** + * Creates a new Promise. + * @param executor A callback used to initialize the promise. This callback is passed two arguments: + * a resolve callback used resolve the promise with a value or the result of another promise, + * and a reject callback used to reject the promise with a provided reason or error. + */ + new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: IterableShim>): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: IterableShim>): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new resolved promise for the provided value. + * @param value A promise. + * @returns A promise whose internal state matches the provided promise. + */ + resolve(value: T | PromiseLike): Promise; + + /** + * Creates a new resolved promise . + * @returns A resolved promise. + */ + resolve(): Promise; +} + +declare var Promise: PromiseConstructor; + +interface Map { + clear(): void; + delete(key: K): boolean; + forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; + get(key: K): V; + has(key: K): boolean; + set(key: K, value?: V): Map; + size: number; + entries(): IterableIteratorShim<[K, V]>; + keys(): IterableIteratorShim; + values(): IterableIteratorShim; +} + +interface MapConstructor { + new (): Map; + new (iterable: IterableShim<[K, V]>): Map; + prototype: Map; +} + +declare var Map: MapConstructor; + +interface Set { + add(value: T): Set; + clear(): void; + delete(value: T): boolean; + forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; + has(value: T): boolean; + size: number; + entries(): IterableIteratorShim<[T, T]>; + keys(): IterableIteratorShim; + values(): IterableIteratorShim; +} + +interface SetConstructor { + new (): Set; + new (iterable: IterableShim): Set; + prototype: Set; +} + +declare var Set: SetConstructor; + +interface WeakMap { + delete(key: K): boolean; + get(key: K): V; + has(key: K): boolean; + set(key: K, value?: V): WeakMap; +} + +interface WeakMapConstructor { + new (): WeakMap; + new (iterable: IterableShim<[K, V]>): WeakMap; + prototype: WeakMap; +} + +declare var WeakMap: WeakMapConstructor; + +interface WeakSet { + add(value: T): WeakSet; + delete(value: T): boolean; + has(value: T): boolean; +} + +interface WeakSetConstructor { + new (): WeakSet; + new (iterable: IterableShim): WeakSet; + prototype: WeakSet; +} + +declare var WeakSet: WeakSetConstructor; + +declare namespace Reflect { + function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; + function construct(target: Function, argumentsList: ArrayLike): any; + function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + function deleteProperty(target: any, propertyKey: PropertyKey): boolean; + function enumerate(target: any): IterableIteratorShim; + function get(target: any, propertyKey: PropertyKey, receiver?: any): any; + function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; + function getPrototypeOf(target: any): any; + function has(target: any, propertyKey: PropertyKey): boolean; + function isExtensible(target: any): boolean; + function ownKeys(target: any): Array; + function preventExtensions(target: any): boolean; + function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; + function setPrototypeOf(target: any, proto: any): boolean; +} + +declare module "es6-shim" { + var String: StringConstructor; + var Array: ArrayConstructor; + var Number: NumberConstructor; + var Math: Math; + var Object: ObjectConstructor; + var Map: MapConstructor; + var Set: SetConstructor; + var WeakMap: WeakMapConstructor; + var WeakSet: WeakSetConstructor; + var Promise: PromiseConstructor; + namespace Reflect { + function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; + function construct(target: Function, argumentsList: ArrayLike): any; + function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + function deleteProperty(target: any, propertyKey: PropertyKey): boolean; + function enumerate(target: any): Iterator; + function get(target: any, propertyKey: PropertyKey, receiver?: any): any; + function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; + function getPrototypeOf(target: any): any; + function has(target: any, propertyKey: PropertyKey): boolean; + function isExtensible(target: any): boolean; + function ownKeys(target: any): Array; + function preventExtensions(target: any): boolean; + function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; + function setPrototypeOf(target: any, proto: any): boolean; + } +} diff --git a/dist/typings/tsd.d.ts b/dist/typings/tsd.d.ts new file mode 100644 index 0000000..2c3c8eb --- /dev/null +++ b/dist/typings/tsd.d.ts @@ -0,0 +1,21 @@ +/// +declare module 'moment' { + var moment: any; + export default moment; +} + +declare module 'app/plugins/sdk' { + class QueryCtrl { + target: any; + constructor($scope: any, $injector: any) + } + + export { + QueryCtrl, + }; +} + +declare module 'lodash' { + var lodash: any; + export default lodash; +}