XCMetrics is the easiest way to collect Xcode build metrics and improve developer productivity.

Overview

XCMetrics is the easiest way to collect Xcode builds metrics and improve your developer productivity.

Build Status License Docker image Slack

Overview

  • πŸ“ˆ Keep your build times under control and monitor which targets are taking the longest to compile.
  • ⚠️ Collect warnings to improve your code health.
  • ❌ Collect errors to help and diagnose builds problems in real-time.
  • πŸ›  Build custom plugins to collect an infinite amount of metadata to be attached to each build, such as version control information and thermal throttling.

XCMetrics is built on top of XCLogParser, which is a tool that can parse Xcode and xcodebuild logs stored in the xcactivitylog format. This allows XCMetrics to collect accurate metrics for you to review and keep track during the lifetime of a codebase. XCMetrics has collected almost 1 million builds and over 10 billion steps from all Spotify iOS applications since its introduction. It has allowed us to make important and informed decision in regards to our project structure and architecture.

Getting Started

Head over to our Getting Started docs to see how to integrate XCMetrics in your project.

Develop

XCMetrics is built using Swift Package Manager, you just need to open the Package.swift file in Xcode:

xed Package.swift

Support

Create a new issue with as many details as possible. It's important that you follow the issue template and include all required information in order for us to get back to you as soon as possible.

Reach us at the #xcmetrics channel in Slack.

Contributing

We feel that a welcoming community is important and we ask that you follow Spotify's Open Source Code of Conduct in all interactions with the community.

Authors

A full list of contributors can be found on GitHub.

Follow @SpotifyEng on Spotify for updates.

License

Copyright 2020 Spotify, Inc.

Licensed under the Apache License, Version 2.0: https://www.apache.org/licenses/LICENSE-2.0

