use of com.navercorp.pinpoint.grpc.Header in project pinpoint by naver.
the class CollectorGrpcSpanFactoryTest method buildSpanChunkBo_first_depth_zero.
@Test
public void buildSpanChunkBo_first_depth_zero() {
final PSpanChunk chunk = newSpanChunk_first_depth_zero();
final Header header = newHeader();
SpanChunkBo spanChunkBo = factory.buildSpanChunkBo(chunk, header);
List<SpanEventBo> spanEventBoList = spanChunkBo.getSpanEventBoList();
SpanEventBo spanEventBo0 = spanEventBoList.get(0);
SpanEventBo spanEventBo1 = spanEventBoList.get(1);
Assert.assertEquals(0, spanEventBo0.getDepth());
Assert.assertEquals(1, spanEventBo1.getDepth());
}
use of com.navercorp.pinpoint.grpc.Header in project pinpoint by naver.
the class CollectorGrpcSpanFactoryTest method buildSpanChunkBo_compact_depth_NPE.
@Test
public void buildSpanChunkBo_compact_depth_NPE() {
final PSpanChunk chunk = newSpanChunk_compact_depth_error();
final Header header = newHeader();
SpanChunkBo spanChunkBo = factory.buildSpanChunkBo(chunk, header);
List<SpanEventBo> spanEventBoList = spanChunkBo.getSpanEventBoList();
SpanEventBo spanEventBo0 = spanEventBoList.get(0);
Assert.assertEquals(1, spanEventBo0.getDepth());
}
use of com.navercorp.pinpoint.grpc.Header in project pinpoint by naver.
the class AgentLifecycleListener method connect.
@Override
public void connect(PingSession lifecycle) {
logger.info("connect:{}", lifecycle);
final Header header = lifecycle.getHeader();
try {
final AgentInfoBo agentInfoBo = agentInfoService.getAgentInfo(header.getAgentId(), header.getAgentStartTime());
if (null != agentInfoBo) {
lifecycle.setServiceType(agentInfoBo.getServiceTypeCode());
}
} catch (Exception e) {
logger.warn("Failed to handle. ping session={}", lifecycle, e);
}
lifecycleService.updateState(lifecycle, ManagedAgentLifeCycle.RUNNING);
}
use of com.navercorp.pinpoint.grpc.Header in project pinpoint by naver.
the class DefaultServerRequestFactory method newServerRequest.
@Override
public <T> ServerRequest<T> newServerRequest(Message<T> message) throws StatusException {
final Context current = Context.current();
final Header header = ServerContext.getAgentInfo(current);
if (header == null) {
throw Status.INTERNAL.withDescription("Not found request header").asException();
}
final TransportMetadata transportMetadata = ServerContext.getTransportMetadata(current);
if (transportMetadata == null) {
throw Status.INTERNAL.withDescription("Not found transportMetadata").asException();
}
InetSocketAddress inetSocketAddress = transportMetadata.getRemoteAddress();
ServerRequest<T> request = new DefaultServerRequest<>(message, inetSocketAddress.getHostString(), inetSocketAddress.getPort());
return request;
}
use of com.navercorp.pinpoint.grpc.Header in project pinpoint by naver.
the class AgentHeaderReaderTest method extract_no_agentName.
@Test
public void extract_no_agentName() {
Metadata metadata = newMetadata();
metadata.remove(Header.AGENT_NAME_KEY, AGENT_NAME);
final Header header = reader.extract(metadata);
Assert.assertNull(header.getAgentName());
}
Aggregations