Skip to content

Commit

Permalink
Revert "Submit total_alloc as monotonic count (#5703)" (#5972)
Browse files Browse the repository at this point in the history
This reverts commit ad21e77.
  • Loading branch information
ofek committed Mar 5, 2020
1 parent ce07658 commit f43729f
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 24 deletions.
11 changes: 4 additions & 7 deletions go_expvar/datadog_checks/go_expvar/go_expvar.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
DEFAULT_GAUGE_MEMSTAT_METRICS = [
# General statistics
"Alloc",
"TotalAlloc",
# Main allocation heap statistics
"HeapAlloc",
"HeapSys",
Expand All @@ -59,13 +60,9 @@
"NumGC",
]

DEFAULT_COUNTER_METRICS = ["TotalAlloc"]

DEFAULT_METRICS = (
[{PATH: "memstats/%s" % path, TYPE: GAUGE} for path in DEFAULT_GAUGE_MEMSTAT_METRICS]
+ [{PATH: "memstats/%s" % path, TYPE: RATE} for path in DEFAULT_RATE_MEMSTAT_METRICS]
+ [{PATH: "memstats/%s" % path, TYPE: MONOTONIC_COUNTER} for path in DEFAULT_COUNTER_METRICS]
)
DEFAULT_METRICS = [{PATH: "memstats/%s" % path, TYPE: GAUGE} for path in DEFAULT_GAUGE_MEMSTAT_METRICS] + [
{PATH: "memstats/%s" % path, TYPE: RATE} for path in DEFAULT_RATE_MEMSTAT_METRICS
]

GO_EXPVAR_URL_PATH = "/debug/vars"

Expand Down
2 changes: 1 addition & 1 deletion go_expvar/metadata.csv
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ go_expvar.memstats.pause_ns.count,rate,,sample,second,Number of submitted GC pau
go_expvar.memstats.pause_ns.max,gauge,,nanosecond,,Max GC pause duration,0,go_expvar,gc pause max
go_expvar.memstats.pause_ns.median,gauge,,nanosecond,,Median GC pause duration,0,go_expvar,gc pause median
go_expvar.memstats.pause_total_ns,gauge,,nanosecond,,Total GC pause duration over lifetime of process,0,go_expvar,gc pause tot
go_expvar.memstats.total_alloc,count,,byte,,Bytes allocated (even if freed),0,go_expvar,total alloc
go_expvar.memstats.total_alloc,gauge,,byte,,Bytes allocated (even if freed),0,go_expvar,total alloc
5 changes: 1 addition & 4 deletions go_expvar/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
'go_expvar.memstats.heap_objects',
'go_expvar.memstats.heap_released',
'go_expvar.memstats.heap_sys',
'go_expvar.memstats.total_alloc',
]

# this is a histogram
Expand All @@ -47,7 +48,3 @@
'go_expvar.memstats.num_gc',
'go_expvar.memstats.pause_total_ns',
]

CHECK_COUNT = [
'go_expvar.memstats.total_alloc',
]
2 changes: 0 additions & 2 deletions go_expvar/tests/test_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,5 @@ def test_check_e2e(dd_agent_check):
aggregator.assert_metric(gauge, count=1, tags=shared_tags)
for rate in common.CHECK_RATES + CHECK_RATES_CUSTOM:
aggregator.assert_metric(rate, count=2, tags=shared_tags)
for count in common.CHECK_COUNT:
aggregator.assert_metric(count, count=2, tags=shared_tags)

aggregator.assert_all_metrics_covered()
2 changes: 0 additions & 2 deletions go_expvar/tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,5 @@ def test_go_expvar(check, aggregator):
aggregator.assert_metric(rate, count=1, tags=shared_tags)
for rate, value in iteritems(CHECK_RATES_CUSTOM):
aggregator.assert_metric(rate, count=1, value=value, tags=shared_tags)
for count in common.CHECK_COUNT:
aggregator.assert_metric(count, count=1, metric_type=3, tags=shared_tags)

aggregator.assert_all_metrics_covered()
9 changes: 1 addition & 8 deletions go_expvar/tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
'{}.memstats.heap_objects',
'{}.memstats.heap_released',
'{}.memstats.heap_sys',
'{}.memstats.total_alloc',
]

# this is a histogram
Expand All @@ -33,8 +34,6 @@
'{}.memstats.pause_total_ns',
]

CHECK_COUNT = ['{}.memstats.total_alloc']

CHECK_GAUGES_CUSTOM_MOCK = {
'{}.gauge1': ['metric_tag1:metric_value1', 'metric_tag2:metric_value2', 'path:random_walk'],
'{}.memstats.by_size.1.mallocs': [],
Expand Down Expand Up @@ -103,10 +102,6 @@ def test_go_expvar_mocked(go_expvar_mock, check, aggregator):
metric_type=aggregator.COUNT,
tags=shared_tags + ['path:memstats.NumGC'],
)
for count in CHECK_COUNT:
aggregator.assert_metric(
count.format(common.CHECK_NAME), count=1, metric_type=aggregator.MONOTONIC_COUNT, tags=shared_tags,
)

aggregator.assert_all_metrics_covered()

Expand Down Expand Up @@ -153,8 +148,6 @@ def test_go_expvar_mocked_namespace(go_expvar_mock, check, aggregator):
aggregator.assert_metric(
rate.format(metric_namespace), count=1, tags=shared_tags + ['path:memstats.PauseTotalNs']
)
for count in CHECK_COUNT:
aggregator.assert_metric(count.format(metric_namespace), tags=shared_tags)

aggregator.assert_all_metrics_covered()

Expand Down

0 comments on commit f43729f

Please sign in to comment.