Examples of AbsoluteRange


Examples of org.graylog2.indexer.searches.timeranges.AbsoluteRange

                JsonParser jp = mapper.getFactory().createParser(getBuiltQuery());
                JsonNode rootNode = mapper.readTree(jp);
                JsonNode timestampNode = rootNode.findValue("range").findValue("timestamp");
                String from = Tools.elasticSearchTimeFormatToISO8601(timestampNode.findValue("from").asText());
                String to = Tools.elasticSearchTimeFormatToISO8601(timestampNode.findValue("to").asText());
                boundaries = new AbsoluteRange(from, to);
            } catch (Exception ignored) {}
        }

        return boundaries;
    }
View Full Code Here

Examples of org.graylog2.indexer.searches.timeranges.AbsoluteRange

                break;
            case "absolute":
                final String from = new DateTime(timerangeConfig.get("from"), DateTimeZone.UTC).toString(Tools.ES_DATE_FORMAT);
                final String to = new DateTime(timerangeConfig.get("to"), DateTimeZone.UTC).toString(Tools.ES_DATE_FORMAT);

                timeRange = new AbsoluteRange(from, to);
                break;
            default:
                throw new InvalidRangeParametersException("range_type not recognized");
        }
View Full Code Here

Examples of org.graylog2.indexer.searches.timeranges.AbsoluteRange

    }

    private TimeRange buildAbsoluteTimeRange(String from, String to) {
        try {
            return new AbsoluteRange(from, to);
        } catch (InvalidRangeParametersException e) {
            LOG.warn("Invalid timerange parameters provided. Returning HTTP 400.");
            throw new WebApplicationException(400);
        }
    }
View Full Code Here

Examples of org.graylog2.indexer.searches.timeranges.AbsoluteRange

        if (rangeType.equals("relative")) {
            timeRange = new RelativeRange(Integer.parseInt((String) awr.config.get("range")));
        } else if (rangeType.equals("keyword")) {
            timeRange = new KeywordRange((String) awr.config.get("keyword"));
        } else if (rangeType.equals("absolute")) {
            timeRange = new AbsoluteRange((String) awr.config.get("from"), (String) awr.config.get("to"));
        } else {
            throw new InvalidRangeParametersException("range_type not recognized");
        }

        return buildDashboardWidget(type, metricRegistry, searches, id, awr.description, 0, awr.config,
View Full Code Here

Examples of org.graylog2.indexer.searches.timeranges.AbsoluteRange

        } else if (rangeType.equals("absolute")) {

            String from = new DateTime(timerangeConfig.get("from"), DateTimeZone.UTC).toString(Tools.ES_DATE_FORMAT);
            String to = new DateTime(timerangeConfig.get("to"), DateTimeZone.UTC).toString(Tools.ES_DATE_FORMAT);

            timeRange = new AbsoluteRange(from, to);
        } else {
            throw new InvalidRangeParametersException("range_type not recognized");
        }

        // Is a description set?
View Full Code Here

Examples of org.graylog2.restclient.lib.timeranges.AbsoluteRange

        try {
            UniversalSearch search = searchFactory.queryWithRangeAndFilter(q, timerange, filter);
            FieldHistogramResponse histo = search.fieldHistogram(field, interval);

            Map<String, Object> result = Maps.newHashMap();
            AbsoluteRange boundaries = histo.getHistogramBoundaries();
            result.put("time", histo.time);
            result.put("interval", histo.interval);
            result.put("values", histo.getFormattedResults(valueType));
            result.put("from", boundaries.getFrom());
            result.put("to", boundaries.getTo());

            return ok(Json.toJson(result));
        } catch (IOException e) {
            return internalServerError("io exception");
        } catch (APIException e) {
View Full Code Here

Examples of org.graylog2.restclient.lib.timeranges.AbsoluteRange

            UniversalSearch search = searchFactory.queryWithRangeAndFilter(q, timerange, filter);
            DateHistogramResult histogram = search.dateHistogram(interval);
            List<Map<String, Long>> results = formatHistogramResults(histogram, maxDataPoints, relative == 0);

            Map<String, Object> result = Maps.newHashMap();
            AbsoluteRange boundaries = histogram.getHistogramBoundaries();
            result.put("time", histogram.getTookMs());
            result.put("interval", histogram.getInterval());
            result.put("values", results);
            result.put("from", boundaries.getFrom());
            result.put("to", boundaries.getTo());

            return ok(Json.toJson(result));
        } catch (IOException e) {
            return internalServerError("io exception");
        } catch (APIException e) {
View Full Code Here

Examples of org.graylog2.restclient.lib.timeranges.AbsoluteRange

    @JsonProperty("queried_timerange")
    public Map<String, String> queriedTimerange;

    public AbsoluteRange getHistogramBoundaries() {
        try {
            return new AbsoluteRange(queriedTimerange.get("from"), queriedTimerange.get("to"));
        } catch (Exception e) {}

        return null;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.