-
Notifications
You must be signed in to change notification settings - Fork 525
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests/system: system test for Jaeger Thrift/HTTP (#3114)
* tests/system: system test for Jaeger Thrift/HTTP
- Loading branch information
Showing
6 changed files
with
181 additions
and
67 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
[ | ||
{ | ||
"transaction": { | ||
"sampled": true, | ||
"name": "test_span", | ||
"result": "Success", | ||
"duration": { | ||
"us": 2 | ||
}, | ||
"type": "custom", | ||
"id": "5025e08c7fef6542" | ||
}, | ||
"trace": { | ||
"id": "00000000000000005025e08c7fef6542" | ||
}, | ||
"observer": { | ||
"ephemeral_id": "39dd6032-fa6c-4b9e-9fab-f35ea6ef8dfe", | ||
"version_major": 8, | ||
"hostname": "alloy", | ||
"version": "8.0.0", | ||
"type": "apm-server", | ||
"id": "901ad5b3-b313-4c2d-a7a0-2d188005f25e" | ||
}, | ||
"timestamp": { | ||
"us": 1578451731616515 | ||
}, | ||
"@timestamp": "2020-01-08T02:48:51.616Z", | ||
"labels": { | ||
"sampler_type": "const", | ||
"sampler_param": true | ||
}, | ||
"agent": { | ||
"ephemeral_id": "3a5c6b00dd41a605", | ||
"name": "Jaeger/Go", | ||
"version": "2.21.2-dev" | ||
}, | ||
"host": { | ||
"ip": "10.1.1.101", | ||
"hostname": "alloy", | ||
"name": "alloy" | ||
}, | ||
"service": { | ||
"node": { | ||
"name": "alloy" | ||
}, | ||
"name": "test_service", | ||
"language": { | ||
"name": "Go" | ||
} | ||
}, | ||
"ecs": { | ||
"version": "1.2.0" | ||
}, | ||
"processor": { | ||
"name": "transaction", | ||
"event": "transaction" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import re | ||
|
||
import requests | ||
|
||
from apmserver import integration_test | ||
from apmserver import ElasticTest | ||
|
||
|
||
@integration_test | ||
class Test(ElasticTest): | ||
jaeger_http_host = "localhost:14268" | ||
|
||
def setUp(self): | ||
super(Test, self).setUp() | ||
self.wait_until(lambda: self.log_contains("Listening for Jaeger HTTP"), name="Jaeger HTTP listener started") | ||
|
||
# Extract the Jaeger HTTP server address. | ||
match = re.search("Listening for Jaeger HTTP requests on: (.*)$", self.get_log(), re.MULTILINE) | ||
listen_addr = match.group(1) | ||
self.jaeger_http_url = "http://{}/{}".format(listen_addr, 'api/traces') | ||
|
||
def config(self): | ||
cfg = super(Test, self).config() | ||
cfg.update({ | ||
"jaeger_http_enabled": "true", | ||
"jaeger_http_host": "localhost:0", # Listen on a dynamic port | ||
}) | ||
return cfg | ||
|
||
def test_jaeger_http(self): | ||
""" | ||
This test sends a Jaeger span in Thrift encoding over HTTP, and verifies that it is indexed. | ||
""" | ||
jaeger_span_thrift = self.get_testdata_path('jaeger', 'span.thrift') | ||
self.load_docs_with_template(jaeger_span_thrift, self.jaeger_http_url, 'transaction', 1, | ||
extra_headers={"content-type": "application/vnd.apache.thrift.binary"}) | ||
self.assert_no_logged_warnings() | ||
|
||
rs = self.es.search(index=self.index_transaction) | ||
assert rs['hits']['total']['value'] == 1, "found {} documents".format(rs['count']) | ||
self.approve_docs('jaeger_span', rs['hits']['hits'], 'transaction') |