Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(analytics): migrate to grafana cloud #792

Merged
merged 4 commits into from
May 4, 2023
Merged

Conversation

Malinskiy
Copy link
Member

reason: GA is deprecated

notes: implementation is super simple via a single HTTP post request. All metrics are anonymized, behind a flag and turned on by default

ga is deprecated
implementation is super simple via a single http post request, all metrics are anonymized, behind a flag and turned on by default

class GrafanaCloud : UsageTracker {
private val client = OkHttpClient()
private val key =
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This key will end up in our sources anyways, don't see any reason to make it harder to extract

append(
events.map { event ->
when (event) {
is Event.Devices -> Metric(name = "testing.device", value = event.total, tags = tags)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

number of devices used

events.map { event ->
when (event) {
is Event.Devices -> Metric(name = "testing.device", value = event.total, tags = tags)
is Event.Executed -> Metric(name = "testing.duration", value = event.seconds, tags = tags)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

total duration of tests

when (event) {
is Event.Devices -> Metric(name = "testing.device", value = event.total, tags = tags)
is Event.Executed -> Metric(name = "testing.duration", value = event.seconds, tags = tags)
is Event.TestsTotal -> Metric(name = "testing.test", value = event.total, tags = tags)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

number of tests before filtering

is Event.Devices -> Metric(name = "testing.device", value = event.total, tags = tags)
is Event.Executed -> Metric(name = "testing.duration", value = event.seconds, tags = tags)
is Event.TestsTotal -> Metric(name = "testing.test", value = event.total, tags = tags)
is Event.TestsRun -> Metric(name = "testing.executed", value = event.value, tags = tags)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

number of tests after filtering

@codecov
Copy link

codecov bot commented May 3, 2023

Codecov Report

Merging #792 (33c349e) into develop (1365090) will decrease coverage by 0.60%.
The diff coverage is 38.29%.

❗ Current head 33c349e differs from pull request most recent head c104911. Consider uploading reports for the commit c104911 to get more accurate results

@@              Coverage Diff              @@
##             develop     #792      +/-   ##
=============================================
- Coverage      59.84%   59.24%   -0.60%     
  Complexity       790      790              
=============================================
  Files            209      213       +4     
  Lines           4303     4380      +77     
  Branches         679      689      +10     
=============================================
+ Hits            2575     2595      +20     
- Misses          1412     1463      +51     
- Partials         316      322       +6     
Impacted Files Coverage Δ
...lin/com/malinskiy/marathon/usageanalytics/Event.kt 0.00% <0.00%> (ø)
...iy/marathon/usageanalytics/tracker/EmptyTracker.kt 0.00% <0.00%> (ø)
...iy/marathon/usageanalytics/tracker/GrafanaCloud.kt 0.00% <0.00%> (ø)
...src/main/kotlin/com/malinskiy/marathon/Marathon.kt 63.47% <66.66%> (-2.32%) ⬇️
.../malinskiy/marathon/report/bill/BillingReporter.kt 40.47% <66.66%> (+2.01%) ⬆️
...c/main/kotlin/com/malinskiy/marathon/di/Modules.kt 46.66% <71.42%> (+2.66%) ⬆️
...athon/config/serialization/ConfigurationFactory.kt 81.69% <90.00%> (+0.73%) ⬆️
...alinskiy/marathon/usageanalytics/tracker/Metric.kt 100.00% <100.00%> (ø)
...com/malinskiy/marathon/analytics/TrackerFactory.kt 60.00% <100.00%> (+0.90%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Malinskiy Malinskiy merged commit 4bd2c5e into develop May 4, 2023
9 of 11 checks passed
@Malinskiy Malinskiy deleted the feature/grafana-cloud branch May 4, 2023 02:56
@matzuk
Copy link
Collaborator

matzuk commented May 7, 2023

@Malinskiy Codecov plugin in the PR is so annoying and distracts me from reviewing the code. Could you turn it off in the code page?

@@ -15,7 +15,7 @@ class MarathonRunCommonOptions : OptionGroup() {
.default(File("Marathonfile"))
val analyticsTracking by option("--analyticsTracking", help="Enable anonymous analytics tracking")
.convert { it.toBoolean() }
.default(false)
.default(true)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants