use of org.killbill.billing.jaxrs.json.ProfilingDataJson in project killbill by killbill.
the class ProfilingContainerResponseFilter method filter.
@Override
public ContainerResponse filter(final ContainerRequest request, final ContainerResponse response) {
try {
final ProfilingData rawData = Profiling.getPerThreadProfilingData();
if (rawData != null) {
if (rawData.getProfileFeature().isProfilingJAXRS()) {
rawData.addEnd(ProfilingFeatureType.JAXRS, request.getPath());
}
final ProfilingDataJson profilingData = new ProfilingDataJson(rawData);
final String value;
try {
value = mapper.writeValueAsString(profilingData);
response.getHttpHeaders().add(PROFILING_HEADER_RESP, value);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
} finally {
Profiling.resetPerThreadProfilingData();
}
return response;
}
Aggregations