Add FilePath metric in EventExporter

This commit is contained in:
TeoV
2020-09-15 18:01:51 +03:00
committed by Dan Christian Bogos
parent 7694a4ef42
commit 00ecfbee13
3 changed files with 13 additions and 4 deletions

View File

@@ -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)

View File

@@ -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()

View File

@@ -2335,6 +2335,7 @@ const (
TotalSMSUsage = "TotalSMSUsage"
TotalMMSUsage = "TotalMMSUsage"
TotalGenericUsage = "TotalGenericUsage"
FilePath = "FilePath"
)
// Event Opts