Skip to content

Commit 1e32477

Browse files
committed
wip: sync cross agent tests
1 parent e84d9fe commit 1e32477

File tree

9 files changed

+550
-124
lines changed

9 files changed

+550
-124
lines changed

test/integration/distributed-tracing/trace-context-cross-agent.test.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ async function runTestCase(testCase, parentTest) {
268268
testExpectedFixtureKeys(testCase, [
269269
'account_id',
270270
'expected_metrics',
271-
'force_sampled_true',
271+
'force_adaptive_sampled_true',
272272
'inbound_headers',
273273
'intrinsics',
274274
'outbound_payloads',
@@ -279,7 +279,13 @@ async function runTestCase(testCase, parentTest) {
279279
'trusted_account_key',
280280
'web_transaction',
281281
'comment',
282-
'transaction_events_enabled'
282+
'transaction_events_enabled',
283+
// Sampling
284+
'remote_parent_sampled',
285+
'remote_parent_not_sampled',
286+
'root',
287+
'ratio',
288+
'expected_priority_between'
283289
])
284290

285291
if (testCase.outbound_payloads) {
@@ -356,7 +362,7 @@ async function runTestCase(testCase, parentTest) {
356362

357363
// monkey patch this transaction object
358364
// to force sampled to be true.
359-
if (testCase.force_sampled_true) {
365+
if (testCase.force_adaptive_sampled_true) {
360366
transaction.agent.transactionSampler.shouldSample = function stubShouldSample() {
361367
return true
362368
}

test/lib/cross_agent_tests/distributed_tracing/README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ the agent under test. Here's what the various fields in each test case mean:
1414
| `account_id` | The account id the agent would receive on connect. |
1515
| `web_transaction` | Whether the transaction that's tested is a web transaction or not. |
1616
| `raises_exception` | Whether to simulate an exception happening within the transaction or not, resulting in a transaction error event. |
17-
| `force_sampled_true` | Whether to force a transaction to be sampled or not. |
17+
| `root` | The sampler to use for transactions at the root of a trace. |
18+
| `remote_parent_sampled` | The sampler to use for transactions with a remote parent. |
19+
| `remote_parent_not_sampled` | The sampler to use for transactions with a remote parent that is not sampled. |
20+
| `expected_priority_between` | The inclusive range of the expected priority value on the generated transaction event. |
21+
| `force_adaptive_sampled_true` | Whether to force a transaction to be sampled or not when the adaptive sampler is used. |
22+
| `ratio` | The ratio to use for all of the trace ID ratio samplers defined in the test. For testing purposes we are not defining different ratios for each trace ID ratio sampler instance. If that is necessary, we will need a different way to configure the ratios. |
1823
| `transport_type` | The transport type for the inbound request. |
1924
| `inbound_headers` | The headers you should mock coming into the agent. |
2025
| `outbound_payloads` | The exact/expected/unexpected values for outbound `w3c` headers. |
@@ -23,6 +28,14 @@ the agent under test. Here's what the various fields in each test case mean:
2328
| `span_events_enabled` | Whether span events are enabled in the agent or not. |
2429
| `transaction_events_enabled` | Whether transaction events are enabled in the agent or not. |
2530

31+
The samplers that can referenced in the `root`, `remote_parent_sampled`, and `remote_parent_not_sampled` fields are:
32+
33+
- `default`: Use the adaptive sampler.
34+
- `adaptive`: Use the adaptive sampler.
35+
- `trace_id_ratio_based`: Use the trace ID ratio sampler.
36+
- `always_on`: Use the always on sampler.
37+
- `always_off`: Use the always off sampler.
38+
2639
The `outbound_payloads` and `intrinsics` field can have nested values, for example:
2740
```javascript
2841
...

test/lib/cross_agent_tests/distributed_tracing/distributed_tracing.json

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -796,78 +796,6 @@
796796
["Supportability/DistributedTrace/CreatePayload/Success", 2]
797797
]
798798
},
799-
{
800-
"test_name": "payload_from_trusted_partnership_account",
801-
"trusted_account_key": "44",
802-
"account_id": "11",
803-
"web_transaction": true,
804-
"raises_exception": false,
805-
"force_sampled_true": false,
806-
"span_events_enabled": true,
807-
"major_version": 0,
808-
"minor_version": 1,
809-
"transport_type": "HTTP",
810-
"inbound_payloads": [
811-
{
812-
"v": [0, 1],
813-
"d": {
814-
"ac": "33",
815-
"ap": "2827902",
816-
"tx": "e8b91a159289ff74",
817-
"pr": 0.123456,
818-
"sa": false,
819-
"ti": 1518469636035,
820-
"tr": "d6b4ba0c3a712ca",
821-
"tk": "44",
822-
"ty": "App"
823-
}
824-
}
825-
],
826-
"outbound_payloads": [
827-
{
828-
"exact": {
829-
"v": [0, 1],
830-
"d.ac": "11",
831-
"d.pr": 0.123456,
832-
"d.sa": false,
833-
"d.tr": "d6b4ba0c3a712ca",
834-
"d.tk": "44",
835-
"d.ty": "App"
836-
},
837-
"expected": ["d.ap", "d.tx", "d.ti"],
838-
"unexpected": ["d.id"]
839-
}
840-
],
841-
"intrinsics": {
842-
"target_events": ["Transaction"],
843-
"common":{
844-
"exact": {
845-
"parent.type": "App",
846-
"parent.app": "2827902",
847-
"parent.account": "33",
848-
"parent.transportType": "HTTP",
849-
"traceId": "d6b4ba0c3a712ca",
850-
"priority": 0.123456,
851-
"sampled": false
852-
},
853-
"expected": ["parent.transportDuration", "guid"],
854-
"unexpected": ["grandparentId", "cross_process_id", "nr.tripId", "nr.pathHash", "nr.referringPathHash", "nr.guid", "nr.referringTransactionGuid", "nr.alternatePathHashes"]
855-
},
856-
"Transaction": {
857-
"exact": {
858-
"parentId": "e8b91a159289ff74"
859-
}
860-
}
861-
},
862-
"expected_metrics": [
863-
["DurationByCaller/App/33/2827902/HTTP/all", 1],
864-
["DurationByCaller/App/33/2827902/HTTP/allWeb", 1],
865-
["TransportDuration/App/33/2827902/HTTP/all", 1],
866-
["TransportDuration/App/33/2827902/HTTP/allWeb", 1],
867-
["Supportability/DistributedTrace/AcceptPayload/Success", 1],
868-
["Supportability/DistributedTrace/CreatePayload/Success", 1]
869-
]
870-
},
871799
{
872800
"test_name": "payload_has_larger_minor_version",
873801
"trusted_account_key": "33",

0 commit comments

Comments
 (0)