2 * Copyright (c) 2019 AT&T Intellectual Property.
3 * Copyright (c) 2018-2019 Nokia.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
26 func basicVespaConf() VESAgentConfiguration {
27 var vespaconf = VESAgentConfiguration {
30 PrimaryCollector: CollectorConfiguration {
35 Event: EventConfiguration {
36 VNFName: "vespa-demo", // XXX
37 ReportingEntityID: "1af5bfa9-40b4-4522-b045-40e54f0310f", // XXX
40 NfcNamingCodes: [] NfcNamingCode {
43 Vnfcs: [] string {"lr-ope-0","lr-ope-1","lr-ope-2"},
47 Vnfcs: [] string {"lr-pro-0","lr-pro-1"},
50 RetryInterval: time.Second * 5,
53 Measurement: MeasurementConfiguration {
54 DomainAbbreviation: "Mvfs",
55 MaxBufferingDuration: time.Hour,
56 Prometheus: PrometheusConfig {
57 Timeout: time.Second * 30,
58 KeepAlive: time.Second * 30,
60 DefaultValues: &MetricRule {
61 VMIDLabel: "'{{.labels.instance}}'",
70 func getRules(vespaconf *VESAgentConfiguration) {
72 makeRule := func(expr string, obj_name string, obj_instance string) MetricRule {
74 Target: "AdditionalObject",
76 ObjectInstance: obj_instance,
78 ObjectKeys: [] Label {
80 Name: "ricComponentName",
81 Expr: "'{{.labels.app_kubernetes_io_instance}}'",
87 vespaconf.Measurement.Prometheus.Rules.Metrics = []MetricRule {
88 makeRule("ricxapp_RMR_Received", "ricxappRMRreceivedCounter", "ricxappRMRReceived"),
89 makeRule("ricxapp_RMR_ReceiveError", "ricxappRMRReceiveErrorCounter", "ricxappRMRReceiveError"),
90 makeRule("ricxapp_RMR_Transmitted", "ricxappRMRTransmittedCounter", "ricxappRMRTransmitted"),
91 makeRule("ricxapp_RMR_TransmitError", "ricxappRMRTransmitErrorCounter", "ricxappRMRTransmitError"),
92 makeRule("ricxapp_SDL_Stored", "ricxappSDLStoredCounter", "ricxappSDLStored"),
93 makeRule("ricxapp_SDL_StoreError", "ricxappSDLStoreErrorCounter", "ricxappSDLStoreError"),
98 func createVespaConfig(writer io.Writer) {
99 vespaconf := basicVespaConf()
101 err := yaml.NewEncoder(writer).Encode(vespaconf)
103 logger.Error("Cannot write vespa conf file: %s", err.Error())