Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stackdriver: Rename Stackdriver to Google Cloud Monitoring #25807

Merged
merged 19 commits into from
Jun 30, 2020
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ lerna.json @grafana/grafana-frontend-platform
/public/app/plugins/datasource/opentsdb @grafana/backend-platform
/public/app/plugins/datasource/postgres @grafana/backend-platform
/public/app/plugins/datasource/prometheus @grafana/observability-squad
/public/app/plugins/datasource/stackdriver @grafana/backend-platform
/public/app/plugins/datasource/cloud-monitoring @grafana/backend-platform
/public/app/plugins/datasource/zipkin @grafana/observability-squad
6 changes: 3 additions & 3 deletions docs/sources/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ aliases = ["/docs/grafana/v1.1", "/docs/grafana/latest/guides/reference/admin",
<img src="/img/docs/logos/icon_prometheus.svg" >
<h5>Prometheus</h5>
</a>
<a href="{{< relref "features/datasources/stackdriver.md" >}}" class="nav-cards__item nav-cards__item--ds">
<img src="/img/docs/logos/icon_stackdriver.svg">
<h5>Google Stackdriver</h5>
<a href="{{< relref "features/datasources/cloudmonitoring.md" >}}" class="nav-cards__item nav-cards__item--ds">
<img src="/img/docs/logos/icon_cloudmonitoring.svg">
<h5>Google Cloud Monitoring</h5>
</a>
<a href="{{< relref "features/datasources/cloudwatch.md" >}}" class="nav-cards__item nav-cards__item--ds">
<img src="/img/docs/logos/icon_cloudwatch.svg">
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/alerting/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The actual notifications are configured and shared between multiple alerts.

Alert rules are evaluated in the Grafana backend in a scheduler and query execution engine that is part
of core Grafana. Only some data sources are supported right now. They include `Graphite`, `Prometheus`, `InfluxDB`, `Elasticsearch`,
`Stackdriver`, `Cloudwatch`, `Azure Monitor`, `MySQL`, `PostgreSQL`, `MSSQL`, `OpenTSDB`, `Oracle`, and `Azure Data Explorer`.
`Google Cloud Monitoring`, `Cloudwatch`, `Azure Monitor`, `MySQL`, `PostgreSQL`, `MSSQL`, `OpenTSDB`, `Oracle`, and `Azure Data Explorer`.

## Metrics from the alert engine

Expand Down
2 changes: 1 addition & 1 deletion docs/sources/alerting/alerts-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The actual notifications are configured and shared between multiple alerts.

Alert rules are evaluated in the Grafana backend in a scheduler and query execution engine that is part
of core Grafana. Only some data sources are supported right now. They include `Graphite`, `Prometheus`, `InfluxDB`, `Elasticsearch`,
`Stackdriver`, `Cloudwatch`, `Azure Monitor`, `MySQL`, `PostgreSQL`, `MSSQL`, `OpenTSDB`, `Oracle`, and `Azure Data Explorer`.
`Google Cloud Monitoring`, `Cloudwatch`, `Azure Monitor`, `MySQL`, `PostgreSQL`, `MSSQL`, `OpenTSDB`, `Oracle`, and `Azure Data Explorer`.

## Metrics from the alert engine

Expand Down
2 changes: 1 addition & 1 deletion docs/sources/features/datasources/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The following data sources are officially supported:
* [AWS CloudWatch]({{< relref "cloudwatch.md" >}})
* [Azure Monitor]({{< relref "azuremonitor.md" >}})
* [Elasticsearch]({{< relref "elasticsearch.md" >}})
* [Google Stackdriver]({{< relref "stackdriver.md" >}})
* [Google Cloud Monitoring]({{< relref "cloudmonitoring.md" >}})
* [Graphite]({{< relref "graphite.md" >}})
* [InfluxDB]({{< relref "influxdb.md" >}})
* [Loki]({{< relref "loki.md" >}})
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/sources/guides/whats-new-in-v7-0.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ It was released as a beta feature in Grafana 6.7. The feedback has been really p

## Stackdriver data source supports Service Monitoring

[Service monitoring](https://cloud.google.com/service-monitoring) in Google Cloud Platform (GCP) enables you to monitor based on Service Level Objectives (SLOs) for your GCP services. The new SLO query builder in the Stackdriver data source allows you to display SLO data in Grafana. Read more about it in the [Stackdriver data source documentation]({{< relref "../features/datasources/stackdriver/#slo-service-level-objective-queries" >}}).
[Service monitoring](https://cloud.google.com/service-monitoring) in Google Cloud Platform (GCP) enables you to monitor based on Service Level Objectives (SLOs) for your GCP services. The new SLO query builder in the Stackdriver data source allows you to display SLO data in Grafana. Read more about it in the [Stackdriver data source documentation]({{< relref "../features/datasources/cloudmonitoring/#slo-service-level-objective-queries" >}}).

## Time zone support

Expand Down
4 changes: 2 additions & 2 deletions docs/sources/menu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@
name: Azure Monitor
- link: /features/datasources/elasticsearch/
name: Elasticsearch
- link: /features/datasources/stackdriver/
name: Google Stackdriver
- link: /features/datasources/cloudmonitoring/
name: Google Cloud Monitoring
- link: /features/datasources/graphite/
name: Graphite
- link: /features/datasources/influxdb/
Expand Down
2 changes: 1 addition & 1 deletion packages/grafana-data/src/types/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export interface QueryResultMeta {
* Legacy data source specific, should be moved to custom
* */
gmdMeta?: any[]; // used by cloudwatch
alignmentPeriod?: string; // used by stackdriver
alignmentPeriod?: string; // used by cloud monitoring
searchWords?: string[]; // used by log models and loki
limit?: number; // used by log models and loki
json?: boolean; // used to keep track of old json doc values
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/grafana-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
_ "github.com/grafana/grafana/pkg/services/alerting/notifiers"
"github.com/grafana/grafana/pkg/setting"
_ "github.com/grafana/grafana/pkg/tsdb/azuremonitor"
_ "github.com/grafana/grafana/pkg/tsdb/cloudmonitoring"
_ "github.com/grafana/grafana/pkg/tsdb/cloudwatch"
_ "github.com/grafana/grafana/pkg/tsdb/elasticsearch"
_ "github.com/grafana/grafana/pkg/tsdb/graphite"
Expand All @@ -28,7 +29,6 @@ import (
_ "github.com/grafana/grafana/pkg/tsdb/opentsdb"
_ "github.com/grafana/grafana/pkg/tsdb/postgres"
_ "github.com/grafana/grafana/pkg/tsdb/prometheus"
_ "github.com/grafana/grafana/pkg/tsdb/stackdriver"
_ "github.com/grafana/grafana/pkg/tsdb/testdatasource"
)

Expand Down
34 changes: 17 additions & 17 deletions pkg/models/datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ import (
)

const (
DS_GRAPHITE = "graphite"
DS_INFLUXDB = "influxdb"
DS_INFLUXDB_08 = "influxdb_08"
DS_ES = "elasticsearch"
DS_OPENTSDB = "opentsdb"
DS_CLOUDWATCH = "cloudwatch"
DS_KAIROSDB = "kairosdb"
DS_PROMETHEUS = "prometheus"
DS_POSTGRES = "postgres"
DS_MYSQL = "mysql"
DS_MSSQL = "mssql"
DS_ACCESS_DIRECT = "direct"
DS_ACCESS_PROXY = "proxy"
DS_STACKDRIVER = "stackdriver"
DS_AZURE_MONITOR = "grafana-azure-monitor-datasource"
DS_LOKI = "loki"
DS_GRAPHITE = "graphite"
DS_INFLUXDB = "influxdb"
DS_INFLUXDB_08 = "influxdb_08"
DS_ES = "elasticsearch"
DS_OPENTSDB = "opentsdb"
DS_CLOUDWATCH = "cloudwatch"
DS_KAIROSDB = "kairosdb"
DS_PROMETHEUS = "prometheus"
DS_POSTGRES = "postgres"
DS_MYSQL = "mysql"
DS_MSSQL = "mssql"
DS_ACCESS_DIRECT = "direct"
DS_ACCESS_PROXY = "proxy"
DS_CLOUD_MONITORING = "stackdriver"
papagian marked this conversation as resolved.
Show resolved Hide resolved
DS_AZURE_MONITOR = "grafana-azure-monitor-datasource"
DS_LOKI = "loki"
)

var (
Expand Down Expand Up @@ -97,7 +97,7 @@ var knownDatasourcePlugins = map[string]bool{
DS_POSTGRES: true,
DS_MYSQL: true,
DS_MSSQL: true,
DS_STACKDRIVER: true,
DS_CLOUD_MONITORING: true,
DS_AZURE_MONITOR: true,
DS_LOKI: true,
"opennms": true,
Expand Down
8 changes: 6 additions & 2 deletions pkg/plugins/frontend_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,12 @@ func (fp *FrontendPluginBase) handleModuleDefaults() {
}

fp.IsCorePlugin = true
fp.Module = path.Join("app/plugins", fp.Type, fp.Id, "module")
fp.BaseUrl = path.Join("public/app/plugins", fp.Type, fp.Id)
// Previously there was an assumption that the plugin directory
// should be public/app/plugins/<plugin type>/<plugin id>
// However this can be an issue if the plugin directory should be renamed to something else
currentDir := path.Base(fp.PluginDir)
fp.Module = path.Join("app/plugins", fp.Type, currentDir, "module")
fp.BaseUrl = path.Join("public/app/plugins", fp.Type, currentDir)
}

func isExternalPlugin(pluginDir string) bool {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package stackdriver
package cloudmonitoring

import (
"context"
Expand All @@ -9,7 +9,7 @@ import (
"github.com/grafana/grafana/pkg/tsdb"
)

func (e *StackdriverExecutor) executeAnnotationQuery(ctx context.Context, tsdbQuery *tsdb.TsdbQuery) (*tsdb.Response, error) {
func (e *CloudMonitoringExecutor) executeAnnotationQuery(ctx context.Context, tsdbQuery *tsdb.TsdbQuery) (*tsdb.Response, error) {
result := &tsdb.Response{
Results: make(map[string]*tsdb.QueryResult),
}
Expand All @@ -34,7 +34,7 @@ func (e *StackdriverExecutor) executeAnnotationQuery(ctx context.Context, tsdbQu
return result, err
}

func (e *StackdriverExecutor) parseToAnnotations(queryRes *tsdb.QueryResult, data stackdriverResponse, query *stackdriverQuery, title string, text string, tags string) error {
func (e *CloudMonitoringExecutor) parseToAnnotations(queryRes *tsdb.QueryResult, data cloudMonitoringResponse, query *cloudMonitoringQuery, title string, text string, tags string) error {
annotations := make([]map[string]string, 0)

for _, series := range data.TimeSeries {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package stackdriver
package cloudmonitoring

import (
"testing"
Expand All @@ -9,16 +9,16 @@ import (
. "github.com/smartystreets/goconvey/convey"
)

func TestStackdriverAnnotationQuery(t *testing.T) {
Convey("Stackdriver Annotation Query Executor", t, func() {
executor := &StackdriverExecutor{}
Convey("When parsing the stackdriver api response", func() {
func TestCloudMonitoringAnnotationQuery(t *testing.T) {
Convey("CloudMonitoring Annotation Query Executor", t, func() {
executor := &CloudMonitoringExecutor{}
Convey("When parsing the cloud monitoring api response", func() {
data, err := loadTestFile("./test-data/2-series-response-no-agg.json")
So(err, ShouldBeNil)
So(len(data.TimeSeries), ShouldEqual, 3)

res := &tsdb.QueryResult{Meta: simplejson.New(), RefId: "annotationQuery"}
query := &stackdriverQuery{}
query := &cloudMonitoringQuery{}
err = executor.parseToAnnotations(res, data, query, "atitle {{metric.label.instance_name}} {{metric.value}}", "atext {{resource.label.zone}}", "atag")
So(err, ShouldBeNil)

Expand Down
Loading