diff --git a/README.md b/README.md index 6a2240d..2754b99 100644 --- a/README.md +++ b/README.md @@ -7,14 +7,14 @@ This is a quick start demo for [GreptimeCloud](https://greptime.cloud/). It coll Use the following command line to start sending metrics without cloning the project: ```shell -npx greptime-cloud-quick-start --host= --db= --username= --password= +npx greptime-cloud-quick-start --endpoint= --db= --username= --password= ``` Or clone the project and run the following command line: ```shell npm install -npx ts-node app.ts --host= --db= --username= --password= +npx ts-node app.ts --endpoint= --db= --username= --password= ``` ## npm-publish diff --git a/app.js b/app.js index 1041b60..00ede63 100755 --- a/app.js +++ b/app.js @@ -13,20 +13,20 @@ function main() { const db = argv.db || 'public'; const username = argv.username; const password = argv.password; - const secure = argv.secure; + const endpoint = argv.endpoint; const port = argv.port; var url = ''; - if (secure) { - url = `https://`; + if (endpoint != '') { + url = endpoint; } else { - url = `http://`; - } - url += `${dbHost}`; - if (port) { - url += `:${port}`; + url = `https://`; + url += `${dbHost}`; + if (port) { + url += `:${port}`; + } + url += `/v1/otlp/v1/metrics`; } - url += `/v1/otlp/v1/metrics`; const auth = Buffer.from(`${username}:${password}`).toString('base64'); const metricReader = new sdk_metrics_1.PeriodicExportingMetricReader({ exporter: new exporter_metrics_otlp_proto_1.OTLPMetricExporter({ diff --git a/app.ts b/app.ts index 034dc0e..5962954 100755 --- a/app.ts +++ b/app.ts @@ -14,24 +14,21 @@ function main() { const db = argv.db || 'public' const username = argv.username const password = argv.password - const secure = argv.secure + const endpoint = argv.endpoint const port = argv.port - + var url = '' - if (secure) { - url = `https://` + if (endpoint != '') { + url = endpoint } else { - url = `http://` + url = `https://` + url += `${dbHost}` + if (port) { + url += `:${port}` + } + url += `/v1/otlp/v1/metrics` } - url += `${dbHost}` - - if (port) { - url += `:${port}` - } - - url += `/v1/otlp/v1/metrics` - const auth = Buffer.from(`${username}:${password}`).toString('base64') const metricReader = new PeriodicExportingMetricReader({ exporter: new OTLPMetricExporter({