Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Graphite ingestion #1310

Merged
merged 70 commits into from
Jan 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
c3c4306
dont use statsdex code and cleanup
Jan 19, 2019
2f59a0b
address feedback
Jan 21, 2019
d60d2fc
wip
Jan 21, 2019
54b6e01
basic skeleton and generation of tags from name
Jan 21, 2019
9a156ca
wip
Jan 21, 2019
7dabba8
Add benchmark for generateTagsFromName and reuse names as much as pos…
Jan 21, 2019
9a08c76
add comments
Jan 21, 2019
689cd95
add space
Jan 21, 2019
cf50185
Add downsampleandwrite + tests
Jan 22, 2019
10dc790
refactor remote write to use new downsamplerAndWriter
Jan 22, 2019
176d862
handle nil downsampler
Jan 22, 2019
ffd52ba
add test for case where downsampler is nil
Jan 22, 2019
8dba5d4
use downsamplerAndWriter in carbon ingester
Jan 22, 2019
1d25d1b
wip
Jan 22, 2019
3f6e5eb
wip
Jan 23, 2019
caf97a0
update test
Jan 24, 2019
761c2a1
wire up carbon ingestion server
Jan 24, 2019
a6a04ca
improve logging and bug fixes
Jan 24, 2019
a2e7898
Fix carbon ingestion tests
Jan 24, 2019
9fef8ae
remove print
Jan 24, 2019
632ba0b
renable tests
Jan 24, 2019
8c1c419
update start_m3 script
Jan 24, 2019
19503ab
Share code among docker integration tests
Jan 24, 2019
f229bb7
Add new docker integration test to makefile
Jan 24, 2019
d2c4b51
fix broken test
Jan 24, 2019
d219402
fix imports
Jan 24, 2019
eabf575
making writing to unaggregated optional
Jan 24, 2019
9c84978
disable unaggregated writes in carbon ingester
Jan 24, 2019
977b425
fix typo
Jan 24, 2019
7b14c97
refactor interfaces
Jan 24, 2019
5f6c303
remove todo
Jan 24, 2019
9ff3a6a
refactor metrics struct
Jan 24, 2019
0607d6c
add docstring
Jan 24, 2019
74bc426
make prom TS iter more efficient
Jan 24, 2019
be483c9
refactor write method
Jan 24, 2019
9c36aac
fix tests and add comment
Jan 24, 2019
2e7ec1c
disable test
Jan 24, 2019
0b83af6
make carbon enabled by default
Jan 24, 2019
2a40912
add TODO
Jan 24, 2019
4c3d7ae
fix write code
Jan 24, 2019
4f1582e
switch from nanos to durations
Jan 24, 2019
63b65fc
validate options
Jan 24, 2019
c2a79a1
factor out method for better error handling
Jan 24, 2019
ba5d5f2
add constant
Jan 24, 2019
1d80dbd
more and better logs
Jan 24, 2019
6cb50f7
camelcase yaml keys
Jan 24, 2019
02c48c6
fix error message
Jan 24, 2019
e11d56a
fix nit
Jan 24, 2019
9b055d8
add const
Jan 24, 2019
9520f62
add newline
Jan 24, 2019
2ff51c8
remove unused file
Jan 24, 2019
767861a
generate some bad lines in the ingestion carbon test
Jan 24, 2019
dcf2151
fix compilation issue
Jan 24, 2019
cd32d86
add more tests
Jan 24, 2019
b9b2013
improve test to try more error paths
Jan 24, 2019
7e11360
add timeouts for writes
Jan 24, 2019
2d08dcb
add metrics
Jan 24, 2019
c83d2c3
add metrics
Jan 24, 2019
bb1e055
delete TODO
Jan 24, 2019
67de87b
fix lint issues
Jan 25, 2019
7d4504d
fix server.go
Jan 25, 2019
0fdac03
fix server.go
Jan 25, 2019
94579aa
fix broken test
Jan 25, 2019
e35158a
fix cleanup code
Jan 25, 2019
4807443
address config feedback
Jan 25, 2019
e27716f
fix bbroken integration test
Jan 25, 2019
51dbe03
reduce shards in prop test
Jan 25, 2019
379af5e
fix broken integration test
Jan 25, 2019
b9ff591
close readers when done
Jan 25, 2019
29c5a88
fix unit test
Jan 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ docker-integration-test:
@./scripts/docker-integration-tests/setup.sh
@./scripts/docker-integration-tests/simple/test.sh
@./scripts/docker-integration-tests/prometheus/test.sh
# TODO(rartoul): Re-enable once the query P.R lands and we can fix this test.
# @./scripts/docker-integration-tests/carbon/test.sh

