GithubHelp home page GithubHelp logo

isabella232 / drone-exporter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rancher/drone-exporter

0.0 0.0 0.0 4.95 MB

Drone exporter is meant to push Drone build data to DB like InfluxDB

License: Apache License 2.0

Go 80.11% Dockerfile 1.64% Makefile 2.08% Shell 16.17%

drone-exporter's Introduction

Drone Exporter

Daemon to extract data from the Drone API and push it into a backend powered by a database driver.

Key Features

  • Supports Multi-threaded, process 1 repo's builds per thread
  • On first boot, will grab all data from Drone and import it
  • Queries a repo's last build number from the database and skips processing if there are no new builds
  • Calculates build's WaitTime and Duration for easy charting.
  • Never imports data from running jobs to avoid erroneous WaitTime/Duration data
  • Data points for builds, stages and steps for granular charts

Supported Database Drivers

List of supported backends for Grafana and which ones Drone Exporter currently supports.

  • Prometheus
  • Graphite
  • OpenTSDB
  • InfluxDB
  • Loki
  • Elasticsearch
  • MySQL
  • PostgreSQL
  • MSSQL Server

Schema

Measurement: builds

&types.Build{
    Time:     time.Unix(buildInfo.Started, 0),
    Number:   buildInfo.Number,
    WaitTime: buildInfo.Started - buildInfo.Created,
    Duration: buildInfo.Finished - buildInfo.Started,
    Source:   buildInfo.Source,
    Target:   buildInfo.Target,
    Started:  buildInfo.Started,
    Created:  buildInfo.Created,
    Finished: buildInfo.Finished,
    BuildId:  build.Number,
    Tags: map[string]string{
        "Slug":    repo.Slug,
        "BuildId": fmt.Sprintf("build-%d", buildInfo.Number),
    },
}

Measurement: stages

&types.Stage{
    Time:     time.Unix(stage.Started, 0),
    WaitTime: stage.Started - stage.Created,
    Duration: stage.Stopped - stage.Started,
    OS:       stage.OS,
    Arch:     stage.Arch,
    Status:   stage.Status,
    Name:     stage.Name,
    BuildId:  build.Number,
    Tags: map[string]string{
        "Slug":    repo.Slug,
        "BuildId": fmt.Sprintf("build-%d", build.Number),
        "Sender":  build.Sender,
        "Name":    stage.Name,
        "OS":      stage.OS,
        "Arch":    stage.Arch,
        "Status":  stage.Status,
    },
}

Measurement steps

&types.Step{
    Time:     time.Unix(step.Started, 0),
    Duration: step.Stopped - step.Started,
    Name:     step.Name,
    Status:   step.Status,
    Tags: map[string]string{
        "Slug":    repo.Slug,
        "BuildId": fmt.Sprintf("build-%d", build.Number),
        "Sender":  build.Sender,
        "Name":    step.Name,
        "Status":  step.Status,
    },
}

Build

From Source

go build -mod vendor
DRONE_URL=https://dronezerver.xyz DRONE_TOKEN=abcde12345 ./drone-exporter

Docker

docker build -t lehtux/drone-exporter .
# add more envs using -e, see below
docker run -d -e DRONE_URL https://droneserver.xyz -e DRONE_TOKEN abcde12345 lehtux/drone-exporter

Environment Variables

Name Description Default Required
INTERVAL Time between runs in minutes 2 No
THREADS Number of repos to process simultaneously 10 No
DRONE_URL Drone URL NIL Yes
DRONE_TOKEN Drone Token NIL Yes
INFLUXDB_ADDRESS Database address http://influxdb:8086 No
INFLUXDB_USERNAME Database username foo No
INFLUXDB_PASSWORD Database password bar No
INFLUXDB_DATABASE Database name example No

drone-exporter's People

Contributors

luthermonson avatar jlehtimaki avatar paraglade avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.