From 0f56fcc7b9787bc580e5a88d6f9e0dabfcfd2815 Mon Sep 17 00:00:00 2001
From: Patrick Godwin <patrick.godwin@ligo.org>
Date: Fri, 8 Mar 2019 06:58:20 -0800
Subject: [PATCH] gstlal_feature_aggregator: update tags in snr measurement to
 store subsystem information as well

---
 gstlal-burst/bin/gstlal_feature_aggregator | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/gstlal-burst/bin/gstlal_feature_aggregator b/gstlal-burst/bin/gstlal_feature_aggregator
index 30fe6903a5..aff27803a0 100755
--- a/gstlal-burst/bin/gstlal_feature_aggregator
+++ b/gstlal-burst/bin/gstlal_feature_aggregator
@@ -127,7 +127,7 @@ class StreamAggregator(object):
 
         ### define measurements to be stored from aggregators
         self.agg_sink.register_schema('latency', columns='data', column_key='data', tags='job', tag_key='job')
-        self.agg_sink.register_schema('snr', columns='data', column_key='data', tags='channel', tag_key='channel')
+        self.agg_sink.register_schema('snr', columns='data', column_key='data', tags=('channel', 'subsystem'), tag_key='channel')
 
     def fetch_data(self, job_consumer):
         """
@@ -170,7 +170,7 @@ class StreamAggregator(object):
             self.agg_sink.store_columns('latency', metric_data, aggregate=self.data_type)
 
             ### store and aggregate features
-            timeseries_data = {channel: {'time': timeseries['trigger_time'], 'fields': {'data': timeseries['snr']}} for channel, timeseries in all_timeseries.items()}
+            timeseries_data = {(channel, self._channel_to_subsystem(channel)): {'time': timeseries['trigger_time'], 'fields': {'data': timeseries['snr']}} for channel, timeseries in all_timeseries.items()}
             self.agg_sink.store_columns('snr', timeseries_data, aggregate=self.data_type)
 
             try:
@@ -222,6 +222,13 @@ class StreamAggregator(object):
         logger.info('shutting down feature aggregator...')
         self.is_running = False
 
+    @staticmethod
+    def _channel_to_subsystem(channel):
+        """
+        given a channel, returns the subsystem the channel lives in
+        """
+        return channel.split(':')[1].split('-')[0]
+
 class SignalHandler(object):
     """
     helper class to shut down the stream aggregator gracefully before exiting
-- 
GitLab