.PHONY: site-build
site-build:
Expand Down
2 changes: 2 additions & 0 deletions scripts/development/m3_stack/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ services:
expose:
- "7201"
- "7203"
- "7204"
- "7507"
ports:
- "0.0.0.0:7201:7201"
- "0.0.0.0:7203:7203"
- "0.0.0.0:7204:7204"
- "0.0.0.0:7507:7507"
networks:
- backend
Expand Down
3 changes: 3 additions & 0 deletions scripts/development/m3_stack/m3coordinator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,6 @@ ingest:
jitter: true
handler:
protobufEnabled: false

carbon:
enabled: true
2 changes: 1 addition & 1 deletion scripts/development/m3_stack/start_m3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [[ "$FORCE_BUILD" = true ]] ; then
DOCKER_ARGS="--build -d --renew-anon-volumes"
fi

echo "Bringing up nodes in the backgorund with docker compose, remember to run ./stop.sh when done"
echo "Bringing up nodes in the background with docker compose, remember to run ./stop.sh when done"
docker-compose -f docker-compose.yml up $DOCKER_ARGS m3coordinator01
docker-compose -f docker-compose.yml up $DOCKER_ARGS m3db_seed
docker-compose -f docker-compose.yml up $DOCKER_ARGS prometheus01
Expand Down
28 changes: 28 additions & 0 deletions scripts/docker-integration-tests/carbon/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: "3.5"
services:
dbnode01:
expose:
- "9000-9004"
- "2379-2380"
ports:
- "0.0.0.0:9000-9004:9000-9004"
- "0.0.0.0:2379-2380:2379-2380"
networks:
- backend
image: "m3dbnode_integration:${REVISION}"
coordinator01:
expose:
- "7201"
- "7203"
- "7204"
ports:
- "0.0.0.0:7201:7201"
- "0.0.0.0:7203:7203"
- "0.0.0.0:7204:7204"
networks:
- backend
image: "m3coordinator_integration:${REVISION}"
volumes:
- "./:/etc/m3coordinator/"
networks:
backend:
54 changes: 54 additions & 0 deletions scripts/docker-integration-tests/carbon/m3coordinator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
listenAddress:
type: "config"
value: "0.0.0.0:7201"

metrics:
scope:
prefix: "coordinator"
prometheus:
handlerPath: /metrics
listenAddress: 0.0.0.0:7203 # until https://github.com/m3db/m3/issues/682 is resolved
sanitization: prometheus
samplingRate: 1.0
extended: none

clusters:
- namespaces:
- namespace: agg
type: aggregated
retention: 10h
resolution: 15s
- namespace: unagg
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add a TODO to remove this once unaggregated is no longer mandatory?

type: unaggregated
retention: 10m
client:
config:
service:
env: default_env
zone: embedded
service: m3db
cacheDir: /var/lib/m3kv
etcdClusters:
- zone: embedded
endpoints:
- dbnode01:2379
writeConsistencyLevel: majority
readConsistencyLevel: unstrict_majority
writeTimeout: 10s
fetchTimeout: 15s
connectTimeout: 20s
writeRetry:
initialBackoff: 500ms
backoffFactor: 3
maxRetries: 2
jitter: true
fetchRetry:
initialBackoff: 500ms
backoffFactor: 2
maxRetries: 3
jitter: true
backgroundHealthCheckFailLimit: 4
backgroundHealthCheckFailThrottleFactor: 0.5

carbon:
enabled: true
33 changes: 33 additions & 0 deletions scripts/docker-integration-tests/carbon/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

set -xe

source $GOPATH/src/github.com/m3db/m3/scripts/docker-integration-tests/common.sh
REVISION=$(git rev-parse HEAD)
COMPOSE_FILE=$GOPATH/src/github.com/m3db/m3/scripts/docker-integration-tests/carbon/docker-compose.yml
export REVISION

