Skip to content

Commit

Permalink
add e2e tests for when consolidateBy is passed
Browse files Browse the repository at this point in the history
  • Loading branch information
mchrome committed Jun 13, 2024
1 parent 5eeaae2 commit d03eb0d
Show file tree
Hide file tree
Showing 3 changed files with 379 additions and 0 deletions.
45 changes: 45 additions & 0 deletions tests/consolidateBy/carbon-clickhouse.conf.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[common]

[data]
path = "/etc/carbon-clickhouse/data"
chunk-interval = "1s"
chunk-auto-interval = ""

[upload.graphite_index]
type = "index"
table = "graphite_index"
url = "{{ .CLICKHOUSE_URL }}/"
timeout = "2m30s"
cache-ttl = "1h"

[upload.graphite_tags]
type = "tagged"
table = "graphite_tags"
threads = 3
url = "{{ .CLICKHOUSE_URL }}/"
timeout = "2m30s"
cache-ttl = "1h"

[upload.graphite_reverse]
type = "points-reverse"
table = "graphite_reverse"
url = "{{ .CLICKHOUSE_URL }}/"
timeout = "2m30s"
zero-timestamp = false

[upload.graphite]
type = "points"
table = "graphite"
url = "{{ .CLICKHOUSE_URL }}/"
timeout = "2m30s"
zero-timestamp = false

[tcp]
listen = ":2003"
enabled = true
drop-future = "0s"
drop-past = "0s"

[logging]
file = "/etc/carbon-clickhouse/carbon-clickhouse.log"
level = "debug"
37 changes: 37 additions & 0 deletions tests/consolidateBy/graphite-clickhouse.conf.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[common]
listen = "{{ .GCH_ADDR }}"
max-cpu = 0
max-metrics-in-render-answer = 10000
max-metrics-per-target = 10000
headers-to-log = [ "X-Ctx-Carbonapi-Uuid" ]

[feature-flags]
use-carbon-behaviour = false
dont-match-missing-tags = true

[clickhouse]
url = "{{ .CLICKHOUSE_URL }}/?max_rows_to_read=500000000&max_result_bytes=1073741824&readonly=2&log_queries=1"
data-timeout = "30s"

index-table = "graphite_index"
index-use-daily = true
index-timeout = "1m"
internal-aggregation = true

tagged-table = "graphite_tags"
tagged-autocomplete-days = 1

[[data-table]]
# # clickhouse table name
table = "graphite"
# # points in table are stored with reverse path
reverse = false
rollup-conf = "auto"

[[logging]]
logger = ""
file = "{{ .GCH_DIR }}/graphite-clickhouse.log"
level = "info"
encoding = "json"
encoding-time = "iso8601"
encoding-duration = "seconds"
297 changes: 297 additions & 0 deletions tests/consolidateBy/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,297 @@
[test]
precision = "10s"

[[test.clickhouse]]
version = "21.3"
dir = "tests/clickhouse/rollup"

[[test.clickhouse]]
version = "22.8"
dir = "tests/clickhouse/rollup"

[[test.clickhouse]]
version = "24.2"
dir = "tests/clickhouse/rollup"

[test.carbon_clickhouse]
template = "carbon-clickhouse.conf.tpl"

[[test.graphite_clickhouse]]
template = "graphite-clickhouse.conf.tpl"

#######################################################################################

[[test.input]]
name = "request_success_total.counter;app=test;project=Test;environment=TEST"
points = [{value = 1.0, time = "rnow-10"}]

[[test.input]]
name = "request_success_total.counter;app=test;project=Test;environment=TEST;t=q"
points = [{value = 1.0, time = "rnow-10"}]

[[test.input]]
name = "test;env=prod"
points = [{value = 1.0, time = "rnow-10"}]

[[test.input]]
name = "test;env=dr"
points = [{value = 1.0, time = "rnow-10"}]

# consolidateBy('max')

[[test.render_checks]]
from = "rnow-10"
until = "rnow+1"
timeout = "1h"
targets = [
"seriesByTag('name=request_success_total.counter', 'app=test', 'project=Test', 'environment=TEST')",
]
filtering_functions = [
"consolidateBy('max')"
]

