From 938e66ccf352e2925b99fc988b28c46fc3ee304e Mon Sep 17 00:00:00 2001
From: Mariana <mariana@elastic.co>
Date: Thu, 23 Jul 2020 11:01:08 +0200
Subject: [PATCH 1/6] mofidy doc

---
 .../module/azure/app_insights/_meta/docs.asciidoc    | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/x-pack/metricbeat/module/azure/app_insights/_meta/docs.asciidoc b/x-pack/metricbeat/module/azure/app_insights/_meta/docs.asciidoc
index 2ba1150078b0..2b587acbbdd6 100644
--- a/x-pack/metricbeat/module/azure/app_insights/_meta/docs.asciidoc
+++ b/x-pack/metricbeat/module/azure/app_insights/_meta/docs.asciidoc
@@ -45,17 +45,15 @@ This value is only valid when segment is specified.
 `filter`:: (_string_) An expression used to filter the results.
 This value should be a valid OData filter expression where the keys of each clause should be applicable dimensions for the metric you are retrieving.
 
-Users can select the options to retrieve all metrics from a specific namespace using the following:
+Example configuration:
 
 ["source","yaml"]
 ----
- metrics:
- - id: ["*"]
-   timespan: "Microsoft.Storage/storageAccounts"
+metrics:
+ - id: ["requests/count", "requests/failed"]
+   segment: "request/name"
+   aggregation: ["sum"]
 ----
 
 
 
-A default non configurable timegrain of 5 min is set so users are advised to configure an interval of 300s or  a multiply of it.
-
-

From a191c37ea3f55a8c6904e2385eb26092797d079b Mon Sep 17 00:00:00 2001
From: Mariana <mariana@elastic.co>
Date: Mon, 3 Aug 2020 19:05:39 +0200
Subject: [PATCH 2/6] config

---
 x-pack/metricbeat/module/azure/_meta/config.reference.yml   | 3 ++-
 x-pack/metricbeat/module/azure/_meta/config.yml             | 2 ++
 x-pack/metricbeat/module/azure/app_insights/app_insights.go | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/x-pack/metricbeat/module/azure/_meta/config.reference.yml b/x-pack/metricbeat/module/azure/_meta/config.reference.yml
index 129384d14981..1f9ac04529e8 100644
--- a/x-pack/metricbeat/module/azure/_meta/config.reference.yml
+++ b/x-pack/metricbeat/module/azure/_meta/config.reference.yml
@@ -100,4 +100,5 @@
   period: 300s
   application_id: ''
   api_key: ''
-
+  metrics:
+    - id: ["requests/count", "requests/duration"]
diff --git a/x-pack/metricbeat/module/azure/_meta/config.yml b/x-pack/metricbeat/module/azure/_meta/config.yml
index 914f5ed57743..0f497af6fb44 100644
--- a/x-pack/metricbeat/module/azure/_meta/config.yml
+++ b/x-pack/metricbeat/module/azure/_meta/config.yml
@@ -109,3 +109,5 @@
 #  period: 300s
 #  application_id: ''
 #  api_key: ''
+#  metrics:
+#   - id: ["requests/count", "requests/duration"]
diff --git a/x-pack/metricbeat/module/azure/app_insights/app_insights.go b/x-pack/metricbeat/module/azure/app_insights/app_insights.go
index e3a087ad7cee..8ffe02eb860a 100644
--- a/x-pack/metricbeat/module/azure/app_insights/app_insights.go
+++ b/x-pack/metricbeat/module/azure/app_insights/app_insights.go
@@ -22,7 +22,7 @@ type Config struct {
 	ApplicationId string        `config:"application_id"    validate:"required"`
 	ApiKey        string        `config:"api_key" validate:"required"`
 	Period        time.Duration `config:"period" validate:"nonzero,required"`
-	Metrics       []Metric      `config:"metrics"`
+	Metrics       []Metric      `config:"metrics" validate:"required"`
 }
 
 // Metric struct used for configuration options

From f1ca50614b2de3ab1ef5885d7eb65bd484446dc0 Mon Sep 17 00:00:00 2001
From: Mariana <mariana@elastic.co>
Date: Mon, 3 Aug 2020 19:08:56 +0200
Subject: [PATCH 3/6] changelog

---
 CHANGELOG.next.asciidoc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc
index c12c2a9574f3..81b5851b924a 100644
--- a/CHANGELOG.next.asciidoc
+++ b/CHANGELOG.next.asciidoc
@@ -302,6 +302,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
 - Fix k8s scheduler compatibility issue. {pull}19699[19699]
 - Fix SQL module mapping NULL values as string {pull}18955[18955] {issue}18898[18898
 - Modify doc for app_insights metricset to contain example of config. {pull}20185[20185]
+- Add required option for `metrics` in app_insights. {pull}20406[20406]
 
 *Packetbeat*
 

From d95e983eb74f0318154359875eab0a84f5fc3846 Mon Sep 17 00:00:00 2001
From: Mariana <mariana@elastic.co>
Date: Tue, 4 Aug 2020 10:23:23 +0200
Subject: [PATCH 4/6] generate

---
 metricbeat/docs/modules/azure.asciidoc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/metricbeat/docs/modules/azure.asciidoc b/metricbeat/docs/modules/azure.asciidoc
index 248350e3fb1e..e4cd48354737 100644
--- a/metricbeat/docs/modules/azure.asciidoc
+++ b/metricbeat/docs/modules/azure.asciidoc
@@ -241,7 +241,8 @@ metricbeat.modules:
   period: 300s
   application_id: ''
   api_key: ''
-
+  metrics:
+    - id: ["requests/count", "requests/duration"]
 ----
 
 [float]

From c1f7f61b5dbbff06e82d810ece0bfaa591b1a814 Mon Sep 17 00:00:00 2001
From: Mariana <mariana@elastic.co>
Date: Tue, 4 Aug 2020 10:51:04 +0200
Subject: [PATCH 5/6] regen

---
 x-pack/metricbeat/modules.d/azure.yml.disabled | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/x-pack/metricbeat/modules.d/azure.yml.disabled b/x-pack/metricbeat/modules.d/azure.yml.disabled
index 857bfd6619f7..23211f472061 100644
--- a/x-pack/metricbeat/modules.d/azure.yml.disabled
+++ b/x-pack/metricbeat/modules.d/azure.yml.disabled
@@ -112,3 +112,5 @@
 #  period: 300s
 #  application_id: ''
 #  api_key: ''
+#  metrics:
+#   - id: ["requests/count", "requests/duration"]

From df62a1f67264ed6df4d033e40a2911e00e8c804c Mon Sep 17 00:00:00 2001
From: Mariana <mariana@elastic.co>
Date: Tue, 4 Aug 2020 12:25:43 +0200
Subject: [PATCH 6/6] mage fmt

---
 x-pack/metricbeat/metricbeat.reference.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/x-pack/metricbeat/metricbeat.reference.yml b/x-pack/metricbeat/metricbeat.reference.yml
index 457a2c2bfe7f..a2183e895f49 100644
--- a/x-pack/metricbeat/metricbeat.reference.yml
+++ b/x-pack/metricbeat/metricbeat.reference.yml
@@ -340,7 +340,8 @@ metricbeat.modules:
   period: 300s
   application_id: ''
   api_key: ''
-
+  metrics:
+    - id: ["requests/count", "requests/duration"]
 
 #--------------------------------- Beat Module ---------------------------------
 - module: beat