Disable telemetry by default

This commit is contained in:
Eugene Burmakin 2024-12-11 14:53:07 +01:00
parent 463e8e6d9b
commit 4bb39a2bbd
5 changed files with 21 additions and 16 deletions

View file

@ -24,6 +24,8 @@ To change this, you need to update the `docker-compose.yml` file:
healthcheck:
```
Telemetry is now disabled by default. To enable it, you need to set `ENABLE_TELEMETRY` env var to `true`. For those who have telemetry enabled using `DISABLE_TELEMETRY` env var set to `false`, telemetry is now disabled by default.
### Fixed
- Flash messages are now being removed after 5 seconds.
@ -35,6 +37,7 @@ To change this, you need to update the `docker-compose.yml` file:
- Places page is now accessible from the Visits & Places tab on the navbar.
- Exporting process is now being logged.
- `ENABLE_TELEMETRY` env var is now used instead of `DISABLE_TELEMETRY` to enable/disable telemetry.
# 0.19.5 - 2024-12-10

View file

@ -4,7 +4,7 @@ class TelemetrySendingJob < ApplicationJob
queue_as :default
def perform
return if ENV['DISABLE_TELEMETRY'] == 'true'
return unless ENV['ENABLE_TELEMETRY'] == 'true'
data = Telemetry::Gather.new.call
Rails.logger.info("Telemetry data: #{data}")

View file

@ -9,7 +9,7 @@ class Telemetry::Send
end
def call
return if ENV['DISABLE_TELEMETRY'] == 'true'
return unless ENV['ENABLE_TELEMETRY'] == 'true'
line_protocol = build_line_protocol
response = send_request(line_protocol)

View file

@ -69,7 +69,7 @@ services:
PROMETHEUS_EXPORTER_ENABLED: false
PROMETHEUS_EXPORTER_HOST: 0.0.0.0
PROMETHEUS_EXPORTER_PORT: 9394
DISABLE_TELEMETRY: false # More on telemetry: https://dawarich.app/docs/tutorials/telemetry
ENABLE_TELEMETRY: false # More on telemetry: https://dawarich.app/docs/tutorials/telemetry
logging:
driver: "json-file"
options:
@ -124,7 +124,7 @@ services:
PROMETHEUS_EXPORTER_ENABLED: false
PROMETHEUS_EXPORTER_HOST: dawarich_app
PROMETHEUS_EXPORTER_PORT: 9394
DISABLE_TELEMETRY: false # More on telemetry: https://dawarich.app/docs/tutorials/telemetry
ENABLE_TELEMETRY: false # More on telemetry: https://dawarich.app/docs/tutorials/telemetry
logging:
driver: "json-file"
options:

View file

@ -15,23 +15,25 @@ RSpec.describe TelemetrySendingJob, type: :job do
allow(send_service).to receive(:call)
end
it 'gathers telemetry data and sends it' do
described_class.perform_now
expect(gather_service).to have_received(:call)
expect(send_service).to have_received(:call)
end
context 'when DISABLE_TELEMETRY is set to true' do
before do
stub_const('ENV', ENV.to_h.merge('DISABLE_TELEMETRY' => 'true'))
end
context 'with default env' do
it 'does not send telemetry data' do
described_class.perform_now
expect(send_service).not_to have_received(:call)
end
end
context 'when ENABLE_TELEMETRY is set to true' do
before do
stub_const('ENV', ENV.to_h.merge('ENABLE_TELEMETRY' => 'true'))
end
it 'gathers telemetry data and sends it' do
described_class.perform_now
expect(gather_service).to have_received(:call)
expect(send_service).to have_received(:call)
end
end
end
end