Skip to content

Commit

Permalink
Merge pull request #19 from vs4vijay/feature-identifier
Browse files Browse the repository at this point in the history
Make identifier field optional and put default value
  • Loading branch information
vs4vijay committed Apr 20, 2021
2 parents b7f01a4 + 52a5dbe commit 1929ff4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,16 @@ newman run https://www.getpostman.com/collections/631643-f695cab7-6878-eb55-7943
--- | ---
`--reporter-influxdb-server` | IP Address or Host of InfluxDB
`--reporter-influxdb-port` | Port no. (Usually `8086`)
`--reporter-influxdb-version` | InfluxDB Version (default `1`)
`--reporter-influxdb-version` | InfluxDB Version `1`, `2` (default `1`)
`--reporter-influxdb-org` | InfluxDB Org (For InfluxDB version 2.x)
`--reporter-influxdb-port` | Port no. (Usually `8086`)
`--reporter-influxdb-name` | Database name (or Bucket name for InfluxDB version 2.x)
`--reporter-influxdb-measurement` | Measurement Point name (If not provided, then reporter will create measurement with prefix `newman_results-<timestamp>`)
`--reporter-influxdb-username` (*Optional*) | Username created for InfluxDB (e.g. `newman_user`)
`--reporter-influxdb-password` (*Optional*) | Password of the user (e.g. `p@ssw0rd`)
`--reporter-influxdb-mode` | Transmission Mode `http`, `udp` (default: `http`)
`--reporter-debug` | Reporter debug mode (default: `false`)
`--reporter-influxdb-identifier` (*Optional*) | An identifier to be passed to InfluxDB (default: `run-${Date.now()}`)
`--reporter-influxdb-mode` | Transmission Mode `http`, `https`, `udp` (default: `http`)
`--reporter-debug` | Enable debug mode (default: `false`)

---

Expand All @@ -111,6 +112,7 @@ v2.0.0+ | v1.8, v2.x
- [x] Folder Structure
- [x] Username and Password support
- [x] Include UDP Reporter as well
- [x] HTTPS Support
- [ ] Add batch operation
- [ ] ESLint / StandardJS
- [x] CI/CD with Github Actions
Expand Down Expand Up @@ -203,4 +205,4 @@ docker run --name influxdb-1.7 -p 8086:8086 influxdb:1.7
docker run --name influxdb-1.8 -p 8086:8086 influxdb:1.8
docker run --name influxdb-2 -p 8086:8086 quay.io/influxdb/influxdb:v2.0.3
```
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "newman-reporter-influxdb",
"version": "2.0.3",
"version": "2.0.4",
"description": "Newman Reporter for InfluxDB",
"main": "index.js",
"scripts": {
Expand Down
10 changes: 3 additions & 7 deletions src/influxdb-reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ class InfluxDBReporter {
this.context.measurement = this.reporterOptions.influxdbMeasurement || this.reporterOptions.measurement;
this.context.username = this.reporterOptions.influxdbUsername || this.reporterOptions.username;
this.context.password = this.reporterOptions.influxdbPassword || this.reporterOptions.password;
this.context.mode = this.reporterOptions.influxdbMode || this.reporterOptions.mode;
this.context.identifier = this.reporterOptions.influxdbIdentifier || this.reporterOptions.identifier;
this.context.debug = this.reporterOptions.influxdbDebug || this.reporterOptions.debug || false;
this.context.debug = this.context.debug === 'true';
this.context.mode = this.reporterOptions.influxdbMode || this.reporterOptions.mode || 'http';
this.context.identifier = this.reporterOptions.influxdbIdentifier || this.reporterOptions.identifier || `run-${Date.now()}`;
this.context.debug = (this.reporterOptions.influxdbDebug || this.reporterOptions.debug) == 'true';

if (!this.context.server) {
throw new Error('[-] ERROR: InfluxDB Server Address is missing! Add --reporter-influxdb-server <server-address>.');
Expand All @@ -63,9 +62,6 @@ class InfluxDBReporter {
if (!this.context.measurement) {
throw new Error('[-] ERROR: InfluxDB Measurement Name is missing! Add --reporter-influxdb-measurement <measurement-name>.');
}
if (!this.context.mode) {
this.context.mode = 'http';
}
console.log(`[+] Starting collection: ${this.options.collection.name} ${this.context.id}`);

const DataService = this.context.mode === 'udp' ? UdpService : HttpService;
Expand Down

0 comments on commit 1929ff4

Please sign in to comment.