mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -05:00
Update readme and log telemetry data
This commit is contained in:
parent
81e34f9943
commit
82b3e26bd3
4 changed files with 16 additions and 1 deletions
|
|
@ -17,7 +17,7 @@ Data being sent:
|
||||||
|
|
||||||
- Number of DAU (Daily Active Users)
|
- Number of DAU (Daily Active Users)
|
||||||
- App version
|
- App version
|
||||||
- Instance ID
|
- Instance ID (unique identifier of the Dawarich instance built by hashing the api key of the first user in the database)
|
||||||
|
|
||||||
The data is being sent to a InfluxDB instance hosted by me and won't be shared with anyone.
|
The data is being sent to a InfluxDB instance hosted by me and won't be shared with anyone.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ class TelemetrySendingJob < ApplicationJob
|
||||||
return if ENV['DISABLE_TELEMETRY'] == 'true'
|
return if ENV['DISABLE_TELEMETRY'] == 'true'
|
||||||
|
|
||||||
data = Telemetry::Gather.new.call
|
data = Telemetry::Gather.new.call
|
||||||
|
Rails.logger.info("Telemetry data: #{data}")
|
||||||
|
|
||||||
Telemetry::Send.new(data).call
|
Telemetry::Send.new(data).call
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ class Telemetry::Send
|
||||||
end
|
end
|
||||||
|
|
||||||
def call
|
def call
|
||||||
|
return if ENV['DISABLE_TELEMETRY'] == 'true'
|
||||||
|
|
||||||
line_protocol = build_line_protocol
|
line_protocol = build_line_protocol
|
||||||
response = send_request(line_protocol)
|
response = send_request(line_protocol)
|
||||||
handle_response(response)
|
handle_response(response)
|
||||||
|
|
|
||||||
|
|
@ -21,5 +21,17 @@ RSpec.describe TelemetrySendingJob, type: :job do
|
||||||
expect(gather_service).to have_received(:call)
|
expect(gather_service).to have_received(:call)
|
||||||
expect(send_service).to have_received(:call)
|
expect(send_service).to have_received(:call)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when DISABLE_TELEMETRY is set to true' do
|
||||||
|
before do
|
||||||
|
stub_const('ENV', ENV.to_h.merge('DISABLE_TELEMETRY' => 'true'))
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not send telemetry data' do
|
||||||
|
described_class.perform_now
|
||||||
|
|
||||||
|
expect(send_service).not_to have_received(:call)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue