Skip to content

Commit

Permalink
add the ability to listen for and track service timings
Browse files Browse the repository at this point in the history
  • Loading branch information
ripienaar committed Nov 16, 2019
1 parent d718810 commit 686a269
Show file tree
Hide file tree
Showing 16 changed files with 1,320 additions and 87 deletions.
101 changes: 50 additions & 51 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,57 +9,56 @@ jobs:
os: [ubuntu-latest, macOS-latest]
runs-on: ${{matrix.os}}
steps:
- name: Checkout code
uses: actions/checkout@v1
with:
path: src/github.com/nats-io/nats-surveyor
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: ${{matrix.go}}
- name: Install deps
shell: bash --noprofile --norc -x -eo pipefail {0}
env:
GO111MODULE: 'on'
run: |
export GOPATH="$RUNNER_WORKSPACE"
go get -v github.com/wadey/gocovmerge
go get -v github.com/golangci/golangci-lint/cmd/golangci-lint
- name: Lint
shell: bash --noprofile --norc -x -eo pipefail {0}
env:
GO111MODULE: 'on'
run: |
export GOPATH="$RUNNER_WORKSPACE"
- name: Checkout code
uses: actions/checkout@v1
with:
path: src/github.com/nats-io/nats-surveyor
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: ${{matrix.go}}
- name: Install deps
shell: bash --noprofile --norc -x -eo pipefail {0}
env:
GO111MODULE: "on"
run: |
export GOPATH="$RUNNER_WORKSPACE"
go get -v github.com/wadey/gocovmerge
go get -v github.com/golangci/golangci-lint/cmd/golangci-lint
- name: Lint
shell: bash --noprofile --norc -x -eo pipefail {0}
env:
GO111MODULE: "on"
run: |
export GOPATH="$RUNNER_WORKSPACE"
go vet ./...
$(go env GOPATH)/bin/golangci-lint run \
--no-config --exclude-use-default=false --max-same-issues=0 \
--disable errcheck \
--enable golint \
--enable stylecheck \
--enable interfacer \
--enable unconvert \
--enable dupl \
--enable gocyclo \
--enable gofmt \
--enable goimports \
--enable misspell \
--enable unparam \
--enable nakedret \
--enable prealloc \
--enable scopelint \
--enable gocritic \
--enable gochecknoinits \
./...
go vet ./...
$(go env GOPATH)/bin/golangci-lint run \
--no-config --exclude-use-default=false --max-same-issues=0 \
--disable errcheck \
--enable golint \
--enable stylecheck \
--enable interfacer \
--enable unconvert \
--enable dupl \
--enable gocyclo \
--enable gofmt \
--enable goimports \
--enable misspell \
--enable unparam \
--enable nakedret \
--enable prealloc \
--enable scopelint \
--enable gocritic \
./...
- name: Run tests
shell: bash --noprofile --norc -x -eo pipefail {0}
env:
GO111MODULE: 'on'
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
run: |
export GOPATH="$RUNNER_WORKSPACE"
- name: Run tests
shell: bash --noprofile --norc -x -eo pipefail {0}
env:
GO111MODULE: "on"
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
run: |
export GOPATH="$RUNNER_WORKSPACE"
go test -v -race -p 1 ./...
./scripts/cov.sh CI
go test -v -race -p 1 ./...
./scripts/cov.sh CI
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

nats-surveyor
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,20 @@ security thread to the node it is running on.

More information can be found [here](https://github.com/prometheus/prometheus/issues/5976).

## Service Observations

Services can be observed by creating JSON files in the `observations` directory, here's an example:

```
{
"name": "email.subscribe",
"topic": "monitor.email.subscribe",
"credential": "/observations/email.subscribe.cred"
}
```

Place this in `observations/email.surbscribe.json` and create a credential giving access to this topic in `observations/email.subscribe.cred`, when you restart the service any observations published by the NATS system will be tracked and graphed.

## TODO

- [ ] Windows builds
Expand Down
10 changes: 5 additions & 5 deletions docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
version: '3'
version: "3"

networks:
monitor-net:
driver: bridge

services:

surveyor:
image: synadia/nats-surveyor:${SURVEYOR_DOCKER_TAG}
container_name: nats-surveyor
container_name: nats-surveyor
volumes:
- $NATS_SURVEYOR_CREDS:/etc/surveyor/SYS.creds
- ./observations:/observations
entrypoint: /nats-surveyor
command: -c ${NATS_SURVEYOR_SERVER_COUNT} -creds /etc/surveyor/SYS.creds -s "${NATS_SURVEYOR_SERVERS}"
command: -c ${NATS_SURVEYOR_SERVER_COUNT} -creds /etc/surveyor/SYS.creds -s "${NATS_SURVEYOR_SERVERS}" -observe /observations
networks:
- monitor-net
labels:
Expand All @@ -31,7 +31,7 @@ services:
org.label-schema.group: "nats-monitoring"
depends_on:
- surveyor

grafana:
image: grafana/grafana:${GRAFANA_DOCKER_TAG}
container_name: grafana
Expand Down
Loading

0 comments on commit 686a269

Please sign in to comment.