spotify / XCMetrics

XCMetrics is the easiest way to collect Xcode build metrics and improve developer productivity.
https://xcmetrics.io
Other
1.1k stars 77 forks source link

Where the enqueued daily statistics job are started? #67

Closed ronanrodrigo closed 2 years ago

ronanrodrigo commented 2 years ago

I am trying get values from DailyStatisticsJob at /v1/statistics/build/count?days=14 but the statistics_day_build_time table is empty. And while debugging the XCMetricsBackendLib/Config/configure.swift there isn't a call to startScheduledJobs() or similar across the project.

I am missing where it is being called? Or there is other way to start the scheduled jobs?

ronanrodrigo commented 2 years ago

Adding this to my project the table started to being populated

public func configure(_ app: Application) throws {

    // ...

    if config.scheduleStatisticsJobs {
        // ...
        try app.queues.startScheduledJobs()
    }

    // ...
}
ronanrodrigo commented 2 years ago

I found some other stuffs... On routes.swift the try app.queues.startInProcessJobs(on: .default) and on xcmetrics-jobs-deployment.yaml this:

command: ["./XCMetricsBackend",
    "queues",
    "--env",
    "production"]

But even running the command above, nothing happens. There is any documentation about the workers/schedulers?

ecamacho commented 2 years ago

Hi. You need to start the process with

        command: ["./XCMetricsBackend",
                  "queues",
                  "--scheduled",
                  "--env",
                  "production"]

It will run every day and create the statistics_day_counts table.

I will add documentation about this.

ronanrodrigo commented 2 years ago

@ecamacho thanks!