-
Stackdriver Authentication
+
Google Cloud Monitoring Authentication
- There are two ways to authenticate the Stackdriver plugin - either by uploading a Service Account key file, or by
+ There are two ways to authenticate the Google Cloud Monitoring plugin - either by uploading a Service Account key file, or by
automatically retrieving credentials from the Google metadata server. The latter option is only available when
running Grafana on a GCE virtual machine.
@@ -29,12 +29,12 @@
If Grafana is running on a Google Compute Engine (GCE) virtual machine, it is possible for Grafana to
automatically retrieve the default project id and authentication token from the metadata server. In order for this
to work, you need to make sure that you have a service account that is setup as the default account for the
- virtual machine and that the service account has been given read access to the Stackdriver Monitoring API.
+ virtual machine and that the service account has been given read access to the Google Cloud Monitoring Monitoring API.
Detailed instructions on how to create a Service Account can be found
- in the documentation.
diff --git a/public/app/plugins/datasource/stackdriver/plugin.json b/public/app/plugins/datasource/cloud-monitoring/plugin.json
similarity index 82%
rename from public/app/plugins/datasource/stackdriver/plugin.json
rename to public/app/plugins/datasource/cloud-monitoring/plugin.json
index 369bf8678e9..70ec883173c 100644
--- a/public/app/plugins/datasource/stackdriver/plugin.json
+++ b/public/app/plugins/datasource/cloud-monitoring/plugin.json
@@ -1,5 +1,5 @@
{
- "name": "Stackdriver",
+ "name": "Google Cloud Monitoring",
"type": "datasource",
"id": "stackdriver",
"category": "cloud",
@@ -13,11 +13,11 @@
},
"info": {
- "description": "Data source for Google's monitoring service",
+ "description": "Data source for Google's monitoring service (formerly named Stackdriver)",
"version": "1.0.0",
"logos": {
- "small": "img/stackdriver_logo.svg",
- "large": "img/stackdriver_logo.svg"
+ "small": "img/cloud_monitoring_logo.svg",
+ "large": "img/cloud_monitoring_logo.svg"
},
"author": {
"name": "Grafana Labs",
@@ -26,7 +26,7 @@
},
"routes": [
{
- "path": "stackdriver",
+ "path": "cloudmonitoring",
"method": "GET",
"url": "https://content-monitoring.googleapis.com",
"jwtTokenAuth": {
diff --git a/public/app/plugins/datasource/stackdriver/specs/datasource.test.ts b/public/app/plugins/datasource/cloud-monitoring/specs/datasource.test.ts
similarity index 83%
rename from public/app/plugins/datasource/stackdriver/specs/datasource.test.ts
rename to public/app/plugins/datasource/cloud-monitoring/specs/datasource.test.ts
index 712c04bb56a..cffdf71aa10 100644
--- a/public/app/plugins/datasource/stackdriver/specs/datasource.test.ts
+++ b/public/app/plugins/datasource/cloud-monitoring/specs/datasource.test.ts
@@ -1,8 +1,8 @@
-import StackdriverDataSource from '../datasource';
+import CloudMonitoringDataSource from '../datasource';
import { metricDescriptors } from './testData';
import { TemplateSrv } from 'app/features/templating/template_srv';
import { DataSourceInstanceSettings, toUtc } from '@grafana/data';
-import { StackdriverOptions } from '../types';
+import { CloudMonitoringOptions } from '../types';
import { backendSrv } from 'app/core/services/backend_srv'; // will use the version in __mocks__
import { TimeSrv } from 'app/features/dashboard/services/TimeSrv';
import { CustomVariableModel } from '../../../../features/variables/types';
@@ -18,12 +18,12 @@ interface Result {
message?: any;
}
-describe('StackdriverDataSource', () => {
+describe('CloudMonitoringDataSource', () => {
const instanceSettings = ({
jsonData: {
defaultProject: 'testproject',
},
- } as unknown) as DataSourceInstanceSettings
;
+ } as unknown) as DataSourceInstanceSettings;
const templateSrv = new TemplateSrv();
const timeSrv = {} as TimeSrv;
const datasourceRequestMock = jest.spyOn(backendSrv, 'datasourceRequest');
@@ -34,12 +34,12 @@ describe('StackdriverDataSource', () => {
});
describe('when performing testDataSource', () => {
- describe('and call to stackdriver api succeeds', () => {
+ describe('and call to cloud monitoring api succeeds', () => {
let ds;
let result: Result;
beforeEach(async () => {
datasourceRequestMock.mockImplementation(() => Promise.resolve({ status: 200 }));
- ds = new StackdriverDataSource(instanceSettings, templateSrv, timeSrv);
+ ds = new CloudMonitoringDataSource(instanceSettings, templateSrv, timeSrv);
result = await ds.testDatasource();
});
@@ -54,7 +54,7 @@ describe('StackdriverDataSource', () => {
beforeEach(async () => {
datasourceRequestMock.mockImplementation(() => Promise.resolve({ status: 200, data: metricDescriptors }));
- ds = new StackdriverDataSource(instanceSettings, templateSrv, timeSrv);
+ ds = new CloudMonitoringDataSource(instanceSettings, templateSrv, timeSrv);
result = await ds.testDatasource();
});
@@ -63,7 +63,7 @@ describe('StackdriverDataSource', () => {
});
});
- describe('and call to stackdriver api fails with 400 error', () => {
+ describe('and call to cloud monitoring api fails with 400 error', () => {
let ds;
let result: Result;
beforeEach(async () => {
@@ -76,13 +76,15 @@ describe('StackdriverDataSource', () => {
})
);
- ds = new StackdriverDataSource(instanceSettings, templateSrv, timeSrv);
+ ds = new CloudMonitoringDataSource(instanceSettings, templateSrv, timeSrv);
result = await ds.testDatasource();
});
it('should return error status and a detailed error message', () => {
expect(result.status).toEqual('error');
- expect(result.message).toBe('Stackdriver: Bad Request: 400. Field interval.endTime had an invalid value');
+ expect(result.message).toBe(
+ 'Google Cloud Monitoring: Bad Request: 400. Field interval.endTime had an invalid value'
+ );
});
});
});
@@ -105,7 +107,7 @@ describe('StackdriverDataSource', () => {
};
describe('and no time series data is returned', () => {
- let ds: StackdriverDataSource;
+ let ds: CloudMonitoringDataSource;
const response: any = {
results: {
A: {
@@ -121,7 +123,7 @@ describe('StackdriverDataSource', () => {
beforeEach(() => {
datasourceRequestMock.mockImplementation(() => Promise.resolve({ status: 200, data: response }));
- ds = new StackdriverDataSource(instanceSettings, templateSrv, timeSrv);
+ ds = new CloudMonitoringDataSource(instanceSettings, templateSrv, timeSrv);
});
it('should return a list of datapoints', () => {
@@ -133,7 +135,7 @@ describe('StackdriverDataSource', () => {
});
describe('when performing getMetricTypes', () => {
- describe('and call to stackdriver api succeeds', () => {});
+ describe('and call to cloud monitoring api succeeds', () => {});
let ds;
let result: any;
beforeEach(async () => {
@@ -154,7 +156,7 @@ describe('StackdriverDataSource', () => {
})
);
- ds = new StackdriverDataSource(instanceSettings, templateSrv, timeSrv);
+ ds = new CloudMonitoringDataSource(instanceSettings, templateSrv, timeSrv);
// @ts-ignore
result = await ds.getMetricTypes('proj');
});
@@ -176,7 +178,7 @@ describe('StackdriverDataSource', () => {
describe('and is single value variable', () => {
beforeEach(() => {
const filterTemplateSrv = initTemplateSrv('filtervalue1');
- const ds = new StackdriverDataSource(instanceSettings, filterTemplateSrv, timeSrv);
+ const ds = new CloudMonitoringDataSource(instanceSettings, filterTemplateSrv, timeSrv);
interpolated = ds.interpolateFilters(['resource.label.zone', '=~', '${test}'], {});
});
@@ -189,7 +191,7 @@ describe('StackdriverDataSource', () => {
describe('and is single value variable for the label part', () => {
beforeEach(() => {
const filterTemplateSrv = initTemplateSrv('resource.label.zone');
- const ds = new StackdriverDataSource(instanceSettings, filterTemplateSrv, timeSrv);
+ const ds = new CloudMonitoringDataSource(instanceSettings, filterTemplateSrv, timeSrv);
interpolated = ds.interpolateFilters(['${test}', '=~', 'europe-north-1a'], {});
});
@@ -202,7 +204,7 @@ describe('StackdriverDataSource', () => {
describe('and is multi value variable', () => {
beforeEach(() => {
const filterTemplateSrv = initTemplateSrv(['filtervalue1', 'filtervalue2'], true);
- const ds = new StackdriverDataSource(instanceSettings, filterTemplateSrv, timeSrv);
+ const ds = new CloudMonitoringDataSource(instanceSettings, filterTemplateSrv, timeSrv);
interpolated = ds.interpolateFilters(['resource.label.zone', '=~', '[[test]]'], {});
});
@@ -218,7 +220,7 @@ describe('StackdriverDataSource', () => {
describe('and is single value variable', () => {
beforeEach(() => {
const groupByTemplateSrv = initTemplateSrv('groupby1');
- const ds = new StackdriverDataSource(instanceSettings, groupByTemplateSrv, timeSrv);
+ const ds = new CloudMonitoringDataSource(instanceSettings, groupByTemplateSrv, timeSrv);
interpolated = ds.interpolateGroupBys(['[[test]]'], {});
});
@@ -231,7 +233,7 @@ describe('StackdriverDataSource', () => {
describe('and is multi value variable', () => {
beforeEach(() => {
const groupByTemplateSrv = initTemplateSrv(['groupby1', 'groupby2'], true);
- const ds = new StackdriverDataSource(instanceSettings, groupByTemplateSrv, timeSrv);
+ const ds = new CloudMonitoringDataSource(instanceSettings, groupByTemplateSrv, timeSrv);
interpolated = ds.interpolateGroupBys(['[[test]]'], {});
});
@@ -244,12 +246,12 @@ describe('StackdriverDataSource', () => {
});
describe('unit parsing', () => {
- let ds: StackdriverDataSource, res: any;
+ let ds: CloudMonitoringDataSource, res: any;
beforeEach(() => {
- ds = new StackdriverDataSource(instanceSettings, templateSrv, timeSrv);
+ ds = new CloudMonitoringDataSource(instanceSettings, templateSrv, timeSrv);
});
describe('when theres only one target', () => {
- describe('and the stackdriver unit doesnt have a corresponding grafana unit', () => {
+ describe('and the cloud monitoring unit doesnt have a corresponding grafana unit', () => {
beforeEach(() => {
res = ds.resolvePanelUnitFromTargets([{ unit: 'megaseconds' }]);
});
@@ -257,7 +259,7 @@ describe('StackdriverDataSource', () => {
expect(res).toBeUndefined();
});
});
- describe('and the stackdriver unit has a corresponding grafana unit', () => {
+ describe('and the cloud monitoring unit has a corresponding grafana unit', () => {
beforeEach(() => {
res = ds.resolvePanelUnitFromTargets([{ unit: 'bit' }]);
});
diff --git a/public/app/plugins/datasource/stackdriver/specs/testData.ts b/public/app/plugins/datasource/cloud-monitoring/specs/testData.ts
similarity index 100%
rename from public/app/plugins/datasource/stackdriver/specs/testData.ts
rename to public/app/plugins/datasource/cloud-monitoring/specs/testData.ts
diff --git a/public/app/plugins/datasource/stackdriver/types.ts b/public/app/plugins/datasource/cloud-monitoring/types.ts
similarity index 95%
rename from public/app/plugins/datasource/stackdriver/types.ts
rename to public/app/plugins/datasource/cloud-monitoring/types.ts
index 7671d1767ed..738de280b2e 100644
--- a/public/app/plugins/datasource/stackdriver/types.ts
+++ b/public/app/plugins/datasource/cloud-monitoring/types.ts
@@ -78,14 +78,14 @@ export interface SLOQuery {
goal?: number;
}
-export interface StackdriverQuery extends DataQuery {
+export interface CloudMonitoringQuery extends DataQuery {
datasourceId?: number; // Should not be necessary anymore
queryType: QueryType;
metricQuery: MetricQuery;
sloQuery?: SLOQuery;
}
-export interface StackdriverOptions extends DataSourceJsonData {
+export interface CloudMonitoringOptions extends DataSourceJsonData {
defaultProject?: string;
gceDefaultProject?: string;
authenticationType?: string;
diff --git a/public/app/plugins/datasource/stackdriver/README.md b/public/app/plugins/datasource/stackdriver/README.md
deleted file mode 100644
index b92c637cf59..00000000000
--- a/public/app/plugins/datasource/stackdriver/README.md
+++ /dev/null
@@ -1,7 +0,0 @@
-# Stackdriver Data Source - Native Plugin
-
-Grafana ships with built-in support for Google Stackdriver. You just have to add it as a data source and you will be ready to build dashboards for your Stackdriver metrics.
-
-Read more about it here:
-
-[http://docs.grafana.org/datasources/stackdriver/](http://docs.grafana.org/datasources/stackdriver/)
diff --git a/public/app/plugins/datasource/stackdriver/module.ts b/public/app/plugins/datasource/stackdriver/module.ts
deleted file mode 100644
index eccc0bd4800..00000000000
--- a/public/app/plugins/datasource/stackdriver/module.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { DataSourcePlugin } from '@grafana/data';
-import StackdriverDatasource from './datasource';
-import { QueryEditor } from './components/QueryEditor';
-import { StackdriverConfigCtrl } from './config_ctrl';
-import { StackdriverAnnotationsQueryCtrl } from './annotations_query_ctrl';
-import { StackdriverVariableQueryEditor } from './components/VariableQueryEditor';
-import { StackdriverQuery } from './types';
-
-export const plugin = new DataSourcePlugin(StackdriverDatasource)
- .setQueryEditor(QueryEditor)
- .setConfigCtrl(StackdriverConfigCtrl)
- .setAnnotationQueryCtrl(StackdriverAnnotationsQueryCtrl)
- .setVariableQueryEditor(StackdriverVariableQueryEditor);