Skip to content

Commit

Permalink
add pod name change feature
Browse files Browse the repository at this point in the history
  • Loading branch information
kiamran authored Jan 23, 2020
1 parent f3dd708 commit 0b9c6c4
Show file tree
Hide file tree
Showing 342 changed files with 69,390 additions and 48,189 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ GOFLAGS=-mod=vendor
GOARCH := amd64
GOOS := linux

GOLINT_VERSION:=1.19.1
GOLINT_VERSION:=1.23.1

BUILD_FLAGS = GO111MODULE=on CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) GOFLAGS=$(GOFLAGS)
APPLICATION_NAME := anodot-prometheus-remote-write
Expand Down Expand Up @@ -74,5 +74,6 @@ version-set:
echo "Version $(VERSION) set in code, deployment, chart"

vendor-update:
GO111MODULE=on go get -u ./pkg/...
GO111MODULE=on go mod tidy
GO111MODULE=on go mod vendor
104 changes: 3 additions & 101 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,111 +7,13 @@

`anodot-prometheus-remote-write` is a service which receives [Prometheus](https://github.com/prometheus) metrics through [`remote_write`](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write), converts metrics and sends them into [Anodot](https://www.anodot.com).

* [Building application](#building-application)
* [Prerequisites](#prerequisites)
* [Running tests](#running-tests)
* [Deploying application application](#deploying-application-application)
* [Prerequisites](#prerequisites-1)
* [Using helm](#using-helm)
* [Using docker-compose](#using-docker-compose)
* [Configuring Prometheus server](#configuring-prometheus-server)
* [Authors](#authors)
* [License and Disclaimer](#license-and-disclaimer)

## Building From Source
### Prerequisites
- Go >= 1.13

```shell script
git clone https://github.com/anodot/anodot-remote-write.git && cd anodot-remote-write
make all
```

### Running Tests
```shell script
make test
```

## Install Using Helm

Optional Configuration options. Should be specified under `configuration.env` section in values.yaml

| Env variable | Description | Default |
| ----------------------------|-------------------------------------------------------------------------------| --------------|
| ANODOT_LOG_LEVEL | Application log level. Supported options are: `panic, fatal, error, warning, info, debug, trace`| info |
| ANODOT_TAGS | Format `TAG1=VALUE1;TAG2=VALUE2` Static tags that will be added to Anodot |["source":"prometheus-remote-write"]|
| ANODOT_HTTP_DEBUG_ENABLED | Should be used to enable HTTP requests/response dumps to stdout |false|


```shell script
helm repo add anodot https://anodot.github.io/helm-charts
```

```shell script
helm fetch anodot/anodot-prometheus-remote-write --untar
```

Navigate to `anodot-prometheus-remote-write` folder and edit `values.yaml`with required values (image version, anodot token,
etc)

Run next command to install chart
```shell script
helm upgrade -i anodot-remote-write . --namespace=monitoring
```

This command will install application in `monitoring` namespace.

## Install Via Docker Compose

```shell script
cd deployment/docker-compose
```
Open `docker-compose.yaml` and edit if needed, specifying required configuration parameters.
Run next command to start application:
```shell script
docker-compose up -d
```

## Configuring Prometheus Server
In Prometheus configuration file (default `prometheus.yml`), add `remote_write` [configuration](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write)
```yaml
global:
scrape_interval: 60s
evaluation_interval: 60s
remote_write:
- url: "http://anodot-prometheus-remote-write:1234/receive"
metric_relabel_configs:
- source_labels: [ __name__ ]
regex: '(nginx_ingress_controller_requests|nginx_ingress_controller_ingress_upstream_latency_seconds)'
action: drop
```
[Prometheus operator](https://github.com/coreos/prometheus-operator) configuration example (some fields omitted for clarity):
```yaml
apiVersion: monitoring.coreos.com/v1
kind: Prometheus
metadata:
labels:
app: prometheus-operator-prometheus
name: prometheus
spec:
remoteWrite:
- url: http://anodot-prometheus-remote-write:1234/receive
# writeRelabelConfigs:
# - action: drop
# regex: '(apiserver_request_count|prometheus_remote_storage_sent_batch_duration_seconds_bucket)'
# sourceLabels: [__name__]
queueConfig:
maxSamplesPerSend: 1000
version: v2.10.0
```
More Prometheus configuration options available on [this](https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#remotewritespec) page.
## Docs
[Github Wiki](https://github.com/anodot/anodot-remote-write/wiki)

## Authors

* **Yuval Dror** - *Initial work*

## License and Disclaimer

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
5 changes: 4 additions & 1 deletion deployment/docker-compose/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ version: '2'

services:
remote-write:
image: anodot/prometheus-remote-write:2.0.0
image: anodot/prometheus-remote-write:2.2.0
container_name: anodot-prometheus-remote-write
restart: unless-stopped
environment:
ANODOT_LOG_LEVEL: "3"
ANODOT_HTTP_DEBUG_ENABLED: "false"
ports:
- "1234:1234"
command: ["-url=https://api.anodot.com","-token=<CHANGE_ME>","-workers=20"]
Expand Down
7 changes: 4 additions & 3 deletions e2e/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ services:
- ./sample-docker-prometheus.yml:/etc/prometheus/prometheus.yml:ro

remote-write:
image: anodot/prometheus-remote-write:2.0.0
image: anodot/prometheus-remote-write:2.2.0
container_name: anodot-prometheus-remote-write
depends_on:
- anodot-metrics-stub
restart: unless-stopped
ports:
- "1234:1234"
command: ["-url=http://anodot-metrics-stub:8080","-token=123456","-workers=20"]
command: ["-url=http://anodot-metrics-stub:8080","-token=should_be_taken_from_env","-workers=20"]
environment:
ANODOT_METRICS_PER_REQUEST_SIZE: 4
ANODOT_LOG_LEVEL: "trace"
ANODOT_LOG_LEVEL: "4"
ANODOT_API_TOKEN: "123456"
3 changes: 2 additions & 1 deletion e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ func TestMetricsData(t *testing.T) {
}

expectedTags := map[string]string{
"source": "prometheus-remote-write",
"source": "prometheus-remote-write",
"job_name": "tag-test-app",
}

for _, m := range metrics {
Expand Down
6 changes: 5 additions & 1 deletion e2e/sample-docker-prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@ scrape_configs:
- source_labels: [__name__]
regex: '(exported_http_requests_total|exported_version)'
replacement: 'true'
target_label: 'anodot_include'
target_label: 'anodot_include'
- source_labels: [job]
regex: (.*)
target_label: anodot_tag_job_name
replacement: tag-${1}
18 changes: 11 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ go 1.12

require (
github.com/anodot/anodot-common v0.0.6
github.com/gogo/protobuf v1.2.1 // indirect
github.com/gogo/protobuf v1.3.1 // indirect
github.com/golang/protobuf v1.3.2
github.com/golang/snappy v0.0.1
github.com/grpc-ecosystem/grpc-gateway v1.9.6 // indirect
github.com/prometheus/client_golang v1.2.1
github.com/prometheus/common v0.7.0
github.com/grpc-ecosystem/grpc-gateway v1.12.1 // indirect
github.com/hashicorp/go-retryablehttp v0.6.4
github.com/prometheus/client_golang v1.3.0
github.com/prometheus/common v0.9.1
github.com/prometheus/prometheus v2.5.0+incompatible
github.com/sirupsen/logrus v1.4.2
google.golang.org/genproto v0.0.0-20190817000702-55e96fffbd48 // indirect
google.golang.org/grpc v1.23.0 // indirect
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa // indirect
golang.org/x/sys v0.0.0-20200121082415-34d275377bf9 // indirect
golang.org/x/text v0.3.2 // indirect
google.golang.org/genproto v0.0.0-20200117163144-32f20d992d24 // indirect
google.golang.org/grpc v1.26.0 // indirect
k8s.io/klog/v2 v2.0.0-20200108022340-c4f748769d6e
)
Loading

0 comments on commit 0b9c6c4

Please sign in to comment.