Skip to content

Commit

Permalink
configure github actions (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
copperlight authored Dec 3, 2022
1 parent a8bacb6 commit c9da659
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 88 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build

on:
pull_request:
push:
branches:
- main

jobs:
build:
if: ${{ github.repository == 'Netflix/spectator-cpp' }}
runs-on: ubuntu-latest
env:
CC: "gcc-11"
CXX: "g++-11"
LANG: "en_US.UTF-8"
steps:
- uses: actions/checkout@v2

- name: Bazel Cache
uses: actions/cache@v3
with:
path: ~/.cache/bazel
key: ${{ runner.os }}-bazel

- name: Install System Dependencies
run: |
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg
sudo mv bazel.gpg /etc/apt/trusted.gpg.d/
echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update && sudo apt-get install -y bazel binutils-dev g++-11
- name: Build spectator-cpp
run: |
bazel --output_user_root=~/.cache/bazel --batch build --config asan spectator_test spectator
- name: Test spectator-cpp
run: |
GTEST_COLOR=1 ./bazel-bin/spectator_test
17 changes: 3 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
CMakeCache.txt
CMakeFiles/
CTestTestfile.cmake
Makefile
cmake_install.cmake
bazel-*
build-*
node_modules/
npm-debug.log
.newt.netflix_environment.sh
cmake-build-*
logs/
.clwb/
.idea/
.vscode/
.clwb
compile_commands.json
bazel-*
build-*
32 changes: 0 additions & 32 deletions .travis.yml

This file was deleted.

29 changes: 12 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
[![Build Status](https://travis-ci.org/Netflix/spectator-cpp.svg?branch=master)](https://travis-ci.org/Netflix/spectator-cpp)
[![Build](https://github.com/Netflix/spectator-cpp/actions/workflows/build.yml/badge.svg)](https://github.com/Netflix/spectator-cpp/actions/workflows/build.yml)

# Spectator-cpp

> :warning: Experimental
Simple library for instructing code to record dimensional time series. It
sends all activity to a
[spectatord](https://github.com/Netflix-Skunkworks/spectatord) sidecar.
Simple library for instructing code to record dimensional time series. It sends all activity to
a [spectatord](https://github.com/Netflix-Skunkworks/spectatord) sidecar.

## Description

This implements a basic [Spectator](https://github.com/Netflix/spectator) library
for instrumenting C++ applications, sending all metric activity to a sidecar.
This implements a basic [Spectator](https://github.com/Netflix/spectator) library for instrumenting
C++ applications, sending all metric activity to a sidecar.

## Instrumenting Code

Expand Down Expand Up @@ -44,13 +41,13 @@ class Server {
// do some work and obtain a response...
Response res{200, 64};

// Update the counter id with dimensions based on the request. The
// counter will then be looked up in the registry which should be
// fairly cheap, such as lookup of id object in a map
// However, it is more expensive than having a local variable set
// to the counter.
auto cnt_id = request_count_id_->WithTag("country", request.country)
->WithTag("status", std::to_string(res.status));
// Update the Counter id with dimensions, based on information in the request. The Counter
// will be looked up in the Registry, which is a fairly cheap operation, about the same as
// the lookup of an id object in a map. However, it is more expensive than having a local
// variable set to the Counter.
auto cnt_id = request_count_id_
->WithTag("country", request.country)
->WithTag("status", std::to_string(res.status));
registry_->GetCounter(std::move(cnt_id))->Increment();
request_latency_->Record(std::chrono::steady_clock::now() - start);
response_size_->Record(res.size);
Expand All @@ -65,7 +62,6 @@ class Server {
};

Request get_next_request() {
//...
return Request{"US"};
}

Expand All @@ -82,6 +78,5 @@ int main() {
auto req = get_next_request();
server.Handle(req);
}

}
```
4 changes: 4 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

bazel --output_user_root=$HOME/.cache/bazel --batch build --config asan spectator_test spectator
GTEST_COLOR=1 ./bazel-bin/spectator_test
7 changes: 0 additions & 7 deletions codecov.yml

This file was deleted.

12 changes: 0 additions & 12 deletions create-lcov-report.sh

This file was deleted.

5 changes: 0 additions & 5 deletions run-build.sh

This file was deleted.

2 changes: 1 addition & 1 deletion spectator/publisher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ SpectatordPublisher::SpectatordPublisher(absl::string_view endpoint,
setup_udp(endpoint.substr(pos));
} else if (endpoint != "disabled") {
logger_->warn(
"Unknown endpoint: {}. Expecting: 'unix:/path/to/socket'"
"Unknown endpoint: '{}'. Expecting: 'unix:/path/to/socket'"
" or 'udp:hostname:port' - Will not send metrics",
std::string(endpoint));
setup_nop_sender();
Expand Down

0 comments on commit c9da659

Please sign in to comment.