Skip to content

Commit

Permalink
try buildmetrics for tracking builds (chanzuckerberg#285)
Browse files Browse the repository at this point in the history
try buildmetrics for tracking buildsI set out to try and find ways to instrument our builds and this is the best option I have found.

This travis build will now use honeycomb's [buildmetrics](https://github.com/honeycombio/buildevents) to trace the build through its execution. We can then analyze the data and alert on any SLIs we care about.

I looked at datadog integration, but their metrics don't include the branch name (because it is high cardinality), so you can't do things like "only alert on master branch failures". Honeycomb, with support for high-cardinality metrics should allow us to do this.

### Test Plan
* travis build

### References
* https://github.com/honeycombio/buildevents
  • Loading branch information
ryanking authored and palasha committed Apr 7, 2020
1 parent f527e3f commit 771d679
Showing 1 changed file with 33 additions and 17 deletions.
50 changes: 33 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,40 @@
language: go
sudo: false
go:
- "1.12"
env:
global:
- BUILD_START=$(date +%s)

install:
- npm install -g snyk
- make setup
- go get -u github.com/haya14busa/goverage
- STEP_START=$(date +%s)
- STEP_SPAN_ID=$(echo install | sum | cut -f 1 -d \ )
- mkdir bin # this is in theory supposed to exist already
- curl -L -o $HOME/bin/buildevents https://github.com/honeycombio/buildevents/releases/latest/download/buildevents
- chmod 755 $HOME/bin/buildevents
- buildevents cmd $TRAVIS_BUILD_ID $STEP_SPAN_ID npm-install -- npm install -g snyk
- buildevents cmd $TRAVIS_BUILD_ID $STEP_SPAN_ID make-setup -- make setup
- buildevents cmd $TRAVIS_BUILD_ID $STEP_SPAN_ID go-get -- go get -u github.com/haya14busa/goverage
- buildevents step $TRAVIS_BUILD_ID $STEP_SPAN_ID $STEP_START install

script:
- make
- STEP_START=$(date +%s)
- STEP_SPAN_ID=$(echo install | sum | cut -f 1 -d \ )
- buildevents cmd $TRAVIS_BUILD_ID $STEP_SPAN_ID codecov-validate -- curl --data-binary @codecov.yml https://codecov.io/validate
- buildevents cmd $TRAVIS_BUILD_ID $STEP_SPAN_ID make-test-coverage -- make test-coverage
# Disable snyk until https://github.com/snyk/snyk/issues/354 is resolved
# - if [[ ! -z "${SNYK_TOKEN}" ]]; then snyk monitor --org=czi; snyk test; fi
- buildevents step $TRAVIS_BUILD_ID $STEP_SPAN_ID $STEP_START script

after_failure:
- STEP_START=$(date +%s)
- STEP_SPAN_ID=$(echo after_success | sum | cut -f 1 -d \ )
- buildevents step $TRAVIS_BUILD_ID $STEP_SPAN_ID $STEP_START after_failure
- buildevents travis-ci build $TRAVIS_BUILD_ID $BUILD_START failure

jobs:
include:
- stage: check
script:
- make test-coverage
- bash <(curl -s https://codecov.io/bash)
# Disable snyk until https://github.com/snyk/snyk/issues/354 is resolved
# - stage: check
# script:
# - if [[ ! -z "${SNYK_TOKEN}" ]]; then snyk monitor --org=czi; snyk test; fi
- stage: check
script:
- curl --data-binary @codecov.yml https://codecov.io/validate
after_success:
- STEP_START=$(date +%s)
- STEP_SPAN_ID=$(echo after_success | sum | cut -f 1 -d \ )
- buildevents cmd $TRAVIS_BUILD_ID $STEP_SPAN_ID codecov-upload -- bash <(curl -s https://codecov.io/bash)
- buildevents step $TRAVIS_BUILD_ID $STEP_SPAN_ID $STEP_START after_success
- buildevents build $TRAVIS_BUILD_ID $BUILD_START success

0 comments on commit 771d679

Please sign in to comment.