@jambonz/time-series 0.2.8 → 0.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,6 +12,11 @@ jobs:
12
12
  - uses: actions/setup-node@v1
13
13
  with:
14
14
  node-version: 12
15
+ - name: Install Docker Compose
16
+ run: |
17
+ sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
18
+ sudo chmod +x /usr/local/bin/docker-compose
19
+ docker-compose --version
15
20
  - run: npm install
16
21
  - run: npm run jslint
17
22
  - run: npm test
package/index.js CHANGED
@@ -29,6 +29,7 @@ const schemas = {
29
29
  from: Influx.FieldType.STRING,
30
30
  to: Influx.FieldType.STRING,
31
31
  sip_callid: Influx.FieldType.STRING,
32
+ sip_parent_callid: Influx.FieldType.STRING,
32
33
  sip_status: Influx.FieldType.INTEGER,
33
34
  duration: Influx.FieldType.INTEGER,
34
35
  terminated_at: Influx.FieldType.INTEGER,
@@ -55,7 +56,8 @@ const schemas = {
55
56
  tags: [
56
57
  'service_provider_sid',
57
58
  'account_sid',
58
- 'alert_type'
59
+ 'alert_type',
60
+ 'vendor'
59
61
  ]
60
62
  },
61
63
  call_counts: {
@@ -643,7 +645,8 @@ const writeAlerts = async(client, alerts) => {
643
645
  }
644
646
  let fields = { message };
645
647
  if (target_sid) fields = Object.assign(fields, {target_sid});
646
- const obj = {measurement: 'alerts', fields: fields, tags: { alert_type, service_provider_sid, account_sid }};
648
+ const obj = {measurement: 'alerts', fields: fields, tags: { alert_type, service_provider_sid, account_sid,
649
+ ...(vendor && {vendor})}};
647
650
  if (timestamp) obj.timestamp = timestamp;
648
651
  if (detail) obj.fields.detail = detail;
649
652
  return obj;
@@ -732,7 +735,7 @@ module.exports = (logger, opts) => {
732
735
  if (typeof opts === 'string') opts = {host: opts};
733
736
  assert(opts.host);
734
737
 
735
- const cdrClient = new Influx.InfluxDB({database: 'cdrs', schemas: schemas.cdr, ...opts});
738
+ const cdrClient = new Influx.InfluxDB({database: 'cdrs', schemas: schemas.cdrs, ...opts});
736
739
  const alertClient = new Influx.InfluxDB({database: 'alerts', schemas: schemas.alerts, ...opts});
737
740
  const callCountClient = new Influx.InfluxDB({database: 'call_counts', schemas: schemas.call_counts, ...opts});
738
741
  const callCountSPClient = new Influx.InfluxDB({database: 'sp_call_counts', schemas: schemas.sp_call_counts, ...opts});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jambonz/time-series",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "description": "write and query data to time series daetabase",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -23,6 +23,7 @@ test('write timeseries data', async(t) => {
23
23
  from: 'me',
24
24
  to: 'you',
25
25
  sip_callid: 'foo@127.0.0.1',
26
+ sip_parent_callid: 'foo2@127.0.0.1',
26
27
  answered: true,
27
28
  duration: 22,
28
29
  attempted_at: new Date(Date.now() - (3600 * 1000)),
@@ -41,6 +42,7 @@ test('write timeseries data', async(t) => {
41
42
  from: 'me2',
42
43
  to: 'you2',
43
44
  sip_callid: 'foo@127.0.0.1',
45
+ sip_parent_callid: 'foo2@127.0.0.1',
44
46
  answered: false,
45
47
  duration: 20,
46
48
  attempted_at: new Date(Date.now() - (7200 * 1000)),
@@ -61,6 +63,7 @@ test('write timeseries data', async(t) => {
61
63
  result = await queryCdrs({account_sid: 'xxxx', page: 1, page_size:25});
62
64
  //console.log(JSON.stringify(result));
63
65
  t.ok(result.data.length === 1, 'queried cdrs by account sid');
66
+ t.ok(result.data[0].sip_parent_callid === 'foo2@127.0.0.1', 'sip_parent_callid successfully added');
64
67
 
65
68
  result = await queryCdrs({account_sid: 'xxxx', filter: 'a', page: 1, page_size:25});
66
69
  t.ok(result.data.length === 0, 'queried cdrs by from');