echo "Run m3dbnode and m3coordinator containers"
docker-compose -f ${COMPOSE_FILE} up -d dbnode01
docker-compose -f ${COMPOSE_FILE} up -d coordinator01

# think of this as a defer func() in golang
function defer {
docker-compose -f ${COMPOSE_FILE} down || echo "unable to shutdown containers" # CI fails to stop all containers sometimes
}
trap defer EXIT
richardartoul marked this conversation as resolved.
Show resolved Hide resolved

setup_single_m3db_node

echo "Writing out a carbon metric"
echo "foo.bar.baz 1 `date +%s`" | nc 0.0.0.0 7204

echo "Attempting to read carbon metric back"
function read_carbon {
end=$(date +%s)
start=$(($end-300))
RESPONSE=$(curl -sSfg "http://localhost:7201/api/v1/query_range?start=$start&end=$end&step=10&query={__graphite0__='foo',__graphite1__='bar',__graphite2__='baz'}")
echo "$RESPONSE" | jq '.data.result[0].values[][1]=="1"' | grep -q "true"
return $?
}
ATTEMPTS=10 TIMEOUT=1 retry_with_backoff read_carbon
96 changes: 96 additions & 0 deletions scripts/docker-integration-tests/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,99 @@ function retry_with_backoff {

return $exitCode
}

function setup_single_m3db_node {
wait_for_db_init
}

function wait_for_db_init {
echo "Sleeping for a bit to ensure db up"
sleep 15 # TODO Replace sleeps with logic to determine when to proceed

echo "Adding namespace"
curl -vvvsSf -X POST 0.0.0.0:7201/api/v1/namespace -d '{
"name": "agg",
"options": {
"bootstrapEnabled": true,
"flushEnabled": true,
"writesToCommitLog": true,
"cleanupEnabled": true,
"snapshotEnabled": true,
"repairEnabled": false,
"retentionOptions": {
"retentionPeriodDuration": "48h",
"blockSizeDuration": "2h",
"bufferFutureDuration": "10m",
"bufferPastDuration": "10m",
"blockDataExpiry": true,
"blockDataExpiryAfterNotAccessPeriodDuration": "5m"
},
"indexOptions": {
"enabled": true,
"blockSizeDuration": "2h"
}
}
}'

echo "Sleep until namespace is init'd"
ATTEMPTS=4 TIMEOUT=1 retry_with_backoff \
'[ "$(curl -sSf 0.0.0.0:7201/api/v1/namespace | jq .registry.namespaces.agg.indexOptions.enabled)" == true ]'

curl -vvvsSf -X POST 0.0.0.0:7201/api/v1/namespace -d '{
"name": "unagg",
"options": {
"bootstrapEnabled": true,
"flushEnabled": true,
"writesToCommitLog": true,
"cleanupEnabled": true,
"snapshotEnabled": true,
"repairEnabled": false,
"retentionOptions": {
"retentionPeriodDuration": "48h",
"blockSizeDuration": "2h",
"bufferFutureDuration": "10m",
"bufferPastDuration": "10m",
"blockDataExpiry": true,
"blockDataExpiryAfterNotAccessPeriodDuration": "5m"
},
"indexOptions": {
"enabled": true,
"blockSizeDuration": "2h"
}
}
}'

echo "Sleep until namespace is init'd"
ATTEMPTS=4 TIMEOUT=1 retry_with_backoff \
'[ "$(curl -sSf 0.0.0.0:7201/api/v1/namespace | jq .registry.namespaces.unagg.indexOptions.enabled)" == true ]'

echo "Placement initialization"
curl -vvvsSf -X POST 0.0.0.0:7201/api/v1/placement/init -d '{
"num_shards": 64,
"replication_factor": 1,
"instances": [
{
"id": "m3db_local",
"isolation_group": "rack-a",
"zone": "embedded",
"weight": 1024,
"endpoint": "dbnode01:9000",
"hostname": "dbnode01",
"port": 9000
}
]
}'

echo "Sleep until placement is init'd"
ATTEMPTS=4 TIMEOUT=1 retry_with_backoff \
'[ "$(curl -sSf 0.0.0.0:7201/api/v1/placement | jq .placement.instances.m3db_local.id)" == \"m3db_local\" ]'

