Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1955,11 +1955,11 @@ SOFTWARE.

--------------------------------------------------------------------------------
Dependency : github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor
Version: v0.8.0
Version: v0.11.0
Licence type (autodetected): MIT
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/!azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor@v0.8.0/LICENSE.txt:
Contents of probable licence file $GOMODCACHE/github.com/!azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor@v0.11.0/LICENSE.txt:

MIT License

Expand Down
28 changes: 28 additions & 0 deletions changelog/fragments/1775076983-bump-armmonitor-v0.11.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# REQUIRED
# Kind can be one of:
# - breaking-change: a change to previously-documented behavior
# - deprecation: functionality that is being removed in a later release
# - bug-fix: fixes a problem in a previous version
# - enhancement: extends functionality but does not break or fix existing behavior
# - feature: new functionality
# - known-issue: problems that we are aware of in a given version
# - security: impacts on the security of a product or a user's deployment.
# - upgrade: important information for someone upgrading from a prior version
# - other: does not fit into any of the other categories
kind: enhancement

# REQUIRED for all kinds
# Change summary; a 80ish characters long description of the change.
summary: Bump azure-sdk-for-go armmonitor from v0.8.0 to v0.11.0

# REQUIRED for all kinds
# Affected component; usually one of "elastic-agent", "fleet-server", "filebeat", "metricbeat", "auditbeat", "all", etc.
component: metricbeat

# AUTOMATED
# OPTIONAL to manually add other PR URLs
pr: https://github.com/elastic/beats/pull/49866

# AUTOMATED
# OPTIONAL to manually add other issue URLs
# issue: https://github.com/owner/repo/1234
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption v1.1.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 v4.8.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement v1.1.1
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor v0.8.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor v0.11.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.6.0
github.com/Azure/azure-storage-blob-go v0.15.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0 h1:PTFG
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0/go.mod h1:LRr2FzBTQlONPPa5HREE5+RjSCTXl7BwOvYOaWTqCaI=
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0 h1:pPvTJ1dY0sA35JOeFq6TsY2xj6Z85Yo23Pj4wCCvu4o=
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0/go.mod h1:mLfWfj8v3jfWKsL9G4eoBoXVcsqcIUTapmdKy7uGOp0=
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor v0.8.0 h1:dKxKBzh+XIEoYNmx/c8HeiwghuRExXf61WmVotWESeA=
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor v0.8.0/go.mod h1:kzRLpzzlw6eBUXE7eBw3oqfmKR/kxaHOk4+h9sAe6Yo=
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor v0.11.0 h1:Ds0KRF8ggpEGg4Vo42oX1cIt/IfOhHWJBikksZbVxeg=
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor v0.11.0/go.mod h1:jj6P8ybImR+5topJ+eH6fgcemSFBmU6/6bFF8KkwuDI=
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 h1:Dd+RhdJn0OTtVGaeDLZpcumkIVCtA/3/Fo42+eoYvVM=
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0/go.mod h1:5kakwfW5CjC9KK+Q4wjXAg+ShuIm2mBMua0ZFj2C8PE=
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.6.0 h1:PiSrjRPpkQNjrM8H0WwKMnZUdu1RGMtd/LdGKUrOo+c=
Expand Down
38 changes: 19 additions & 19 deletions x-pack/metricbeat/module/azure/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var (
},
}}},
}
countUnit = armmonitor.MetricUnit("Count")
countUnit = armmonitor.Unit("Count")
)

func mockMapResourceMetrics(client *Client, resources []*armresources.GenericResourceExpanded, resourceConfig ResourceConfig) ([]Metric, error) {
Expand All @@ -65,7 +65,7 @@ func TestInitResources(t *testing.T) {
mr.On("Error", mock.Anything).Return(true)
err := client.InitResources(mockMapResourceMetrics)
assert.Error(t, err, "no resources were found based on all the configurations options entered")
assert.Equal(t, len(client.ResourceConfigurations.Metrics), 0)
assert.Empty(t, client.ResourceConfigurations.Metrics)
m.AssertExpectations(t)
})
}
Expand Down Expand Up @@ -94,8 +94,8 @@ func TestGetMetricValues(t *testing.T) {
mr := MockReporterV2{}
mr.On("Error", mock.Anything).Return(true)
metrics := client.GetMetricValues(referenceTime, client.ResourceConfigurations.Metrics, &mr)
assert.Equal(t, len(metrics), 0)
assert.Equal(t, len(client.ResourceConfigurations.Metrics[0].Values), 0)
assert.Empty(t, metrics)
assert.Empty(t, client.ResourceConfigurations.Metrics[0].Values)
m.AssertExpectations(t)
})
t.Run("return metric values", func(t *testing.T) {
Expand All @@ -117,8 +117,8 @@ func TestGetMetricValues(t *testing.T) {
mr := MockReporterV2{}
mr.On("Error", mock.Anything).Return(true)
metricValues := client.GetMetricValues(referenceTime, client.ResourceConfigurations.Metrics, &mr)
assert.Equal(t, len(metricValues), 0)
assert.Equal(t, len(client.ResourceConfigurations.Metrics[0].Values), 0)
assert.Empty(t, metricValues)
assert.Empty(t, client.ResourceConfigurations.Metrics[0].Values)
m.AssertExpectations(t)
})

Expand Down Expand Up @@ -175,14 +175,14 @@ func TestGetMetricValues(t *testing.T) {

metricValues := client.GetMetricValues(referenceTime, client.ResourceConfigurations.Metrics, &mr)

require.Equal(t, len(metricValues), 1)
require.Equal(t, len(metricValues[0].Values), 1)
require.Len(t, metricValues, 1)
require.Len(t, metricValues[0].Values, 1)

assert.Equal(t, *metricValues[0].Values[0].avg, 1.0)
assert.Equal(t, *metricValues[0].Values[0].max, 2.0)
assert.Equal(t, *metricValues[0].Values[0].min, 3.0)
assert.InDelta(t, 1.0, *metricValues[0].Values[0].avg, 0.001)
assert.InDelta(t, 2.0, *metricValues[0].Values[0].max, 0.001)
assert.InDelta(t, 3.0, *metricValues[0].Values[0].min, 0.001)

require.Equal(t, len(client.ResourceConfigurations.Metrics[0].Values), 1)
require.Len(t, client.ResourceConfigurations.Metrics[0].Values, 1)

m.AssertExpectations(t)
})
Expand Down Expand Up @@ -258,19 +258,19 @@ func TestGetMetricValues(t *testing.T) {

metricValues := client.GetMetricValues(referenceTime, client.ResourceConfigurations.Metrics, &mr)

require.Equal(t, 3, len(metricValues))
require.Len(t, metricValues, 3)

require.Equal(t, 1, len(metricValues[0].Values))
require.Equal(t, 1, len(metricValues[1].Values))
require.Equal(t, 1, len(metricValues[2].Values))
require.Len(t, metricValues[0].Values, 1)
require.Len(t, metricValues[1].Values, 1)
require.Len(t, metricValues[2].Values, 1)

require.NotNil(t, metricValues[0].Values[0].max, "max value is nil")
require.NotNil(t, metricValues[1].Values[0].min, "min value is nil")
require.NotNil(t, metricValues[2].Values[0].avg, "avg value is nil")

assert.Equal(t, *metricValues[0].Values[0].max, 3.0)
assert.Equal(t, *metricValues[1].Values[0].min, 1.0)
assert.Equal(t, *metricValues[2].Values[0].avg, 2.0)
assert.InDelta(t, 3.0, *metricValues[0].Values[0].max, 0.001)
assert.InDelta(t, 1.0, *metricValues[1].Values[0].min, 0.001)
assert.InDelta(t, 2.0, *metricValues[2].Values[0].avg, 0.001)

m.AssertExpectations(t)
})
Expand Down
4 changes: 2 additions & 2 deletions x-pack/metricbeat/module/azure/monitor_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ func NewService(config Config, logger *logp.Logger) (*MonitorService, error) {
return nil, fmt.Errorf("couldn't create client credentials: %w", err)
}

metricsClient, err := armmonitor.NewMetricsClient(credential, &arm.ClientOptions{
metricsClient, err := armmonitor.NewMetricsClient(config.SubscriptionId, credential, &arm.ClientOptions{
ClientOptions: clientOptions,
})
if err != nil {
return nil, fmt.Errorf("couldn't create metrics client: %w", err)
}

metricsDefinitionClient, err := armmonitor.NewMetricDefinitionsClient(credential, &arm.ClientOptions{
metricsDefinitionClient, err := armmonitor.NewMetricDefinitionsClient(config.SubscriptionId, credential, &arm.ClientOptions{
ClientOptions: clientOptions,
})
if err != nil {
Expand Down
Loading