From d20d537c4630aae07832537fafe497f75d1b924f Mon Sep 17 00:00:00 2001 From: Julian Gruber Date: Mon, 22 May 2023 11:33:55 +0200 Subject: [PATCH 1/2] telemetry: add tag `running_in_station_desktop` --- lib/telemetry.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/telemetry.js b/lib/telemetry.js index 78ba637b..4f6ef6a0 100644 --- a/lib/telemetry.js +++ b/lib/telemetry.js @@ -7,7 +7,7 @@ const assert = require('node:assert') const { platform, arch } = require('node:os') const pkg = require('../package.json') -const { FIL_WALLET_ADDRESS } = process.env +const { FIL_WALLET_ADDRESS, RUNNING_IN_STATION_DESKTOP } = process.env const client = new InfluxDB({ url: 'https://eu-central-1-1.aws.cloud2.influxdata.com', @@ -47,6 +47,10 @@ const startPingLoop = () => { point.tag('station', 'core') point.tag('platform', platform()) point.tag('arch', arch()) + point.tag( + 'running_in_station_desktop', + String(['1', 'true'].includes(RUNNING_IN_STATION_DESKTOP)) + ) writeClient.writePoint(point) }, 10_000) } From f2e5b90ca32cfdabef4452df8232ce4bb6f751b0 Mon Sep 17 00:00:00 2001 From: Julian Gruber Date: Tue, 23 May 2023 10:21:42 +0200 Subject: [PATCH 2/2] change to `DEPLOYMENT_TYPE` --- Dockerfile | 1 + lib/telemetry.js | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 148e685a..a6901e77 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,4 +4,5 @@ USER node WORKDIR /usr/src/app COPY . . RUN npm ci --omit=dev +ENV DEPLOYMENT_TYPE=docker CMD [ "./bin/station.js" ] diff --git a/lib/telemetry.js b/lib/telemetry.js index 2b759ec8..e8b1b8a9 100644 --- a/lib/telemetry.js +++ b/lib/telemetry.js @@ -7,7 +7,13 @@ const assert = require('node:assert') const { platform, arch } = require('node:os') const pkg = require('../package.json') -const { FIL_WALLET_ADDRESS, RUNNING_IN_STATION_DESKTOP } = process.env +const { FIL_WALLET_ADDRESS, DEPLOYMENT_TYPE = 'cli' } = process.env + +const validDeploymentTypes = ['cli', 'docker', 'station-desktop'] +assert( + validDeploymentTypes.includes(DEPLOYMENT_TYPE), + `Invalid DEPLOYMENT_TYPE: ${DEPLOYMENT_TYPE}. Options: ${validDeploymentTypes.join(', ')}` +) const client = new InfluxDB({ url: 'https://eu-central-1-1.aws.cloud2.influxdata.com', @@ -49,10 +55,7 @@ const startPingLoop = () => { point.tag('station', 'core') point.tag('platform', platform()) point.tag('arch', arch()) - point.tag( - 'running_in_station_desktop', - String(['1', 'true'].includes(RUNNING_IN_STATION_DESKTOP)) - ) + point.tag('deployment_type', DEPLOYMENT_TYPE) writeClient.writePoint(point) }, 10_000) }