echo "Sleep until bootstrapped"
ATTEMPTS=10 TIMEOUT=2 retry_with_backoff \
'[ "$(curl -sSf 0.0.0.0:9002/health | jq .bootstrapped)" == true ]'

echo "Waiting until shards are marked as available"
ATTEMPTS=10 TIMEOUT=1 retry_with_backoff \
'[ "$(curl -sSf 0.0.0.0:7201/api/v1/placement | grep -c INITIALIZING)" -eq 0 ]'
}

90 changes: 1 addition & 89 deletions scripts/docker-integration-tests/prometheus/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,95 +17,7 @@ function defer {
}
trap defer EXIT


echo "Sleeping for a bit to ensure db up"
sleep 15 # TODO Replace sleeps with logic to determine when to proceed

echo "Adding namespace"
curl -vvvsSf -X POST 0.0.0.0:7201/api/v1/namespace -d '{
"name": "agg",
"options": {
"bootstrapEnabled": true,
"flushEnabled": true,
"writesToCommitLog": true,
"cleanupEnabled": true,
"snapshotEnabled": true,
"repairEnabled": false,
"retentionOptions": {
"retentionPeriodNanos": 172800000000000,
"blockSizeNanos": 7200000000000,
"bufferFutureNanos": 600000000000,
"bufferPastNanos": 600000000000,
"blockDataExpiry": true,
"blockDataExpiryAfterNotAccessPeriodNanos": 300000000000
},
"indexOptions": {
"enabled": true,
"blockSizeNanos": 7200000000000
}
}
}'

echo "Sleep until namespace is init'd"
ATTEMPTS=4 TIMEOUT=1 retry_with_backoff \
'[ "$(curl -sSf 0.0.0.0:7201/api/v1/namespace | jq .registry.namespaces.agg.indexOptions.enabled)" == true ]'

curl -vvvsSf -X POST 0.0.0.0:7201/api/v1/namespace -d '{
"name": "unagg",
"options": {
"bootstrapEnabled": true,
"flushEnabled": true,
"writesToCommitLog": true,
"cleanupEnabled": true,
"snapshotEnabled": true,
"repairEnabled": false,
"retentionOptions": {
"retentionPeriodNanos": 172800000000000,
"blockSizeNanos": 7200000000000,
"bufferFutureNanos": 600000000000,
"bufferPastNanos": 600000000000,
"blockDataExpiry": true,
"blockDataExpiryAfterNotAccessPeriodNanos": 300000000000
},
"indexOptions": {
"enabled": true,
"blockSizeNanos": 7200000000000
}
}
}'

echo "Sleep until namespace is init'd"
ATTEMPTS=4 TIMEOUT=1 retry_with_backoff \
'[ "$(curl -sSf 0.0.0.0:7201/api/v1/namespace | jq .registry.namespaces.unagg.indexOptions.enabled)" == true ]'

echo "Placement initialization"
curl -vvvsSf -X POST 0.0.0.0:7201/api/v1/placement/init -d '{
"num_shards": 64,
"replication_factor": 1,
"instances": [
{
"id": "m3db_local",
"isolation_group": "rack-a",
"zone": "embedded",
"weight": 1024,
"endpoint": "dbnode01:9000",
"hostname": "dbnode01",
"port": 9000
}
]
}'

echo "Sleep until placement is init'd"
ATTEMPTS=4 TIMEOUT=1 retry_with_backoff \
'[ "$(curl -sSf 0.0.0.0:7201/api/v1/placement | jq .placement.instances.m3db_local.id)" == \"m3db_local\" ]'

echo "Sleep until bootstrapped"
ATTEMPTS=10 TIMEOUT=2 retry_with_backoff \
'[ "$(curl -sSf 0.0.0.0:9002/health | jq .bootstrapped)" == true ]'

echo "Waiting until shards are marked as available"
ATTEMPTS=10 TIMEOUT=1 retry_with_backoff \
'[ "$(curl -sSf 0.0.0.0:7201/api/v1/placement | grep -c INITIALIZING)" -eq 0 ]'
setup_single_m3db_node

echo "Start Prometheus containers"
docker-compose -f ${COMPOSE_FILE} up -d prometheus01
Expand Down
Loading