| 67 | } |
| 68 | |
| 69 | @Override |
| 70 | public void execute(final TSDB tsdb, final HttpQuery query) throws IOException { |
| 71 | http_requests.incrementAndGet(); |
| 72 | |
| 73 | if (!enabled) { |
| 74 | throw new BadRequestException(HttpResponseStatus.SERVICE_UNAVAILABLE, |
| 75 | "Histogram storage has not been enabled. Check the " |
| 76 | + "'tsd.core.histograms.config' configuration."); |
| 77 | } |
| 78 | |
| 79 | // only accept POST |
| 80 | if (query.method() != HttpMethod.POST) { |
| 81 | throw new BadRequestException(HttpResponseStatus.METHOD_NOT_ALLOWED, |
| 82 | "Method not allowed", "The HTTP method [" + query.method().getName() + |
| 83 | "] is not permitted for this endpoint"); |
| 84 | } |
| 85 | |
| 86 | final List<HistogramPojo> dps = query.serializer() |
| 87 | .parsePutV1(HistogramPojo.class, TYPE_REF); |
| 88 | processDataPoint(tsdb, query, dps); |
| 89 | } |
| 90 | |
| 91 | @Override |
| 92 | protected Deferred<Object> importDataPoint(final TSDB tsdb, |