private Url newUrl() { return new Url() .withHostname("localhost") .withPathname("/foo") .withPort(8080) .withProtocol("http") .withSearch("foo=bar") .appendToFull("http://localhost:8080/foo?foo=bar"); } }
private void innerRecordExceptionWithTrace(boolean sampled) { reporter.reset(); Transaction transaction = tracerImpl.startTransaction(TraceContext.asRoot(), null, ConstantSampler.of(sampled), -1); transaction.withType("test-type"); try (Scope scope = transaction.activateInScope()) { transaction.getContext().getRequest() .addHeader("foo", "bar") .withMethod("GET") .getUrl() .withPathname("/foo"); tracerImpl.currentTransaction().captureException(new Exception("from transaction")); ErrorCapture error = validateError(transaction, sampled, transaction); assertThat(error.getContext().getRequest().getHeaders().get("foo")).isEqualTo("bar"); reporter.reset(); Span span = transaction.createSpan().activate(); span.captureException(new Exception("from span")); validateError(span, sampled, transaction); span.deactivate().end(); transaction.end(); } }
.withHostname("www.example.com") .withPort(8080) .withPathname("/p/a/t/h") .withSearch("?query=string"); request.getSocket()
.withHostname("www.example.com") .withPort(8080) .withPathname("/p/a/t/h") .withSearch("?query=string"); request.getSocket()