From 24be9067b35ac999909145196eba4b793ee4648d Mon Sep 17 00:00:00 2001
From: simitt <silvia.mitter@elastic.co>
Date: Fri, 5 Feb 2021 10:31:50 +0100
Subject: [PATCH] [apmpackage] Add config options supported in ESS

part of #4528
---
 .../apm/0.1.0/agent/input/template.yml.hbs    | 14 ++++
 apmpackage/apm/0.1.0/manifest.yml             | 82 +++++++++++++++++++
 2 files changed, 96 insertions(+)

diff --git a/apmpackage/apm/0.1.0/agent/input/template.yml.hbs b/apmpackage/apm/0.1.0/agent/input/template.yml.hbs
index 082497b05cf..2cf8a653863 100644
--- a/apmpackage/apm/0.1.0/agent/input/template.yml.hbs
+++ b/apmpackage/apm/0.1.0/agent/input/template.yml.hbs
@@ -2,3 +2,17 @@ apm-server:
     host: {{host}}
     secret_token: {{secret_token}}
     rum.enabled: {{enable_rum}}
+    max_event_size: {{max_event_bytes}}
+    capture_personal_data: {{capture_personal_data}}
+    api_key.enabled: {{api_key_enabled}}
+    api_key.limit: {{api_key_limit}}
+    rum.allow_origins: {{rum_allow_origins}}
+    rum.allow_headers: {{rum_allow_headers}}
+    rum.library_pattern: {{rum_library_pattern}}
+    rum.exclude_from_grouping: {{rum_exclude_from_grouping}}
+    rum.response_headers: {{rum_response_headers}}
+    rum.event_rate.limit: {{rum_event_rate_limit}}
+    rum.event_rate.lru_size: {{rum_event_rate_lru_size}}
+queue.mem.events: {{queue_mem_events}}
+queue.mem.flush.min_events: {{queue_mem_flush_min_events}}
+queue.mem.flush.timeout: {{queue_mem_flush_timeout}}
diff --git a/apmpackage/apm/0.1.0/manifest.yml b/apmpackage/apm/0.1.0/manifest.yml
index 88e5510532d..a752b4f4aa8 100644
--- a/apmpackage/apm/0.1.0/manifest.yml
+++ b/apmpackage/apm/0.1.0/manifest.yml
@@ -35,12 +35,94 @@ policy_templates:
         title: Secret token
         required: false
         show_user: true
+      - name: api_key_enabled
+        type: bool
+        title: Enable API Key Auth from APM Agents
+        required: false
+        show_user: true
+        default: false
       - name: enable_rum
         type: bool
         title: Enable RUM
         required: true
         show_user: true
         default: false
+      - name: api_key_limit
+        type: int
+        title: Maximum number of allowed API Keys
+        required: false
+        show_user: false
+        default: 100
+      - name: capture_personal_data
+        type: bool
+        title: Capture Personal Data (e.g. IP, User Agent)
+        required: false
+        show_user: false
+        default: true
+      - name: rum_allow_origins
+        type: string
+        title: RUM - Allow Origins
+        multi: true
+        required: false
+        show_user: false
+        default: ['*']
+      - name: rum_allow_headers
+        type: string
+        title: RUM - Access-Control-Allow-Headers
+        multi: true
+        required: false
+        show_user: false
+      - name: rum_library_pattern
+        type: string
+        title: RUM - pattern identifying library frames
+        required: false
+        show_user: false
+      - name: rum_exclude_from_grouping
+        type: string
+        title: RUM - pattern excluding frames from grouping
+        required: false
+        show_user: false
+      - name: rum_response_headers
+        type: yaml
+        title: RUM - Custom Response Headers
+        required: false
+        show_user: false
+      - name: rum_event_rate_limit
+        type: int
+        title: RUM - Maximum events per IP per second
+        required: false
+        show_user: false
+        default: 300
+      - name: rum_event_rate_lru_size
+        type: int
+        title: RUM - Cache size (unique IPs)
+        required: false
+        show_user: false
+        default: 1000
+      - name: queue_mem_events
+        type: int
+        title: In-Memory buffer capacity (number of events)
+        required: false
+        show_user: false
+        default: 4096   
+      - name: queue_mem_flush_min_events
+        type: int
+        title: In-Memory buffer flush batch size (number of events)
+        required: false
+        show_user: false
+        default: 2048   
+      - name: queue_mem_flush_timeout
+        type: string
+        title: In-Memory buffer flush timeout
+        required: false
+        show_user: false
+        default: '1s'   
+      - name: max_event_bytes
+        type: int
+        title: Maximum size per event (bytes)
+        required: false
+        show_user: false
+        default: 307200   
     template_path: template.yml.hbs
 owner:
   github: elastic/apm-server