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 listeners metrics #3922

Merged
merged 3 commits into from
Jun 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
26 changes: 25 additions & 1 deletion envoy/datadog_checks/envoy/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1063,14 +1063,38 @@
),
'method': 'monotonic_count',
},
'listener.ssl.cipher': {
'listener.ssl.ciphers': {
'tags': (
('address', ),
(),
('cipher', ),
),
'method': 'monotonic_count',
},
'listener.ssl.versions': {
'tags': (
('address', ),
(),
('version', ),
),
'method': 'monotonic_count',
},
'listener.ssl.curves': {
'tags': (
('address', ),
(),
('curve', ),
),
'method': 'monotonic_count',
},
'listener.ssl.sigalgs': {
'tags': (
('address', ),
(),
('sigalg', ),
),
'method': 'monotonic_count',
},
'listener_manager.listener_added': {
'tags': (
(),
Expand Down
5 changes: 4 additions & 1 deletion envoy/metadata.csv
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ envoy.listener.ssl.fail_verify_no_cert,count,,connection,,Total TLS connections
envoy.listener.ssl.fail_verify_error,count,,connection,,Total TLS connections that failed CA verification,-1,envoy,
envoy.listener.ssl.fail_verify_san,count,,connection,,Total TLS connections that failed SAN verification,-1,envoy,
envoy.listener.ssl.fail_verify_cert_hash,count,,connection,,Total TLS connections that failed certificate pinning verification,-1,envoy,
envoy.listener.ssl.cipher,count,,connection,,Total TLS connections that used cipher tag,0,envoy,
envoy.listener.ssl.ciphers,count,,connection,,Total TLS connections that used cipher tag,0,envoy,
envoy.listener.ssl.versions,count,,connection,,Total successful TLS connections that used protocol version tag,0,envoy,
envoy.listener.ssl.curves,count,,connection,,Total successful TLS connections that used ECDHE curve tag,0,envoy,
envoy.listener.ssl.sigalgs,count,,connection,,Total successful TLS connections that used signature algorithm sigalg tag,0,envoy,
envoy.listener_manager.listener_added,count,,host,,Total listeners added (either via static config or LDS),0,envoy,
envoy.listener_manager.listener_modified,count,,host,,Total listeners modified (via LDS),0,envoy,
envoy.listener_manager.listener_removed,count,,host,,Total listeners removed (via LDS),0,envoy,
Expand Down
5 changes: 5 additions & 0 deletions envoy/tests/fixtures/multiple_services
Original file line number Diff line number Diff line change
Expand Up @@ -4273,6 +4273,11 @@ listener.00.00.00.00_0000.downstream_cx_total: 0
listener.00.00.00.00_0000.downstream_cx_active: 0
listener.00.00.00.00_0000.downstream_cx_destroy: 0
listener.00.00.00.00_0000.downstream_cx_total: 0
listener.00.00.00.00_0000.ssl.ciphers.AEAD-AES256-GCM-SHA384: 3
listener.00.00.00.00_0000.ssl.versions.TLSv1.2: 13108
listener.00.00.00.00_0000.ssl.versions.TLSv1.3: 7
listener.00.00.00.00_0000.ssl.curves.P-256: 76
listener.00.00.00.00_0000.ssl.sigalgs.rsa_pss_rsae_sha256: 0
listener.admin.downstream_cx_active: 1
listener.admin.downstream_cx_destroy: 3
listener.admin.downstream_cx_total: 4
Expand Down
2 changes: 1 addition & 1 deletion envoy/tests/test_envoy.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_success_fixture(self, aggregator):

num_metrics = len(response('multiple_services').content.decode().splitlines())
num_metrics -= sum(c.unknown_metrics.values()) + sum(c.unknown_tags.values())
assert 4150 <= metrics_collected == num_metrics
assert 4155 <= metrics_collected == num_metrics

def test_success_fixture_whitelist(self, aggregator):
instance = INSTANCES['whitelist']
Expand Down
46 changes: 44 additions & 2 deletions envoy/tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,11 @@ def test_mongo_collection(self):
)

def test_listener(self):
metric = 'listener{}.ssl.cipher{}'
metric = 'listener{}.ssl.ciphers{}'
untagged_metric = metric.format('', '')
tags = [tag for tags in METRICS[untagged_metric]['tags'] for tag in tags]
tag0 = '0.0.0.0_80'
tag1 = 'some_cipher'
tag1 = 'some_ciphers'
tagged_metric = metric.format('.{}'.format(tag0), '.{}'.format(tag1))

assert parse_metric(tagged_metric) == (
Expand All @@ -305,6 +305,48 @@ def test_listener_manager(self):

assert parse_metric(metric) == (METRIC_PREFIX + metric, list(tags), METRICS[metric]['method'])

def test_listener_tls(self):
metric = 'listener{}.ssl.versions{}'
untagged_metric = metric.format('', '')
tags = [tag for tags in METRICS[untagged_metric]['tags'] for tag in tags]
tag0 = '0.0.0.0'
tag1 = 'TLSv1.2'
tagged_metric = metric.format('.{}'.format(tag0), '.{}'.format(tag1))

assert parse_metric(tagged_metric) == (
METRIC_PREFIX + untagged_metric,
['{}:{}'.format(tags[0], tag0), '{}:{}'.format(tags[1], tag1)],
METRICS[untagged_metric]['method'],
)

def test_listener_curves(self):
metric = 'listener{}.ssl.curves{}'
untagged_metric = metric.format('', '')
tags = [tag for tags in METRICS[untagged_metric]['tags'] for tag in tags]
tag0 = '0.0.0.0'
tag1 = 'P-256'
tagged_metric = metric.format('.{}'.format(tag0), '.{}'.format(tag1))

assert parse_metric(tagged_metric) == (
METRIC_PREFIX + untagged_metric,
['{}:{}'.format(tags[0], tag0), '{}:{}'.format(tags[1], tag1)],
METRICS[untagged_metric]['method'],
)

def test_listener_sigalgs(self):
metric = 'listener{}.ssl.sigalgs{}'
untagged_metric = metric.format('', '')
tags = [tag for tags in METRICS[untagged_metric]['tags'] for tag in tags]
tag0 = '0.0.0.0'
tag1 = 'rsa_pss_rsae_sha256'
tagged_metric = metric.format('.{}'.format(tag0), '.{}'.format(tag1))

assert parse_metric(tagged_metric) == (
METRIC_PREFIX + untagged_metric,
['{}:{}'.format(tags[0], tag0), '{}:{}'.format(tags[1], tag1)],
METRICS[untagged_metric]['method'],
)

def test_http(self):
metric = 'http{}.downstream_cx_total'
untagged_metric = metric.format('')
Expand Down