This product includes software developed by the "Marcin Krzyzanowski" (http://krzyzanowskim.com/).

Security Issues?

Please report sensitive security issues via Spotify's bug-bounty program rather than GitHub.

Comments
  • chore: Update dependencies to work with xcode 14

    chore: Update dependencies to work with xcode 14

    Hey,

    The following PR would be addressing the ability to compile the backend with Xcode 14, as mentioned in the following issue https://github.com/spotify/XCMetrics/issues/85.

    opened by mustiikhalil 5
  • Adding an option to track the build's branch

    Adding an option to track the build's branch

    Hi!

    I would love the ability to know if a build is associated with a specific git branch, as this would help me analyze improvements or regressions in build times which may be coming in on new PRs. Happy to propose an implementation if this is a welcomed addition.

    Thanks!

    opened by schlagelk 5
  • Differentiate between RichNotificationExtension and Main target builds

    Differentiate between RichNotificationExtension and Main target builds

    Hello,

    When querying XCMetrics for the main target app build time I have also the build time for the RichNotificationExtension. When doing median calculation it makes the results flaky as the extension takes a lot less time to build.

    Is there a way to differentiate those two? Do you have suggestion on how to workaround that issue?

    On our CI we are using a cloud based provider and it seems that the machine name is changing for each pipeline, so by aggregating first by machine name I get coherent results. But this solution won't work for local developer machines. Furthermore, as we are monitoring success builds for the same build I can have the main app succeeding but the extension failing and it will not be a failed build.

    Thank you very much

    opened by paulemmanuel-garcia 4
  • Where the enqueued daily statistics job are started?

    Where the enqueued daily statistics job are started?

    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?

    opened by ronanrodrigo 4
  • NIOPostgres error: protocol error: Bind count must be <= 32767

    NIOPostgres error: protocol error: Bind count must be <= 32767

    When attempting to upload an XCActivityLog that is rather large (29.1 MB) with many targets, and many steps, XCMetrics logs an error: [ ERROR ] Uncaught error: NIOPostgres error: protocol error: Bind count must be <= 32767.

    A Google search for that error pointed me to: https://github.com/vapor/fluent-kit/issues/277. It seems to be related to the number of parameters that are being bound to a given query.

    Here is what the breakpoint looks like after the log is parsed in the insert method of the PostgreSQLMetricsRepository struct.

    Screen Shot 2021-02-17 at 11 43 05 PM

    Here is the raw log output:

    [ INFO ] PUT /v1/metrics [request-id: 8C8BB0F4-A820-4661-9CD9-30CEE2C6A0B0]
    [ INFO ] Dispatched queue job [job_id: 9170D075-D21B-4204-9E87-7D693A934C7B, job_name: ProcessMetricsJob, queue: default, request-id: 8C8BB0F4-A820-4661-9CD9-30CEE2C6A0B0]
    [ INFO ] PUT /v1/metrics [request-id: F0778FB1-7894-46C8-A053-6F236902A751]
    [ INFO ] Dispatched queue job [job_id: 5995640B-3785-48A5-B4BD-08593C61822A, job_name: ProcessMetricsJob, queue: default, request-id: F0778FB1-7894-46C8-A053-6F236902A751]
    [ INFO ] Dequeing job [job_id: 9170D075-D21B-4204-9E87-7D693A934C7B, job_name: ProcessMetricsJob, queue: default]
    [ NOTICE ] 17/02/2021 23:24:35 [ProcessMetricsJob] message dequeued [job_id: 9170D075-D21B-4204-9E87-7D693A934C7B]
    [ NOTICE ] 17/02/2021 23:24:35 [ProcessMetricsJob] fetching log from file:///var/folders/rm/0tz8w5hx4kb597326bxp7ksh0000gn/T/5A1D12F4-5F8F-4ECB-8225-E38746464152/2C2594C3-4B6C-4F07-9145-461019452E4C.xcactivitylog [job_id: 9170D075-D21B-4204-9E87-7D693A934C7B]
    [ NOTICE ] 17/02/2021 23:24:35 [ProcessMetricsJob] log fetched to file:///var/folders/rm/0tz8w5hx4kb597326bxp7ksh0000gn/T/5A1D12F4-5F8F-4ECB-8225-E38746464152/2C2594C3-4B6C-4F07-9145-461019452E4C.xcactivitylog [job_id: 9170D075-D21B-4204-9E87-7D693A934C7B]
    [ INFO ] Dequeing job [job_id: 5995640B-3785-48A5-B4BD-08593C61822A, job_name: ProcessMetricsJob, queue: default]
    [ NOTICE ] 17/02/2021 23:24:35 [ProcessMetricsJob] message dequeued [job_id: 5995640B-3785-48A5-B4BD-08593C61822A]
    [ NOTICE ] 17/02/2021 23:29:11 [ProcessMetricsJob] log parsed file:///var/folders/rm/0tz8w5hx4kb597326bxp7ksh0000gn/T/5A1D12F4-5F8F-4ECB-8225-E38746464152/2C2594C3-4B6C-4F07-9145-461019452E4C.xcactivitylog [job_id: 9170D075-D21B-4204-9E87-7D693A934C7B]
    [ NOTICE ] 17/02/2021 23:29:11 [ProcessMetricsJob] fetching log from file:///var/folders/rm/0tz8w5hx4kb597326bxp7ksh0000gn/T/276EEDC9-A774-408C-B14E-9C04124D377C/5100D986-E078-4BD8-A894-9163DD594967.xcactivitylog [job_id: 5995640B-3785-48A5-B4BD-08593C61822A]
    [ NOTICE ] 17/02/2021 23:29:11 [ProcessMetricsJob] log fetched to file:///var/folders/rm/0tz8w5hx4kb597326bxp7ksh0000gn/T/276EEDC9-A774-408C-B14E-9C04124D377C/5100D986-E078-4BD8-A894-9163DD594967.xcactivitylog [job_id: 5995640B-3785-48A5-B4BD-08593C61822A]
    [ NOTICE ] 17/02/2021 23:29:11 [PostgressMetricsRepository] creating daily partitions
    [ NOTICE ] 17/02/2021 23:29:11 [ProcessMetricsJob] log parsed file:///var/folders/rm/0tz8w5hx4kb597326bxp7ksh0000gn/T/276EEDC9-A774-408C-B14E-9C04124D377C/5100D986-E078-4BD8-A894-9163DD594967.xcactivitylog [job_id: 5995640B-3785-48A5-B4BD-08593C61822A]
    [ NOTICE ] 17/02/2021 23:29:11 [PostgressMetricsRepository] creating daily partitions
    [ NOTICE ] 17/02/2021 23:29:11 [PostgressMetricsRepository] creating daily partitions
    [ NOTICE ] 17/02/2021 23:29:11 [PostgressMetricsRepository] creating daily partitions
    [ ERROR ] Uncaught error: NIOPostgres error: protocol error: Bind count must be <= 32767.
    [ NOTICE ] 17/02/2021 23:29:16 [PostgressMetricsRepository] metrics inserted
    [ INFO ] [ProcessMetricsJob] metrics inserted for file:///var/folders/rm/0tz8w5hx4kb597326bxp7ksh0000gn/T/276EEDC9-A774-408C-B14E-9C04124D377C/5100D986-E078-4BD8-A894-9163DD594967.xcactivitylog [job_id: 5995640B-3785-48A5-B4BD-08593C61822A]
    [ INFO ] [ProcessMetricsJob] finished processing file:///var/folders/rm/0tz8w5hx4kb597326bxp7ksh0000gn/T/276EEDC9-A774-408C-B14E-9C04124D377C/5100D986-E078-4BD8-A894-9163DD594967.xcactivitylog [job_id: 5995640B-3785-48A5-B4BD-08593C61822A]```
    opened by JustinDSN 4
  • [doc] Is there any documentation about the database schema, table?

    [doc] Is there any documentation about the database schema, table?

    I try to use Grafana to create metrics that will view data sources in Postgres directly. so I need to know the data, the schemas, and their tables, data relationship in each table. Are there any documents about them? I can guess most of the tables, columns, but it will be easy if we have documentation about them.

    opened by tinder-kaijing 4
  • Slow database because of lots of data records?

    Slow database because of lots of data records?

    Hey guys, so I have been working now with XCMetrics for quite so long and it shows lots of great data that we need, the problem now that we are mapping the data into grafana board to monitor our build times. The problem now is that the postgres database whenever more data is there, the slowest the query to map data is.

    especially build_steps and build_targets tables, they are super slow even opening the table and sorting by day asc

    I am not sure if there is some problem to that? other than for example deleting old data?

    Thank you

    question 
    opened by AyaAkl25 3
  • Looking forward to the Web Interface

    Looking forward to the Web Interface

    XCLogParser & XCMetrics is cool idea, the demo shows the graph is pretty. Is there any plan to integrate the web interface to the XCMetric service? πŸš€πŸš€πŸš€

    opened by Binlogo 3
  • How to delete old data

    How to delete old data

    Hello, Im trying to use docker-compose-local.yml and my postgres database is growing Is there any build in solution to delete old data? Or I can just drop old partitions?

    opened by user646346 3
  • Web interface

    Web interface

    Hi! I'm trying XCMetrics to see how we can leverage it within our organization. One thing that it is not clear to me is whether the web interface that is shown in the presentation video is included in the project.

    I've read the documentation and deployed locally the server, but it looks like there is only the part of the backend that gather metrics. Is that correct?

    Thanks a lot

    opened by bolismauro 3
  • Question: Will and when uploaded xcactivitylog be deleted?

    Question: Will and when uploaded xcactivitylog be deleted?

    Hi there As far as i know xcmetrics will copied xcactivitylog from derived data to ~/Library/Caches/XCMetrics, So I think, the longer this folder will contain a lot of .xcactivitylogs and will require a lot of storage space on the hard disk, Can xcmetrics delete xcactivitylog automatically? perhaps Instead of renaming the file with UPLOADED.xcactivitylog can we just delete it?

    opened by dwirandyh 2
  • Plugin for measuring unit test time

    Plugin for measuring unit test time

    Hi all,

    Thank you for this awesome project ❀️

    We are investigating it and we want to integrate it in order to measure our build times.

    I wander do you have any plugins for measuring unit test timing (I'm talking about each test execution time)? Do you consider viable option to add a plugin for measuring unit test timing or you think it's not related to this project ?

    opened by hovox 0
  • [REQUEST] Tag Latest Docker Image with Current Release on dockerhub

    [REQUEST] Tag Latest Docker Image with Current Release on dockerhub

    Hey folks,

    It looks like we have version 0.0.11 as release on this repo but that release is not reflected as an image tag on dockerhub. Would it be possible to tag the latest dockerhub image with v0.0.11?

    Thanks!

    opened by ryanm-sq 0
  • Explicitly specify required PSQL versions in documentation

    Explicitly specify required PSQL versions in documentation

    I was deploying XCMetrics to AWS and wanted to use Aurora PostgreSQL Serverless, however the only version available is 10.14 which, I realised after the fact, is not supported by XCMetrics. The only place in the docs where PSQL's version is mentioned is in Kubernetes configs. I think it would be better if the version was explicitly stated in the How to Deploy Backend.md file. Though I am actually not sure if version 11 would suffice.

    Second commit, which I can push as a separate PR, just fixes a misspelling of a variable in a log message

    opened by evdokimovn 0
  • Stuck booting XCMetricsBackend when deploying using scheduled job

    Stuck booting XCMetricsBackend when deploying using scheduled job

    I encountered issue when deploying using docker-compoese, following the documentation provided.

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

    Turns out that the command does not take exec path. In my case I should change to

    command: [ "queues",
                      "--scheduled",
                      "--env",
                      "production"]
    

    After change it, in my xcmetrics service, it will stuck when booting and only produce this log

    [ NOTICE ] Connecting to xcmetrics in postgresql as xcmetrics password length 15
    
    [ INFO ] Using redis host redis and port 6379
    
    [ INFO ] Starting scheduled jobs worker
    

    I cannot connect to localhost:8080 using browser, even after 10 minutes waiting for the service to boot up.

    Is there any change this is because the service boot command is overridden and the service in port 8080 is not started yet? When I see docker documentation, command property is used to override default command which in XCMetrics Dockerfile is

    # Start the Vapor service when the image is run, default to listening on 8080 in production environment
    ENTRYPOINT ["./XCMetricsBackend"]
    CMD ["serve", "--auto-migrate", "--env", "production", "--hostname", "0.0.0.0", "--port", "8080"]
    
    opened by hendych 0
  • Fatal error: No Queues driver configured

    Fatal error: No Queues driver configured

    We encountered an issue trying to deploy the latest XCMetrics backend docker image via Google Could Run and are unable to resolve it.

    Environment:

    • PostgreSQL: v12
    • docker image latest

    Env variables are set to

    • XCMETRICS_USE_ASYNC_LOG_PROCESSING="0"
    • XCMETRICS_USE_CLOUDSQL_SOCKET="1"
    • XCMETRICS_CLOUDSQL_CONNECTION_NAME="***"
    • DB_NAME="database name"
    • DB_USER="database user"
    • DB_PASSWORD="***"

    Google Could Run docker image start failed

    {
    "textPayload": "Fatal error: No Queues driver configured. Configure with app.queues.use(...): file Queues/Application+Queues.swift, line 67",
    "insertId": "***",
    "resource": {
    "type": "cloud_run_revision",
    "labels": {
    "revision_name": "xcmetrics-00004-soz",
    "project_id": "***",
    "configuration_name": "xcmetrics",
    "location": "europe-west1",
    "service_name": "xcmetrics"
    }
    },
    "timestamp": "2022-01-27T09:53:07.063545Z",
    "labels": {
    "instanceId": "***"
    },
    "logName": "***/logs/run.googleapis.com%2Fstderr",
    "receiveTimestamp": "2022-01-27T09:53:07.067705330Z"
    }
    

    Any idea what we could be doing wrong?

    opened by ctreffs 1
Releases(0.0.11)
Swift-DocC is a documentation compiler for Swift frameworks and packages aimed at making it easy to write and publish great developer documentation.

Swift-DocC is a documentation compiler for Swift frameworks and packages aimed at making it easy to write and publish great developer docum

Apple 833 Jan 3, 2023
A visual developer tool for inspecting your iOS application data structures.

Tree Dump Debugger A visual developer tool for inspecting your iOS application data structures. Features Inspect any data structure with only one line

null 8 Nov 2, 2022
A handy collection of Swift method and Tools to build project faster and more efficient.

SwifterKnife is a collection of Swift extension method and some tools that often use in develop project, with them you might build project faster and

李阳 4 Dec 29, 2022
A result builder that build HTML parser and transform HTML elements to strongly-typed result, inspired by RegexBuilder.

HTMLParserBuilder A result builder that build HTML parser and transform HTML elements to strongly-typed result, inspired by RegexBuilder. Note: Captur

null 4 Aug 25, 2022
Demonstration of Cocoapod test targets failing to build when integrated with TestingExtensions 0.2.11.

TestingExtensions0_2_11-Bug Symptoms Open project, hit test (Command+U), TestingExtensions fails to compile with a list of errors appearing to be rela

Sihao Lu 0 Dec 27, 2021
SuggestionsBox helps you build better a product trough your user suggestions. Written in Swift. πŸ—³

SuggestionsBox An iOS library to aggregate users feedback about suggestions, features or comments in order to help you build a better product. Swift V

Manuel Escrig 100 Feb 6, 2022
🏈 Cache CocoaPods for faster rebuild and indexing Xcode project.

?? Cache CocoaPods for faster rebuild and indexing Xcode project.

Vyacheslav Khorkov 489 Jan 6, 2023
Replace your Xcode icon with colorful variants

XcoatOfPaint Have you ever wished the Xcode icon could get a fresh coat of paint to match the colorful Mac you just bought? Or you want to distinguish

Christian Lobach 163 Dec 20, 2022
MyUtils For Xcode

MyUtils For Xcode App Store Download ##You can 1: \#FFFFFF -> [UIColor colorWithRed:1.00 green:1.00 blue:1.00 alpha:1.00] Use:Select "#FFFFFF" Then Xc

wintelsui 0 Nov 5, 2021
Sample project to reproduce Xcode 13 indexing problems

Xcode 13 indexing regression for Swift static libraries Summary: Currently if you have a project that links a pre-compiled Swift static library (with

AndrΓ© Alves 13 Nov 3, 2022
An extension for Xcode to generate builders from structs

Swift Struct Builder Generator Xcode Source Editor Extension An Xcode extension (plugin) to generate struct builders automatically. Install Swift Stru

Marius Wichtner 1 Nov 24, 2021
Working alternative to Xcode previews.

SwiftUIPlaygrounds! A shell project you can use to iterate over SwiftUI interfaces using the HotReloading project. Instead of a "preview" the interfac

John Holdsworth 9 Dec 21, 2021
A declarative, thread safe, and reentrant way to define code that should only execute at most once over the lifetime of an object.

SwiftRunOnce SwiftRunOnce allows a developer to mark a block of logic as "one-time" code – code that will execute at most once over the lifetime of an

Thumbtack 8 Aug 17, 2022
A way to easily add Cocoapod licenses and App Version to your iOS App using the Settings Bundle

EasyAbout Requirements: cocoapods version 1.4.0 or above. Why you should use Well, it is always nice to give credit to the ones who helped you ?? Bonu

JoΓ£o Mourato 54 Apr 6, 2022
Easy way to detect iOS device properties, OS versions and work with screen sizes. Powered by Swift.

Easy way to detect device environment: Device model and version Screen resolution Interface orientation iOS version Battery state Environment Helps to

Anatoliy Voropay 582 Dec 25, 2022
A quick and "lean" way to swizzle methods for your Objective-C development needs.

Swizzlean A quick and "lean" way to swizzle methods for your Objective-C development needs. Adding Swizzlean to your project Cocoapods CocoaPods is th

Ryan Baumbach 104 Oct 11, 2022
The simplest way to display the librarie's licences used in your application.

Features β€’ Usage β€’ Translation β€’ Customisation β€’ Installation β€’ License Display a screen with all licences used in your application can be painful to

Florian Gabach 51 Feb 28, 2022
The fastest πŸš€ way to embed a 3D model in Swift

Insert3D is the easiest ?? and fastest ?? way to embed a 3D model in your iOS app. It combines SceneKit and Model I/O into a simple library for creati

Viktor Makarskyy 85 Dec 31, 2022