@Override
    protected HttpResponse doGet(ServiceRequestContext ctx, HttpRequest req) throws Exception {
        final String accept = req.headers().get(HttpHeaderNames.ACCEPT);
        final String format = TextFormat.chooseContentType(accept);
        final ByteBuf buffer = ctx.alloc().buffer();
        boolean success = false;
        try (ByteBufOutputStream byteBufOutputStream = new ByteBufOutputStream(buffer);
             OutputStreamWriter writer = new OutputStreamWriter(byteBufOutputStream)) {
            TextFormat.writeFormat(format, writer, collectorRegistry.metricFamilySamples());
            success = true;
        } finally {
            if (!success) {
                buffer.release();
            }
        }
        return HttpResponse.of(HttpStatus.OK, MediaType.parse(format), HttpData.wrap(buffer));
    }
Creates a new instance.

@param collectorRegistry Prometheus registry

@deprecated Use {@link #of(CollectorRegistry)}.
core/src/main/java/com/linecorp/armeria/server/metric/PrometheusExpositionService.java