Search in sources :

Example 1 with ProfilingDataJson

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;
}
Also used : ProfilingDataJson(org.killbill.billing.jaxrs.json.ProfilingDataJson) ProfilingData(org.killbill.commons.profiling.ProfilingData) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

Aggregations

JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ProfilingDataJson (org.killbill.billing.jaxrs.json.ProfilingDataJson)1 ProfilingData (org.killbill.commons.profiling.ProfilingData)1