Search in sources :

Example 61 with SpanEvent

use of com.newrelic.agent.model.SpanEvent in project newrelic-java-agent by newrelic.

the class SpanEventFactoryTest method uriShouldBeSet.

@Test
public void uriShouldBeSet() {
    SpanEvent target = spanEventFactory.setUri(URI.create("https://newrelic.com")).build();
    assertEquals("https://newrelic.com", target.getAgentAttributes().get("http.url"));
}
Also used : SpanEvent(com.newrelic.agent.model.SpanEvent) Test(org.junit.Test)

Example 62 with SpanEvent

use of com.newrelic.agent.model.SpanEvent in project newrelic-java-agent by newrelic.

the class SpanEventFactoryTest method addressShouldBeSet.

@Test
public void addressShouldBeSet() {
    SpanEvent target = spanEventFactory.setAddress("localhost", "3306").build();
    assertEquals("localhost:3306", target.getIntrinsics().get("peer.address"));
}
Also used : SpanEvent(com.newrelic.agent.model.SpanEvent) Test(org.junit.Test)

Example 63 with SpanEvent

use of com.newrelic.agent.model.SpanEvent in project newrelic-java-agent by newrelic.

the class SpanEventFactoryTest method shouldSetStatusText.

@Test
public void shouldSetStatusText() {
    SpanEvent spanEvent = spanEventFactory.setHttpStatusText("I'm a teapot.").build();
    assertEquals("I'm a teapot.", spanEvent.getAgentAttributes().get("http.statusText"));
}
Also used : SpanEvent(com.newrelic.agent.model.SpanEvent) Test(org.junit.Test)

Example 64 with SpanEvent

use of com.newrelic.agent.model.SpanEvent in project newrelic-java-agent by newrelic.

the class SpanEventFactoryTest method doesNotSetHttpAgentAttributesWhenFiltering.

@Test
public void doesNotSetHttpAgentAttributesWhenFiltering() {
    HttpParameters mockParameters = mock(HttpParameters.class);
    when(mockParameters.getLibrary()).thenReturn("library");
    when(mockParameters.getProcedure()).thenReturn("procedure");
    SpanEventFactory target = new SpanEventFactory("blerb", new PassNothingAttributeFilter(), DEFAULT_SYSTEM_TIMESTAMP_SUPPLIER);
    SpanEvent spanEvent = target.setExternalParameterAttributes(mockParameters).build();
    assertEquals("library", spanEvent.getIntrinsics().get("component"));
    assertNull(spanEvent.getAgentAttributes().get("http.method"));
}
Also used : HttpParameters(com.newrelic.api.agent.HttpParameters) SpanEvent(com.newrelic.agent.model.SpanEvent) Test(org.junit.Test)

Example 65 with SpanEvent

use of com.newrelic.agent.model.SpanEvent in project newrelic-java-agent by newrelic.

the class SpanEventFactoryTest method shouldSetStatusCode.

@Test
public void shouldSetStatusCode() {
    SpanEvent spanEvent = spanEventFactory.setHttpStatusCode(418).build();
    assertEquals(418, spanEvent.getAgentAttributes().get("http.statusCode"));
}
Also used : SpanEvent(com.newrelic.agent.model.SpanEvent) Test(org.junit.Test)

Aggregations

SpanEvent (com.newrelic.agent.model.SpanEvent)81 Test (org.junit.Test)64 AttributeFilter (com.newrelic.agent.model.AttributeFilter)23 SpanEventsService (com.newrelic.agent.service.analytics.SpanEventsService)19 TransactionStats (com.newrelic.agent.stats.TransactionStats)14 TransactionData (com.newrelic.agent.TransactionData)12 SpanEventsServiceImpl (com.newrelic.agent.service.analytics.SpanEventsServiceImpl)12 Tracer (com.newrelic.agent.tracers.Tracer)9 HashMap (java.util.HashMap)8 Map (java.util.Map)5 TransactionEvent (com.newrelic.agent.service.analytics.TransactionEvent)4 TransactionDataList (com.newrelic.agent.TransactionDataList)3 DistributedTracePayloadImpl (com.newrelic.agent.tracing.DistributedTracePayloadImpl)3 Test (org.junit.jupiter.api.Test)3 SpanConverterTest.buildSpanEvent (com.newrelic.SpanConverterTest.buildSpanEvent)2 BoundTransactionApiImpl (com.newrelic.agent.BoundTransactionApiImpl)2 AttributesService (com.newrelic.agent.attributes.AttributesService)2 AgentConfig (com.newrelic.agent.config.AgentConfig)2 ReservoirManager (com.newrelic.agent.interfaces.ReservoirManager)2 Consumer (com.newrelic.agent.interfaces.backport.Consumer)2