[[test.render_checks.result]]
name = "request_success_total.counter;app=test;environment=TEST;project=Test"
path = "seriesByTag('name=request_success_total.counter', 'app=test', 'project=Test', 'environment=TEST')"
consolidation = "max"
start = "rnow-10"
stop = "rnow+10"
step = 10
req_start = "rnow-10"
req_stop = "rnow+10"
values = [1.0, nan]

[[test.render_checks.result]]
name = "request_success_total.counter;app=test;environment=TEST;project=Test;t=q"
path = "seriesByTag('name=request_success_total.counter', 'app=test', 'project=Test', 'environment=TEST')"
consolidation = "max"
start = "rnow-10"
stop = "rnow+10"
step = 10
req_start = "rnow-10"
req_stop = "rnow+10"
values = [1.0, nan]

# consolidateBy('min')

[[test.render_checks]]
from = "rnow-10"
until = "rnow+1"
timeout = "1h"
targets = [
"seriesByTag('name=request_success_total.counter', 'app=test', 'project=Test', 'environment=TEST')",
]
filtering_functions = [
"consolidateBy('min')"
]

[[test.render_checks.result]]
name = "request_success_total.counter;app=test;environment=TEST;project=Test"
path = "seriesByTag('name=request_success_total.counter', 'app=test', 'project=Test', 'environment=TEST')"
consolidation = "min"
start = "rnow-10"
stop = "rnow+10"
step = 10
req_start = "rnow-10"
req_stop = "rnow+10"
values = [1.0, nan]

[[test.render_checks.result]]
name = "request_success_total.counter;app=test;environment=TEST;project=Test;t=q"
path = "seriesByTag('name=request_success_total.counter', 'app=test', 'project=Test', 'environment=TEST')"
consolidation = "min"
start = "rnow-10"
stop = "rnow+10"
step = 10
req_start = "rnow-10"
req_stop = "rnow+10"
values = [1.0, nan]

# consolidateBy('sum')

[[test.render_checks]]
from = "rnow-10"
until = "rnow+1"
timeout = "1h"
targets = [
"seriesByTag('name=request_success_total.counter', 'app=test', 'project=Test', 'environment=TEST')",
]
filtering_functions = [
"consolidateBy('sum')"
]

[[test.render_checks.result]]
name = "request_success_total.counter;app=test;environment=TEST;project=Test"
path = "seriesByTag('name=request_success_total.counter', 'app=test', 'project=Test', 'environment=TEST')"
consolidation = "sum"
start = "rnow-10"
stop = "rnow+10"
step = 10
req_start = "rnow-10"
req_stop = "rnow+10"
values = [1.0, nan]

[[test.render_checks.result]]
name = "request_success_total.counter;app=test;environment=TEST;project=Test;t=q"
path = "seriesByTag('name=request_success_total.counter', 'app=test', 'project=Test', 'environment=TEST')"
consolidation = "sum"
start = "rnow-10"
stop = "rnow+10"
step = 10
req_start = "rnow-10"
req_stop = "rnow+10"
values = [1.0, nan]

# consolidateBy('avg')

[[test.render_checks]]
from = "rnow-10"
until = "rnow+1"
timeout = "1h"
targets = [
"seriesByTag('name=request_success_total.counter', 'app=test', 'project=Test', 'environment=TEST')",
]
filtering_functions = [
"consolidateBy('avg')"
]

[[test.render_checks.result]]
name = "request_success_total.counter;app=test;environment=TEST;project=Test"
path = "seriesByTag('name=request_success_total.counter', 'app=test', 'project=Test', 'environment=TEST')"
consolidation = "avg"
start = "rnow-10"
stop = "rnow+10"
step = 10
req_start = "rnow-10"
req_stop = "rnow+10"
values = [1.0, nan]

