Skip to content

Commit 6edefe5

Browse files
authored
AzureMonitor: Remove deprecated code (grafana#48328)
1 parent 07bd261 commit 6edefe5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+39
-3523
lines changed

.betterer.results

-3
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,6 @@ exports[`no enzyme tests`] = {
299299
"public/app/plugins/datasource/elasticsearch/configuration/DataLinks.test.tsx:248699332": [
300300
[0, 17, 13, "RegExp match", "2409514259"]
301301
],
302-
"public/app/plugins/datasource/grafana-azure-monitor-datasource/components/deprecated/components/InsightsConfig.test.tsx:1107283234": [
303-
[0, 19, 13, "RegExp match", "2409514259"]
304-
],
305302
"public/app/plugins/datasource/influxdb/components/ConfigEditor.test.tsx:3456478975": [
306303
[0, 19, 13, "RegExp match", "2409514259"]
307304
],

pkg/tsdb/azuremonitor/azuremonitor-resource-handler.go

-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99

1010
"github.com/grafana/grafana-plugin-sdk-go/backend/resource/httpadapter"
1111
"github.com/grafana/grafana/pkg/tsdb/azuremonitor/azlog"
12-
"github.com/grafana/grafana/pkg/tsdb/azuremonitor/deprecated"
1312
"github.com/grafana/grafana/pkg/tsdb/azuremonitor/types"
1413
)
1514

@@ -125,7 +124,5 @@ func (s *Service) newResourceMux() *http.ServeMux {
125124
mux.HandleFunc("/azuremonitor/", s.handleResourceReq(azureMonitor))
126125
mux.HandleFunc("/loganalytics/", s.handleResourceReq(azureLogAnalytics))
127126
mux.HandleFunc("/resourcegraph/", s.handleResourceReq(azureResourceGraph))
128-
// Remove with Grafana 9
129-
mux.HandleFunc("/appinsights/", s.handleResourceReq(deprecated.AppInsights))
130127
return mux
131128
}

pkg/tsdb/azuremonitor/azuremonitor.go

-9
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"fmt"
77
"net/http"
88

9-
"github.com/Masterminds/semver"
109
"github.com/grafana/grafana-plugin-sdk-go/backend"
1110
"github.com/grafana/grafana-plugin-sdk-go/backend/datasource"
1211
"github.com/grafana/grafana-plugin-sdk-go/backend/httpclient"
@@ -15,7 +14,6 @@ import (
1514
"github.com/grafana/grafana/pkg/components/simplejson"
1615
"github.com/grafana/grafana/pkg/infra/tracing"
1716
"github.com/grafana/grafana/pkg/setting"
18-
"github.com/grafana/grafana/pkg/tsdb/azuremonitor/deprecated"
1917
"github.com/grafana/grafana/pkg/tsdb/azuremonitor/loganalytics"
2018
"github.com/grafana/grafana/pkg/tsdb/azuremonitor/metrics"
2119
"github.com/grafana/grafana/pkg/tsdb/azuremonitor/resourcegraph"
@@ -30,13 +28,6 @@ func ProvideService(cfg *setting.Cfg, httpClientProvider *httpclient.Provider, t
3028
azureResourceGraph: &resourcegraph.AzureResourceGraphDatasource{Proxy: proxy},
3129
}
3230

33-
// Insights Analytics and Application Insights were deprecated in Grafana 8.x and
34-
// will be finally removed with Grafana 9
35-
if setting.BuildVersion != "" && semver.MustParse(setting.BuildVersion).Compare(semver.MustParse("9.0.0-beta1")) < 0 {
36-
executors[deprecated.InsightsAnalytics] = &deprecated.InsightsAnalyticsDatasource{Proxy: proxy}
37-
executors[deprecated.AppInsights] = &deprecated.ApplicationInsightsDatasource{Proxy: proxy}
38-
}
39-
4031
im := datasource.NewInstanceManager(NewInstanceSettings(cfg, httpClientProvider, executors))
4132

4233
s := &Service{

pkg/tsdb/azuremonitor/azuremonitor_test.go

-30
Original file line numberDiff line numberDiff line change
@@ -14,41 +14,11 @@ import (
1414

1515
"github.com/grafana/grafana/pkg/infra/tracing"
1616
"github.com/grafana/grafana/pkg/setting"
17-
"github.com/grafana/grafana/pkg/tsdb/azuremonitor/deprecated"
1817
"github.com/grafana/grafana/pkg/tsdb/azuremonitor/types"
1918

20-
"github.com/stretchr/testify/assert"
2119
"github.com/stretchr/testify/require"
2220
)
2321

24-
func TestProvideService(t *testing.T) {
25-
t.Run("it should skip insight analytics and app insights with Grafana 9", func(t *testing.T) {
26-
currentV := setting.BuildVersion
27-
t.Cleanup(func() {
28-
setting.BuildVersion = currentV
29-
})
30-
versions := []struct {
31-
version string
32-
shouldIncludeInsights bool
33-
}{
34-
{"8.5.0", true},
35-
{"9.0.0-beta1", false},
36-
{"9.0.0", false},
37-
}
38-
for _, v := range versions {
39-
setting.BuildVersion = v.version
40-
s := ProvideService(setting.NewCfg(), httpclient.NewProvider(), nil)
41-
if v.shouldIncludeInsights {
42-
assert.NotNil(t, s.executors[deprecated.InsightsAnalytics])
43-
assert.NotNil(t, s.executors[deprecated.AppInsights])
44-
} else {
45-
assert.Nil(t, s.executors[deprecated.InsightsAnalytics])
46-
assert.Nil(t, s.executors[deprecated.AppInsights])
47-
}
48-
}
49-
})
50-
}
51-
5222
func TestNewInstanceSettings(t *testing.T) {
5323
tests := []struct {
5424
name string

pkg/tsdb/azuremonitor/deprecated/applicationinsights-datasource.go

-269
This file was deleted.

0 commit comments

Comments
 (0)