<commit_before>package com.jivesoftware.os.miru.sea.anomaly.deployable.endpoints;

import com.google.common.base.Optional;
import com.jivesoftware.os.miru.sea.anomaly.deployable.MiruSeaAnomalyService;
import com.jivesoftware.os.miru.sea.anomaly.deployable.region.SeaAnomalyQueryPluginRegion;
import com.jivesoftware.os.miru.sea.anomaly.deployable.region.SeaAnomalyQueryPluginRegion.SeaAnomalyPluginRegionInput;
import javax.inject.Singleton;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

/**
 *
 */
@Singleton
@Path("/seaAnomaly/query")
public class SeaAnomalyQueryPluginEndpoints {

    private final MiruSeaAnomalyService seaAnomalyService;
    private final SeaAnomalyQueryPluginRegion pluginRegion;

    public SeaAnomalyQueryPluginEndpoints(@Context MiruSeaAnomalyService seaAnomalyService, @Context SeaAnomalyQueryPluginRegion pluginRegion) {
        this.seaAnomalyService = seaAnomalyService;
        this.pluginRegion = pluginRegion;
    }

    @GET
    @Path("/")
    @Produces(MediaType.TEXT_HTML)
    public Response query(
        @QueryParam("cluster") @DefaultValue("") String cluster,
        @QueryParam("host") @DefaultValue("") String host,
        @QueryParam("service") @DefaultValue("") String service,
        @QueryParam("instance") @DefaultValue("") String instance,
        @QueryParam("version") @DefaultValue("") String version,
        @QueryParam("fromAgo") @DefaultValue("60") int fromAgo,
        @QueryParam("toAgo") @DefaultValue("0") int toAgo,
        @QueryParam("fromTimeUnit") @DefaultValue("MINUTES") String fromTimeUnit,
        @QueryParam("toTimeUnit") @DefaultValue("MINUTES") String toTimeUnit,
        @QueryParam("tenant") @DefaultValue("") String tenant,
        @QueryParam("sampler") @DefaultValue("") String sampler,
        @QueryParam("metric") @DefaultValue("") String metric,
        @QueryParam("tags") @DefaultValue("") String tags,
        @QueryParam("type") @DefaultValue("VALUE") String type,
        @QueryParam("buckets") @DefaultValue("30") int buckets,
        @QueryParam("graphType") @DefaultValue("Default") String graphType,
        @QueryParam("expansionField") @DefaultValue("metric") String expansionField,
        @QueryParam("expansionValue") @DefaultValue("*") String expansionValue
    ) {
        String rendered = seaAnomalyService.renderPlugin(pluginRegion,<commit_msg>Fixed default line time.<commit_after>package com.jivesoftware.os.miru.sea.anomaly.deployable.endpoints;

import com.google.common.base.Optional;
import com.jivesoftware.os.miru.sea.anomaly.deployable.MiruSeaAnomalyService;
import com.jivesoftware.os.miru.sea.anomaly.deployable.region.SeaAnomalyQueryPluginRegion;
import com.jivesoftware.os.miru.sea.anomaly.deployable.region.SeaAnomalyQueryPluginRegion.SeaAnomalyPluginRegionInput;
import javax.inject.Singleton;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

/**
 *
 */
@Singleton
@Path("/seaAnomaly/query")
public class SeaAnomalyQueryPluginEndpoints {

    private final MiruSeaAnomalyService seaAnomalyService;
    private final SeaAnomalyQueryPluginRegion pluginRegion;

    public SeaAnomalyQueryPluginEndpoints(@Context MiruSeaAnomalyService seaAnomalyService, @Context SeaAnomalyQueryPluginRegion pluginRegion) {
        this.seaAnomalyService = seaAnomalyService;
        this.pluginRegion = pluginRegion;
    }

    @GET
    @Path("/")
    @Produces(MediaType.TEXT_HTML)
    public Response query(
        @QueryParam("cluster") @DefaultValue("") String cluster,
        @QueryParam("host") @DefaultValue("") String host,
        @QueryParam("service") @DefaultValue("") String service,
        @QueryParam("instance") @DefaultValue("") String instance,
        @QueryParam("version") @DefaultValue("") String version,
        @QueryParam("fromAgo") @DefaultValue("60") int fromAgo,
        @QueryParam("toAgo") @DefaultValue("0") int toAgo,
        @QueryParam("fromTimeUnit") @DefaultValue("MINUTES") String fromTimeUnit,
        @QueryParam("toTimeUnit") @DefaultValue("MINUTES") String toTimeUnit,
        @QueryParam("tenant") @DefaultValue("") String tenant,
        @QueryParam("sampler") @DefaultValue("") String sampler,
        @QueryParam("metric") @DefaultValue("") String metric,
        @QueryParam("tags") @DefaultValue("") String tags,
        @QueryParam("type") @DefaultValue("VALUE") String type,
        @QueryParam("buckets") @DefaultValue("30") int buckets,
        @QueryParam("graphType") @DefaultValue("Line") String graphType,
        @QueryParam("expansionField") @DefaultValue("metric") String expansionField,
        @QueryParam("expansionValue") @DefaultValue("*") String expansionValue
    ) {
        String rendered = seaAnomalyService.renderPlugin(pluginRegion,
{'fraction_non_alphanumeric': 0.12838102704821638, 'fraction_numerical': 0.001960015680125441, 'mean_word_length': 4.9406286379511055, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5837982', 'n_tokens_mistral': 1558, 'n_tokens_neox': 1489, 'n_words': 268}