Skip to content

Commit 0766e37

Browse files
Merge pull request #28375 from xueqzhan/azure-metrics
TRT-1274: get azure disk metrics and create relevant intervals
2 parents fa60863 + ab29299 commit 0766e37

File tree

219 files changed

+50185
-0
lines changed

Some content is hidden

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

219 files changed

+50185
-0
lines changed

e2echart/e2e-chart-template.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ <h5 class="modal-title">Resource</h5>
214214
eventInterval.tempStructuredMessage.reason === "NotReady");
215215
}
216216

217+
function isCloudMetrics(eventInterval) {
218+
return eventInterval.tempSource === "CloudMetrics";
219+
}
220+
217221
function isAlert(eventInterval) {
218222
if (eventInterval.locator.includes("alert/")) {
219223
return true
@@ -309,6 +313,10 @@ <h5 class="modal-title">Resource</h5>
309313
return [item.locator, ` (${roles})`, m];
310314
}
311315

316+
function cloudMetricsValue(item) {
317+
return [item.locator, "", "CloudMetric"];
318+
}
319+
312320
function alertSeverity(item) {
313321
// the other types can be pending, so check pending first
314322
let pendingIndex = item.message.indexOf("pending")
@@ -484,6 +492,9 @@ <h5 class="modal-title">Resource</h5>
484492
return e1.label < e2.label ? -1 : e1.label > e2.label;
485493
})
486494

495+
timelineGroups.push({group: "cloud-metrics", data: []})
496+
createTimelineData(cloudMetricsValue, timelineGroups[timelineGroups.length - 1].data, eventIntervals, isCloudMetrics, regex)
497+
487498
timelineGroups.push({group: "endpoint-availability", data: []})
488499
createTimelineData(disruptionValue, timelineGroups[timelineGroups.length - 1].data, eventIntervals, isEndpointConnectivity, regex)
489500

go.mod

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ module github.com/openshift/origin
33
go 1.20
44

