mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 01:01:39 -05:00
Fix test fixtures and add telemetry sending job
This commit is contained in:
parent
f095a7504c
commit
c8e910343c
7 changed files with 54 additions and 5 deletions
|
|
@ -1 +1 @@
|
|||
0.19.1
|
||||
0.19.2
|
||||
|
|
|
|||
22
CHANGELOG.md
22
CHANGELOG.md
|
|
@ -5,6 +5,28 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
# 0.19.2 - 2024-12-04
|
||||
|
||||
## The Telemetry release
|
||||
|
||||
Dawarich now can collect usage metrics and send them to InfluxDB. Before this release, the only metrics that could be somehow tracked by developers (only @Freika, as of now) were the number of stars on GitHub and the overall number of docker images being pulled, across all versions of Dawarich, non-splittable by version. New in-app telemetry will allow us to track more granular metrics, allowing me to make decisions based on facts, not just guesses.
|
||||
|
||||
I'm aware about the privacy concerns, so I want to be very transparent about what data is being sent and how it's used.
|
||||
|
||||
Data being sent:
|
||||
|
||||
- Number of DAU (Daily Active Users)
|
||||
- App version
|
||||
- Instance ID
|
||||
|
||||
Basically this set of metrics allows me to see how many people are using Dawarich and what versions they are using. No other data is being sent, nor it gives me any knowledge about individual users or their data or activity.
|
||||
|
||||
The telemetry is enabled by default, but it **can be disabled** by setting `DISABLE_TELEMETRY` env var to `true`. The dataset might change in the future, but any changes will be documented here in the changelog and in every release as well as on the [telemetry page](https://dawarich.app/docs/tutorials/telemetry) of the website docs.
|
||||
|
||||
### Added
|
||||
|
||||
- Telemetry feature. It's now collecting usage metrics and sending them to InfluxDB.
|
||||
|
||||
# 0.19.1 - 2024-12-04
|
||||
|
||||
### Fixed
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ class TelemetrySendingJob < ApplicationJob
|
|||
queue_as :default
|
||||
|
||||
def perform
|
||||
return if ENV['DISABLE_TELEMETRY'] == 'true'
|
||||
|
||||
data = Telemetry::Gather.new.call
|
||||
|
||||
Telemetry::Send.new(data).call
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
class User < ApplicationRecord
|
||||
# Include default devise modules. Others available are:
|
||||
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
||||
# :confirmable, :lockable, :timeoutable, and :omniauthable
|
||||
devise :database_authenticatable, :registerable,
|
||||
:recoverable, :rememberable, :validatable
|
||||
:recoverable, :rememberable, :validatable, :trackable
|
||||
|
||||
has_many :tracked_points, class_name: 'Point', dependent: :destroy
|
||||
has_many :imports, dependent: :destroy
|
||||
|
|
|
|||
|
|
@ -25,3 +25,8 @@ app_version_checking_job:
|
|||
cron: "0 */6 * * *" # every 6 hours
|
||||
class: "AppVersionCheckingJob"
|
||||
queue: default
|
||||
|
||||
telemetry_sending_job:
|
||||
cron: "0 */1 * * *" # every 1 hour
|
||||
class: "TelemetrySendingJob"
|
||||
queue: default
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,5 +1,25 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe TelemetrySendingJob, type: :job do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
describe '#perform' do
|
||||
let(:gather_service) { instance_double(Telemetry::Gather) }
|
||||
let(:send_service) { instance_double(Telemetry::Send) }
|
||||
let(:telemetry_data) { { some: 'data' } }
|
||||
|
||||
before do
|
||||
allow(Telemetry::Gather).to receive(:new).and_return(gather_service)
|
||||
allow(gather_service).to receive(:call).and_return(telemetry_data)
|
||||
allow(Telemetry::Send).to receive(:new).with(telemetry_data).and_return(send_service)
|
||||
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
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue