Skip to content
This repository has been archived by the owner on Jan 22, 2021. It is now read-only.

Commit

Permalink
Storage queue updates (#40)
Browse files Browse the repository at this point in the history
Updates to docs based on the investigation on storage queues ( #39 ). Also found that filter was required but shouldn't be.
  • Loading branch information
jsturtevant authored Oct 17, 2018
1 parent f8bc119 commit 07aae99
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ See a full [list of hundreds of available azure external metrics](https://docs.m
Common external metrics to use for autoscaling are:

- [Azure ServiceBus Queue](https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitoring-supported-metrics#microsoftservicebusnamespaces) - Message Count - [example](samples/servicebus-queue)
- [Azure Storage Queue](https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitoring-supported-metrics#microsoftstoragestorageaccountsqueueservices) - Message Count
- [Azure Eventhubs](https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitoring-supported-metrics#microsofteventhubnamespaces)

## Custom Metrics

Expand Down Expand Up @@ -252,6 +250,11 @@ The use the adapter your Azure Subscription must be provided. There are a few w
- Environment Variable - If you are outside of Azure or want full control of the subscription that is used you can set the Environment variable `SUBSCRIPTION_ID` on the adapter deployment. This takes precedence over the Azure Instance Metadata.
- [On each HPA](samples/hpa-examples) - you can work with multiple subscriptions by supplying the metric selector `subscriptionID` on each HPA. This overrides Environment variables and Azure Instance Metadata settings.
## FAQ
- Can I scale with Azure Storage queues?
- Not currently. The [Azure Storage Queue](https://docs.microsoft.com/en-us/azure/storage/common/storage-metrics-in-azure-monitor?toc=%2fazure%2fstorage%2fqueues%2ftoc.json#capacity-metrics) only reports it's capacity metrics daily. Follow this [issue](https://github.com/Azure/azure-k8s-metrics-adapter/issues/39) for updates.
## Contributing
See [Contributing](CONTRIBUTING.md) for more information.
Expand Down
2 changes: 1 addition & 1 deletion pkg/azure/monitor/metricrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (amr AzureMetricRequest) Validate() error {
return InvalidMetricRequestError{err: "timespan is required"}
}
if amr.Filter == "" {
return InvalidMetricRequestError{err: "filter is required"}
glog.V(2).Infof("filter on request was not set")
}

if amr.SubscriptionID == "" {
Expand Down
40 changes: 40 additions & 0 deletions pkg/azure/monitor/metricrequest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,43 @@ func TestParseWithNoSubIdPassedIsFails(t *testing.T) {
t.Errorf("should be InvalidMetricRequest error got %v, want InvalidMetricRequestError", err)
}
}

func TestValidateWithValidMetric(t *testing.T) {
mr := AzureMetricRequest{
Aggregation: "Total",
Filter: "EntityName eq 'externalq'",
MetricName: "Test",
ResourceGroup: "resource-group",
ResourceName: "name",
ResourceProviderNamespace: "Microsoft.ServiceBus",
ResourceType: "namespace",
Timespan: TimeSpan(),
SubscriptionID: "1234-12-42-24",
}

err := mr.Validate()

if err != nil {
t.Errorf("validate got error %v, want nil", err)
}
}

func TestValidateFilterIsOptional(t *testing.T) {
mr := AzureMetricRequest{
Aggregation: "Total",
Filter: "",
MetricName: "Test",
ResourceGroup: "resource-group",
ResourceName: "name",
ResourceProviderNamespace: "Microsoft.ServiceBus",
ResourceType: "namespace",
Timespan: TimeSpan(),
SubscriptionID: "1234-12-42-24",
}

err := mr.Validate()

if err != nil {
t.Errorf("validate got error %v, want nil", err)
}
}

0 comments on commit 07aae99

Please sign in to comment.