|
1 | 1 | package datadog.trace.bootstrap
|
2 | 2 |
|
| 3 | +import groovy.json.JsonBuilder |
3 | 4 | import spock.lang.Specification
|
4 | 5 |
|
5 | 6 | import static java.nio.charset.StandardCharsets.UTF_8
|
@@ -108,18 +109,18 @@ class BootstrapInitializationTelemetryTest extends Specification {
|
108 | 109 |
|
109 | 110 | def "unwind root cause"() {
|
110 | 111 | when:
|
111 |
| - initTelemetry.initMetaInfo("runtime_name", "java") |
112 |
| - initTelemetry.initMetaInfo("runtime_version", "1.8.0_382") |
113 |
| - |
114 | 112 | initTelemetry.onError(new Exception("top cause", new FileNotFoundException("root cause")))
|
115 | 113 | initTelemetry.finish()
|
116 | 114 |
|
117 | 115 | then:
|
118 |
| - capture.json() == '{"metadata":{"runtime_name":"java","runtime_version":"1.8.0_382"},"points":[{"name":"library_entrypoint.error","tags":["error_type:java.io.FileNotFoundException","error_type:java.lang.Exception"]},{"name":"library_entrypoint.complete"}]}' |
| 116 | + capture.json() == json("error", "internal_error", "top cause", [ |
| 117 | + [name: "library_entrypoint.error", tags: ["error_type:java.io.FileNotFoundException", "error_type:java.lang.Exception"]], |
| 118 | + [name: "library_entrypoint.complete"] |
| 119 | + ]) |
119 | 120 | }
|
120 | 121 |
|
121 |
| - private String json(String result, String resultClass, String resultReason, List points) { |
122 |
| - return """{"metadata":{"runtime_name":"java","runtime_version":"1.8.0_382","result":"${result}","result_class":"${resultClass}","result_reason":"${resultReason}"},"points":${new groovy.json.JsonBuilder(points)}}""" |
| 122 | + private static String json(String result, String resultClass, String resultReason, List points) { |
| 123 | + return """{"metadata":{"runtime_name":"java","runtime_version":"1.8.0_382","result":"${result}","result_class":"${resultClass}","result_reason":"${resultReason}"},"points":${new JsonBuilder(points)}}""" |
123 | 124 | }
|
124 | 125 |
|
125 | 126 | static class Capture implements BootstrapInitializationTelemetry.JsonSender {
|
|
0 commit comments