-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
Description
Now that we have a Hilla module for backend and frontend observability, we need to verify that data is exported correctly.
We can approach this in the same way we did for flow, using the OTLP exported and a MockServer instance:
Lines 33 to 61 in e5d1200
| @ExtendWith(MockServerExtension.class) | |
| @MockServerSettings(ports = { MainViewIT.EXPORTER_ENDPOINT_PORT }) | |
| public class MainViewIT extends AbstractViewIT { | |
| static final int EXPORTER_ENDPOINT_PORT = 4318; | |
| private static final int AWAIT_TIMEOUT = 15; | |
| private ClientAndServer collector; | |
| @BeforeEach | |
| public void navigateToView(ClientAndServer collector) throws Exception { | |
| this.collector = collector; | |
| this.collector.when(request()).respond(response().withStatusCode(200)); | |
| // Wait for the view to be rendered | |
| waitUntil(driver -> $(H1Element.class).exists()); | |
| } | |
| @BrowserTest | |
| public void verifyExportedTraces() { | |
| await().atMost(AWAIT_TIMEOUT, TimeUnit.SECONDS).untilAsserted(() -> { | |
| var requests = collector.retrieveRecordedRequests(request()); | |
| var spans = extractSpansFromRequests(requests); | |
| assertThat(spans).extracting(Span::getName) | |
| .contains("SessionRequestHandler.handleRequest"); | |
| }); | |
| } |