Browse Source

Set region in metric meta from config file

- set region in 'meta' section of aggregated
  metric from config file.

Change-Id: I82b00e9d88704835537cfd0285678b94bcc0f3a8
Ashwin Agate 1 year ago
parent
commit
3589dd0820

+ 1
- 0
etc/monasca-transform.conf View File

@@ -17,6 +17,7 @@ adapter = monasca_transform.messaging.adapter:KafkaMessageAdapter
17 17
 topic = metrics
18 18
 brokers = localhost:9092
19 19
 publish_kafka_project_id = d2cb21079930415a9f2a33588b9f2bb6
20
+publish_region = useast
20 21
 adapter_pre_hourly = monasca_transform.messaging.adapter:KafkaMessageAdapterPreHourly
21 22
 topic_pre_hourly = metrics_pre_hourly
22 23
 

+ 1
- 1
monasca_transform/component/insert/__init__.py View File

@@ -95,7 +95,7 @@ class InsertComponent(Component):
95 95
         # proper/valid tenant ID, aggregated metrics don't get persisted
96 96
         # to the Monasca DB.
97 97
         meta_part["tenantId"] = cfg.CONF.messaging.publish_kafka_project_id
98
-        meta_part["region"] = "useast"
98
+        meta_part["region"] = cfg.CONF.messaging.publish_region
99 99
 
100 100
         value_meta_part = {"record_count": instance_usage_dict.get(
101 101
                            "record_count", 0),

+ 3
- 0
monasca_transform/config/config_initializer.py View File

@@ -84,6 +84,9 @@ class ConfigInitializer(object):
84 84
             cfg.StrOpt('publish_kafka_project_id',
85 85
                        default='111111',
86 86
                        help='publish aggregated metrics tenant'),
87
+            cfg.StrOpt('publish_region',
88
+                       default='useast',
89
+                       help='publish aggregated metrics region'),
87 90
             cfg.StrOpt('adapter_pre_hourly',
88 91
                        default='monasca_transform.messaging.adapter:'
89 92
                        'KafkaMessageAdapterPreHourly',

Loading…
Cancel
Save