Add 'region' field to the InfluxDB tags if present

Change-Id: I81177119ca01769d5ae4b322158e400d9b0d2e90
diff --git a/heka/map.jinja b/heka/map.jinja
index 2983362..2aaefc9 100644
--- a/heka/map.jinja
+++ b/heka/map.jinja
@@ -33,6 +33,7 @@
 {% set default_elasticsearch_port = 9200 %}
 {% set default_influxdb_port = 8086 %}
 {% set default_influxdb_time_precision = 'ms' %}
+{% set default_influxdb_tag_fields = ['environment_label', 'region', 'tenant_id', 'user_id'] %}
 {% set default_influxdb_timeout = 5000 %}
 {% set default_aggregator_port = 5565 %}
 {% set default_nagios_port = 8001 %}
@@ -57,6 +58,7 @@
     'influxdb_port': default_influxdb_port,
     'influxdb_time_precision': default_influxdb_time_precision,
     'influxdb_timeout': default_influxdb_timeout,
+    'influxdb_tag_fields': default_influxdb_tag_fields,
     'aggregator_port': default_aggregator_port,
     'nagios_port': default_nagios_port,
     'poolsize': 100,
@@ -73,6 +75,7 @@
     'influxdb_port': default_influxdb_port,
     'influxdb_time_precision': default_influxdb_time_precision,
     'influxdb_timeout': default_influxdb_timeout,
+    'influxdb_tag_fields': default_influxdb_tag_fields,
     'aggregator_port': default_aggregator_port,
     'poolsize': 100,
     'automatic_starting': default_automatic_starting,
@@ -85,6 +88,7 @@
     'influxdb_port': default_influxdb_port,
     'influxdb_time_precision': default_influxdb_time_precision,
     'influxdb_timeout': default_influxdb_timeout,
+    'influxdb_tag_fields': default_influxdb_tag_fields,
     'nagios_port': default_nagios_port,
     'nagios_default_host_alarm_clusters': default_nagios_host_alarm_clusters,
     'poolsize': 100,
diff --git a/heka/meta/heka.yml b/heka/meta/heka.yml
index 1b2a3ca..be05ce0 100644
--- a/heka/meta/heka.yml
+++ b/heka/meta/heka.yml
@@ -144,7 +144,7 @@
       message_matcher: "Type =~ /metric$/"
       ticker_interval: 1
       config:
-        tag_fields: "deployment_id environment_label tenant_id user_id"
+        tag_fields: "{{ metric_collector.influxdb_tag_fields|join(' ') }}"
         time_precision: "{{ metric_collector.influxdb_time_precision }}"
 {%- endif %}
 {%- endif %}
@@ -283,7 +283,7 @@
       message_matcher: "Type =~ /metric$/"
       ticker_interval: 1
       config:
-        tag_fields: "deployment_id environment_label tenant_id user_id"
+        tag_fields: "{{ remote_collector.influxdb_tag_fields|join(' ') }}"
         time_precision: "{{ remote_collector.influxdb_time_precision }}"
   {%- endif %}
   {%- if remote_collector.amqp_host is defined %}
@@ -542,7 +542,7 @@
       message_matcher: "Type == 'heka.sandbox.gse_metric' || Type == 'heka.sandbox.metric'"
       ticker_interval: 1
       config:
-        tag_fields: "deployment_id environment_label tenant_id user_id"
+        tag_fields: "{{ aggregator.influxdb_tag_fields|join(' ') }}"
         time_precision: "{{ aggregator.influxdb_time_precision }}"
     influxdb_annotation:
       engine: sandbox