-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Small improvements on the azure module #13859
Conversation
narph
commented
Oct 1, 2019
- Work on validation and adding conditions
- Small work on azure docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some suggestions about documentation, and please review the changelog, I think we are missing an entry for the Azure module.
CHANGELOG.next.asciidoc
Outdated
@@ -386,6 +386,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d | |||
- Add support for NATS version 2. {pull}13601[13601] | |||
- Add `docker.cpu.*.norm.pct` metrics for `cpu` metricset of Docker Metricbeat module. {pull}13695[13695] | |||
- Add `instance` label by default when using Prometheus collector. {pull}13737[13737] | |||
- Add small improvements in the azure module (validation, doc update) {pull}13859[13859] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Umm, we should have an entry about the new Azure module, but I think we forgot it in #13196
As the module is not released yet we wouldn't need this new entry.
Could you replace this one with one about adding the module itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added both entries in the list, is there a reason the second one should be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@narph My understanding is changelog is user facing. Since this is not released yet, they don't need to know how many PRs we spent to add the initial pr, the improvements, the docs and etc. But I agree with Jaime, the new module needs to be an entry by itself 😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have merged the 2 PRs in one comment line
|
||
`tenant_id` - The unique identifier of the Azure Active Directory instance | ||
|
||
Users can use the azure credentials keys if configured `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_TENANT_ID`, `AZURE_SUBSCRIPTION_ID` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part could be moved to some other file so it can be reused in other features that need to authenticate with Azure AD in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have cleaned up the documentation and touched on your findings as well. At the moment this is the only place where it will be used. Do you have any recommendations where the information regarding credentials should be moved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have some shared doc files in libbeat/docs/shared-*
. We can wait to move this content to a shared file when we need it in any case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good
x-pack/metricbeat/module/azure/compute_vm_scaleset/_meta/docs.asciidoc
Outdated
Show resolved
Hide resolved
|
||
Costs: Metric queries are charged based on the number of standard API calls. More information on pricing here https://azure.microsoft.com/id-id/pricing/details/monitor/. | ||
|
||
Authentication: we are handling authentication on our side (creating/renewing the authentication token), so we advise users to use dedicated credentials for metricbeat only. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, are there a set of permissions user need to give this account in order for azure module to collect the metrics?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More information on the authentication and the steps to require a service principal are found higher in the docs.asciidoc in the === Module-specific configuration notes
.
I have just added the link to the RBAC as well, users will need to assign a role that allows them to read monitoring data, minimum effort would be "Monitoring Reader"
@@ -32,8 +35,14 @@ func mapMetric(client *azure.Client, metric azure.MetricConfig, resource resourc | |||
if len(*metricDefinitions.Value) == 0 { | |||
return nil, errors.Errorf("no metric definitions were found for resource %s and namespace %s.", *resource.ID, *namespace.Properties.MetricNamespaceName) | |||
} | |||
var filteredMetricDefinitions []insights.MetricDefinition | |||
for _, metricDefinition := range *metricDefinitions.Value { | |||
if (metricDefinition.Name.LocalizedValue != nil && !strings.Contains(*metricDefinition.Name.LocalizedValue, "(Deprecated)")) || metricDefinition.Name.LocalizedValue == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would be simpler and equivalent
if (metricDefinition.Name.LocalizedValue != nil && !strings.Contains(*metricDefinition.Name.LocalizedValue, "(Deprecated)")) || metricDefinition.Name.LocalizedValue == nil { | |
if metricDefinition.Name.LocalizedValue == nil || !strings.Contains(*metricDefinition.Name.LocalizedValue, "(Deprecated)")) { |
Btw, why are we filtering out deprecated values?
Can the use of "localized" values be a problem if languages different to English are used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the API will not return the "deprecated" message although it will do so for the "preview". Non the less, testing different languages for the metric localized name, indeed should translate the "deprecated" word as well (https://docs.microsoft.com/nl-NL/azure/azure-monitor/platform/metrics-supported#microsoftcomputevirtualmachines , for nl version "afgeschaft"). I have removed the entire condition in both places.
x-pack/metricbeat/module/azure/compute_vm_scaleset/compute_vm_scaleset.go
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a couple of extra small suggestions
} | ||
|
||
//validate config based on metricset | ||
switch base.Name() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be metricsetName
?
switch base.Name() { | |
switch metricsetName { |
|
||
// FetchValues methods implements the data gathering and data conversion to the right metricset | ||
func (m *MetricSet) FetchValues(fn mapMetric, report mb.ReporterV2) error { | ||
err := m.Client.InitResources(fn, report) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If fn
would be an attribute of the metricset I think that this FetchValues
could be the Fetch
method of all derived metricsets.
err := m.Client.InitResources(fn, report) | |
err := m.Client.InitResources(m.mapMetricFn, report) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the suggestion, I have made the changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!