From 00ecfbee13f2c52f033e91690dae0466a14ed877 Mon Sep 17 00:00:00 2001 From: TeoV Date: Tue, 15 Sep 2020 18:01:51 +0300 Subject: [PATCH] Add FilePath metric in EventExporter --- ees/filecsv.go | 8 ++++++-- ees/filefwv.go | 8 ++++++-- utils/consts.go | 1 + 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ees/filecsv.go b/ees/filecsv.go index ee4ed2bf1..30c49c018 100644 --- a/ees/filecsv.go +++ b/ees/filecsv.go @@ -55,8 +55,12 @@ type FileCSVee struct { // init will create all the necessary dependencies, including opening the file func (fCsv *FileCSVee) init() (err error) { // create the file - if fCsv.file, err = os.Create(path.Join(fCsv.cgrCfg.EEsCfg().Exporters[fCsv.cfgIdx].ExportPath, - fCsv.id+utils.Underline+utils.UUIDSha1Prefix()+utils.CSVSuffix)); err != nil { + filePath := path.Join(fCsv.cgrCfg.EEsCfg().Exporters[fCsv.cfgIdx].ExportPath, + fCsv.id+utils.Underline+utils.UUIDSha1Prefix()+utils.CSVSuffix) + fCsv.Lock() + fCsv.dc[utils.FilePath] = filePath + fCsv.Unlock() + if fCsv.file, err = os.Create(filePath); err != nil { return } fCsv.csvWriter = csv.NewWriter(fCsv.file) diff --git a/ees/filefwv.go b/ees/filefwv.go index 66fec8b56..124449200 100644 --- a/ees/filefwv.go +++ b/ees/filefwv.go @@ -51,9 +51,13 @@ type FileFWVee struct { // init will create all the necessary dependencies, including opening the file func (fFwv *FileFWVee) init() (err error) { + filePath := path.Join(fFwv.cgrCfg.EEsCfg().Exporters[fFwv.cfgIdx].ExportPath, + fFwv.id+utils.Underline+utils.UUIDSha1Prefix()+utils.FWVSuffix) + fFwv.Lock() + fFwv.dc[utils.FilePath] = filePath + fFwv.Unlock() // create the file - if fFwv.file, err = os.Create(path.Join(fFwv.cgrCfg.EEsCfg().Exporters[fFwv.cfgIdx].ExportPath, - fFwv.id+utils.Underline+utils.UUIDSha1Prefix()+utils.FWVSuffix)); err != nil { + if fFwv.file, err = os.Create(filePath); err != nil { return } return fFwv.composeHeader() diff --git a/utils/consts.go b/utils/consts.go index 73b32818e..179a28b7b 100755 --- a/utils/consts.go +++ b/utils/consts.go @@ -2335,6 +2335,7 @@ const ( TotalSMSUsage = "TotalSMSUsage" TotalMMSUsage = "TotalMMSUsage" TotalGenericUsage = "TotalGenericUsage" + FilePath = "FilePath" ) // Event Opts