RIC-710: Adding E2T counters to Vespa-Manager 20/5920/1
authordhiraj <dhiraj.verma@nokia.com>
Wed, 21 Apr 2021 15:07:26 +0000 (18:07 +0300)
committerdhiraj <dhiraj.verma@nokia.com>
Wed, 21 Apr 2021 15:10:06 +0000 (18:10 +0300)
Change-Id: Ifc522bfca7b610860beac1dab1a757c4d22ceeb8
Signed-off-by: dhiraj <dhiraj.verma@nokia.com>
Dockerfile
cmd/vespamgr/config.go
config/config-file.json
config/plt-counter.json [new file with mode: 0644]

index f91f7ed..168359b 100755 (executable)
@@ -55,7 +55,7 @@ COPY --from=gobuild /root/go/bin /root/go/bin
 COPY --from=gobuild /root/go/bin/vespamgr /usr/local/bin/vesmgr
 COPY --from=gobuild /root/go/bin/vespamgr /vespamgr
 COPY --from=gobuild /go/src/vespamgr/config/* /cfg/
-
+COPY --from=gobuild /go/src/vespamgr/config/plt-counter.json /cfg/plt-counter.json
 RUN ldconfig
 
 ENV CFG_FILE=/cfg/config-file.json
index a62b3a4..12079ba 100755 (executable)
@@ -196,6 +196,17 @@ func (v *VespaMgr) GetRules(vespaconf *VESAgentConfiguration, xAppConfig []byte)
                        metrics = v.ParseMetricsFromDescriptor(pltConfig, metrics)
                }
        }
+    
+       // Adding Platform Counters
+       pltCounterFile :=  app.Config.GetString("controls.pltCounterFile")
+       bytes, err := ioutil.ReadFile(pltCounterFile)
+       if err != nil{
+               app.Logger.Error("Platform Matrices Configuration File not found")
+       } else {
+
+               metrics = v.ParseMetricsFromDescriptor(bytes,metrics)
+       }
+       
 
        vespaconf.Measurement.Prometheus.Rules.Metrics = make([]MetricRule, 0, len(metrics))
        for key, value := range metrics {
@@ -220,10 +231,12 @@ func (v *VespaMgr) GetCollectorConfiguration(vespaconf *VESAgentConfiguration) {
 }
 
 func (v *VespaMgr) CreateConfig(writer io.Writer, xAppStatus []byte) {
+
+       
        vespaconf := v.BasicVespaConf()
        v.GetRules(&vespaconf, xAppStatus)
        v.GetCollectorConfiguration(&vespaconf)
-
+    
        err := yaml.NewEncoder(writer).Encode(vespaconf)
        if err != nil {
                app.Logger.Error("Cannot write vespa conf file: %s", err.Error())
@@ -231,3 +244,4 @@ func (v *VespaMgr) CreateConfig(writer io.Writer, xAppStatus []byte) {
        }
        app.Logger.Info("Config file written to: %s", app.Config.GetString("controls.vesagent.configFile"))
 }
+
index 455cf8f..5627e86 100755 (executable)
@@ -55,6 +55,7 @@
         "host": "http://service-ricplt-vespamgr-http.ricplt.svc.cluster.local:8080",
         "measurementUrl": "/ric/v1/measurements",
         "pltFile": "/tmp/vespa-plt-meas.json",
+        "pltCounterFile": "/cfg/plt-counter.json",
         "appManager": {
             "host": "http://service-ricplt-appmgr-http.ricplt.svc.cluster.local:8080",
             "path": "/ric/v1/config",
@@ -72,7 +73,7 @@
         "collector": {
             "primaryAddr": "pod-ves-simulator",
             "secondaryAddr": "pod-ves-simulator",
-            "serverRoot": "0",
+            "serverRoot": "",
             "primaryPort": 8443,
             "primaryUser": "sample1",
             "primaryPassword": "sample1",
@@ -81,4 +82,4 @@
     },
     "faults": { },
     "metrics": []
-}
\ No newline at end of file
+}
diff --git a/config/plt-counter.json b/config/plt-counter.json
new file mode 100644 (file)
index 0000000..339cdce
--- /dev/null
@@ -0,0 +1,58 @@
+[
+    {
+        "metadata": { },
+        "descriptor": { },
+        "config": {
+            "local": {
+                "host": ":8080"
+            },
+            "logger": {
+                "level": 5
+            },
+            "measurements": [
+                {
+                    "moId": "SEP-12/XAPP-1",
+                    "measType": "X2",
+                    "measId": "9001",
+                    "measInterval": "60",
+                    "metrics": [
+                        {
+                            "name": "exposer_transferred_bytes_total",
+                            "objectName": "exposer_transferred_bytes_total",
+                            "objectInstance": "exposer_transferred_bytes_total",
+                            "counterId": "0011",
+                            "type": "counter",
+                            "description": "exposer_transferred_bytes_total"
+                        },
+                        {
+                            "name": "exposer_scrapes_total",
+                            "objectName": "exposer_scrapes_total",
+                            "objectInstance": "exposer_scrapes_total",
+                            "counterId": "0012",
+                            "type": "counter",
+                            "description": "exposer_scrapes_total"
+                        },
+                        {
+                            "name": "exposer_request_latencies_count",
+                            "objectName": "exposer_request_latencies_count",
+                            "objectInstance": "exposer_request_latencies_count",
+                            "counterId": "0013",
+                            "type": "counter",
+                            "description": "exposer_request_latencies_count"
+                        },
+                        {
+                            "name": "exposer_request_latencies_sum",
+                            "objectName": "exposer_request_latencies_sum",
+                            "objectInstance": "exposer_request_latencies_sum",
+                            "counterId": "0014",
+                            "type": "counter",
+                            "description": "exposer_request_latencies_sum"
+                        }
+                    ]
+                }
+            ]
+        }
+    }
+    
+]
+