[[test.render_checks.result]]
name = "request_success_total.counter;app=test;environment=TEST;project=Test;t=q"
path = "seriesByTag('name=request_success_total.counter', 'app=test', 'project=Test', 'environment=TEST')"
consolidation = "avg"
start = "rnow-10"
stop = "rnow+10"
step = 10
req_start = "rnow-10"
req_stop = "rnow+10"
values = [1.0, nan]

# consolidateBy('average')

[[test.render_checks]]
from = "rnow-10"
until = "rnow+1"
timeout = "1h"
targets = [
"seriesByTag('name=request_success_total.counter', 'app=test', 'project=Test', 'environment=TEST')",
]
filtering_functions = [
"consolidateBy('average')"
]

[[test.render_checks.result]]
name = "request_success_total.counter;app=test;environment=TEST;project=Test"
path = "seriesByTag('name=request_success_total.counter', 'app=test', 'project=Test', 'environment=TEST')"
consolidation = "avg"
start = "rnow-10"
stop = "rnow+10"
step = 10
req_start = "rnow-10"
req_stop = "rnow+10"
values = [1.0, nan]

[[test.render_checks.result]]
name = "request_success_total.counter;app=test;environment=TEST;project=Test;t=q"
path = "seriesByTag('name=request_success_total.counter', 'app=test', 'project=Test', 'environment=TEST')"
consolidation = "avg"
start = "rnow-10"
stop = "rnow+10"
step = 10
req_start = "rnow-10"
req_stop = "rnow+10"
values = [1.0, nan]

# consolidateBy('last')

[[test.render_checks]]
from = "rnow-10"
until = "rnow+1"
timeout = "1h"
targets = [
"seriesByTag('name=request_success_total.counter', 'app=test', 'project=Test', 'environment=TEST')",
]
filtering_functions = [
"consolidateBy('last')"
]

[[test.render_checks.result]]
name = "request_success_total.counter;app=test;environment=TEST;project=Test"
path = "seriesByTag('name=request_success_total.counter', 'app=test', 'project=Test', 'environment=TEST')"
consolidation = "last"
start = "rnow-10"
stop = "rnow+10"
step = 10
req_start = "rnow-10"
req_stop = "rnow+10"
values = [1.0, nan]

[[test.render_checks.result]]
name = "request_success_total.counter;app=test;environment=TEST;project=Test;t=q"
path = "seriesByTag('name=request_success_total.counter', 'app=test', 'project=Test', 'environment=TEST')"
consolidation = "last"
start = "rnow-10"
stop = "rnow+10"
step = 10
req_start = "rnow-10"
req_stop = "rnow+10"
values = [1.0, nan]

# consolidateBy('first')

[[test.render_checks]]
from = "rnow-10"
until = "rnow+1"
timeout = "1h"
targets = [
"seriesByTag('name=request_success_total.counter', 'app=test', 'project=Test', 'environment=TEST')",
]
filtering_functions = [
"consolidateBy('first')"
]

[[test.render_checks.result]]
name = "request_success_total.counter;app=test;environment=TEST;project=Test"
path = "seriesByTag('name=request_success_total.counter', 'app=test', 'project=Test', 'environment=TEST')"
consolidation = "first"
start = "rnow-10"
stop = "rnow+10"
step = 10
req_start = "rnow-10"
req_stop = "rnow+10"
values = [1.0, nan]

[[test.render_checks.result]]
name = "request_success_total.counter;app=test;environment=TEST;project=Test;t=q"
path = "seriesByTag('name=request_success_total.counter', 'app=test', 'project=Test', 'environment=TEST')"
consolidation = "first"
start = "rnow-10"
stop = "rnow+10"
step = 10
req_start = "rnow-10"
req_stop = "rnow+10"
values = [1.0, nan]

# consolidateBy('invalid')

[[test.render_checks]]
from = "rnow-10"
until = "rnow+1"
timeout = "1h"
targets = [
"seriesByTag('name=request_success_total.counter', 'app=test', 'project=Test', 'environment=TEST')",
]
filtering_functions = [
"consolidateBy('invalid')"
]
error_regexp = "^500: Storage error"

0 comments on commit d03eb0d

Please sign in to comment.