55
require (
6+
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0
7+
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor v0.10.2
68
github.com/MakeNowJust/heredoc v1.0.0
79
github.com/RangelReale/osincli v0.0.0-20160924135400-fababb0555f2
810
github.com/apparentlymart/go-cidr v1.1.0
@@ -71,6 +73,8 @@ require (
7173
cloud.google.com/go/compute v1.19.0 // indirect
7274
cloud.google.com/go/compute/metadata v0.2.3 // indirect
7375
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible // indirect
76+
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0-beta.1 // indirect
77+
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect
7478
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
7579
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
7680
github.com/Azure/go-autorest/autorest v0.11.29 // indirect
@@ -82,6 +86,7 @@ require (
8286
github.com/Azure/go-autorest/logger v0.2.1 // indirect
8387
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
8488
github.com/Azure/go-ntlmssp v0.0.0-20211209120228-48547f28849e // indirect
89+
github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect
8590
github.com/GoogleCloudPlatform/k8s-cloud-provider v1.18.1-0.20220218231025-f11817397a1b // indirect
8691
github.com/JeffAshton/win_pdh v0.0.0-20161109143554-76bb4ee9f0ab // indirect
8792
github.com/Microsoft/go-winio v0.6.0 // indirect
@@ -159,6 +164,7 @@ require (
159164
github.com/json-iterator/go v1.1.12 // indirect
160165
github.com/karrick/godirwalk v1.17.0 // indirect
161166
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd // indirect
167+
github.com/kylelemons/godebug v1.1.0 // indirect
162168
github.com/lestrrat-go/jspointer v0.0.0-20181205001929-82fadba7561c // indirect
163169
github.com/lestrrat-go/jsref v0.0.0-20181205001954-1b590508f37d // indirect
164170
github.com/lestrrat-go/jsschema v0.0.0-20181205002244-5c81c58ffcc3 // indirect
@@ -193,6 +199,7 @@ require (
193199
github.com/opencontainers/selinux v1.10.0 // indirect
194200
github.com/pelletier/go-toml v1.9.3 // indirect
195201
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
202+
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
196203
github.com/pkg/profile v1.3.0 // indirect
197204
github.com/pmezard/go-difflib v1.0.0 // indirect
198205
github.com/pquerna/cachecontrol v0.1.0 // indirect

go.sum

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3f
5656
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
5757
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible h1:fcYLmCpyNYRnvJbPerq7U0hS+6+I79yEDJBqVNcqUzU=
5858
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
59+
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0-beta.1 h1:ODs3brnqQM99Tq1PffODpAViYv3Bf8zOg464MU7p5ew=
60+
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0-beta.1/go.mod h1:3Ug6Qzto9anB6mGlEdgYMDF5zHQ+wwhEaYR4s17PHMw=
61+
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg=
62+
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U=
63+
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY=
64+
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM=
65+
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 h1:mLY+pNLjCUeKhgnAJWAKhEUQM+RJQo2H1fuGSw1Ky1E=
66+
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor v0.10.2 h1:T3P5KJpcgN0m39dhaNM+JjSqF3Z5VqUlKHlth5FgN+8=
67+
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor v0.10.2/go.mod h1:yA8WUvh3K/SABQEtFHg2Bx5D+414FyFqpT5Fu58P3ao=
68+
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8=
5969
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=
6070
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8=
6171
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
@@ -81,6 +91,8 @@ github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUM
8191
github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU=
8292
github.com/Azure/go-ntlmssp v0.0.0-20211209120228-48547f28849e h1:ZU22z/2YRFLyf/P4ZwUYSdNCWsMEI0VeyrFoI2rAhJQ=
8393
github.com/Azure/go-ntlmssp v0.0.0-20211209120228-48547f28849e/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU=
94+
github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 h1:OBhqkivkhkMqLPymWEppkm7vgPQY2XsHoEkaMQ0AdZY=
95+
github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o=
8496
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
8597
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
8698
github.com/GoogleCloudPlatform/k8s-cloud-provider v1.18.1-0.20220218231025-f11817397a1b h1:Heo1J/ttaQFgGJSVnCZquy3e5eH5j1nqxBuomztB3P0=
@@ -538,6 +550,8 @@ github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
538550
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
539551
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
540552
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
553+
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
554+
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
541555
github.com/lestrrat-go/jspointer v0.0.0-20181205001929-82fadba7561c h1:pGh5EFIfczeDHwgMHgfwjhZzL+8/E3uZF6T7vER/W8c=
542556
github.com/lestrrat-go/jspointer v0.0.0-20181205001929-82fadba7561c/go.mod h1:xw2Gm4Mg+ST9s8fHR1VkUIyOJMJnSloRZlPQB+wyVpY=
543557
github.com/lestrrat-go/jsref v0.0.0-20181205001954-1b590508f37d h1:1eeFdKL5ySmmYevvKv7iECIc4dTATeKTtBqP4/nXxDk=
@@ -711,6 +725,8 @@ github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5d
711725
github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
712726
github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI=
713727
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
728+
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU=
729+
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI=
714730
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
715731
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
716732
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
@@ -1164,6 +1180,7 @@ golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBc
11641180
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
11651181
golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
11661182
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1183+
golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
11671184
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
11681185
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
11691186
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

pkg/defaultmonitortests/types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313

1414
"github.com/openshift/origin/pkg/monitortestframework"
1515
"github.com/openshift/origin/pkg/monitortests/authentication/legacyauthenticationmonitortests"
16+
azuremetrics "github.com/openshift/origin/pkg/monitortests/cloud/azure/metrics"
1617
"github.com/openshift/origin/pkg/monitortests/clusterversionoperator/legacycvomonitortests"
1718
"github.com/openshift/origin/pkg/monitortests/clusterversionoperator/operatorstateanalyzer"
1819
"github.com/openshift/origin/pkg/monitortests/etcd/etcdloganalyzer"
@@ -165,5 +166,7 @@ func newUniversalMonitorTests() monitortestframework.MonitorTestRegistry {
165166
monitorTestRegistry.AddMonitorTestOrDie("event-collector", "Test Framework", watchevents.NewEventWatcher())
166167
monitorTestRegistry.AddMonitorTestOrDie("clusteroperator-collector", "Test Framework", watchclusteroperators.NewOperatorWatcher())
167168

169+
monitorTestRegistry.AddMonitorTestOrDie("azure-metrics-collector", "Test Framework", azuremetrics.NewAzureMetricsCollector())
170+
168171
return monitorTestRegistry
169172
}

pkg/monitor/monitorapi/construction.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@ func (b *LocatorBuilder) NodeFromNameWithRow(nodeName, row string) Locator {
118118
Build()
119119
}
120120

121+
func (b *LocatorBuilder) CloudNodeMetric(nodeName string, metric string) Locator {
122+
return b.
123+
withTargetType(LocatorTypeCloudMetrics).
124+
withNode(nodeName).
125+
withMetric(metric).
126+
Build()
127+
}
128+
121129
func (b *LocatorBuilder) ClusterVersion(cv *v1.ClusterVersion) Locator {
122130
b.targetType = LocatorTypeClusterVersion
123131
b.annotations[LocatorClusterVersionKey] = cv.Name
@@ -216,6 +224,11 @@ func (b *LocatorBuilder) withRow(row string) *LocatorBuilder {
216224
return b
217225
}
218226

227+
func (b *LocatorBuilder) withMetric(metricName string) *LocatorBuilder {
228+
b.annotations[LocatorMetricKey] = metricName
229+
return b
230+
}
231+
219232
func (b *LocatorBuilder) withEtcdMember(memberName string) *LocatorBuilder {
220233
b.annotations[LocatorEtcdMemberKey] = memberName
221234
return b

pkg/monitor/monitorapi/types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ const (
109109
LocatorTypeE2ETest LocatorType = "E2ETest"
110110
LocatorTypeAPIServerShutdown LocatorType = "APIServerShutdown"
111111
LocatorTypeClusterVersion LocatorType = "ClusterVersion"
112+
LocatorTypeCloudMetrics LocatorType = "CloudMetrics"
112113
)
113114

114115
type LocatorKey string
@@ -140,6 +141,7 @@ const (
140141
LocatorRowKey LocatorKey = "row"
141142
LocatorShutdownKey LocatorKey = "shutdown"
142143
LocatorServerKey LocatorKey = "server"
144+
LocatorMetricKey LocatorKey = "metric"
143145
)
144146

145147
type Locator struct {
@@ -197,6 +199,8 @@ const (
197199

198200
E2ETestStarted IntervalReason = "E2ETestStarted"
199201
E2ETestFinished IntervalReason = "E2ETestFinished"
202+
203+
CloudMetricsExtrenuous IntervalReason = "CloudMetricsExtrenuous"
200204
)
201205

202206
type AnnotationKey string
@@ -272,6 +276,7 @@ const (
272276
SourceOperatorState IntervalSource = "OperatorState"
273277
SourceNodeState = "NodeState"
274278
SourcePodState = "PodState"
279+
SourceCloudMetrics = "CloudMetrics"
275280
)
276281

277282
type Interval struct {

0 commit comments

Comments
 (0)