Skip to content

Commit

Permalink
feat/836: added vendor to the tags for writeAlerts (#9)
Browse files Browse the repository at this point in the history
* feat/836: added vendor to the tags for writeAlerts

* feat/836: sending vendor if only the value exist
  • Loading branch information
rammohanyadavalli authored Jul 31, 2024
1 parent efa5c75 commit 60131f8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ const schemas = {
tags: [
'service_provider_sid',
'account_sid',
'alert_type'
'alert_type',
'vendor'
]
},
call_counts: {
Expand Down Expand Up @@ -643,7 +644,8 @@ const writeAlerts = async(client, alerts) => {
}
let fields = { message };
if (target_sid) fields = Object.assign(fields, {target_sid});
const obj = {measurement: 'alerts', fields: fields, tags: { alert_type, service_provider_sid, account_sid }};
const obj = {measurement: 'alerts', fields: fields, tags: { alert_type, service_provider_sid, account_sid,
...(vendor && {vendor})}};
if (timestamp) obj.timestamp = timestamp;
if (detail) obj.fields.detail = detail;
return obj;
Expand Down

0 comments on commit 60131f8

Please sign in to comment.