<commit_before>package alien4cloud.paas.model;

import java.util.Date;
import java.util.Objects;

import org.elasticsearch.annotation.*;
import org.elasticsearch.annotation.query.TermFilter;
import org.elasticsearch.annotation.query.TermsFacet;
import org.elasticsearch.mapping.IndexType;

import com.fasterxml.jackson.annotation.JsonInclude;

import alien4cloud.dao.EsGeneratedId;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * This represents a log entry from orchestrator
 */
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@ESObject
@JsonInclude(JsonInclude.Include.NON_NULL)
public class PaaSDeploymentLog {
    /**
     * Unique id of the log. Note that this field value is generated by elasticsearch. Should always be null before you write it to elastic search.
     */
    @EsGeneratedId
    private String id;

    /**
     * Deployment id is unique for a deployment
     * It corresponds to {@link alien4cloud.model.deployment.Deployment#getId}
     * This field is mandatory
     */
    @TermFilter
    @StringField(indexType = IndexType.not_analyzed, includeInAll = false)
    private String deploymentId;

    /**
     * Deployment PaaS id is unique for an application on a given environment (for ex : Alien-Prod)
     * It corresponds to {@link alien4cloud.model.deployment.Deployment#getOrchestratorDeploymentId}
     * This field is mandatory
     */
    @TermFilter
    @StringField(indexType = IndexType.not_analyzed, includeInAll = false)
    private String deploymentPaaSId;

    /**
     * Log's level
     * This field is mandatory
     */
    @TermFilter
    @TermsFacet
    @StringField(indexType = IndexType.not_analyzed, includeInAll = false)
    private PaaSDeploymentLogLevel level;

    /**
     * The type of the log entry given by the PaaS
     * For cloudify it can be a4c_workflow_event, Task sent, Task started etc ...
     * For puccini it can be operation_output, operation_info, plugin, provider, general ...
     * This field is mandatory
     */
    @TermFilter
    @TermsFacet
    @StringField(indexType = IndexType.not_analyzed, includeInAll = false)
    private String type;

    /**
     * Log's timestamp
     * This field is mandatory
     */
    @TermFilter
    @DateField
    @TimeStamp(format = "", index = IndexType.not_analyzed)
    private Date timestamp;

    /**
     * Some orchestrator provide logs with nanosecond precision for logs.
     */
    @TermFilter
    @NumberField(index = IndexType.not_analyzed, includeInAll = false)
    private Long nanotimestamp;

    /**
     * Id of the workflow that generated the log<commit_msg>Finally just keep the raw timestamp as it was provided by the orchestrator<commit_after>package alien4cloud.paas.model;

import java.util.Date;
import java.util.Objects;

import org.elasticsearch.annotation.*;
import org.elasticsearch.annotation.query.TermFilter;
import org.elasticsearch.annotation.query.TermsFacet;
import org.elasticsearch.mapping.IndexType;

import com.fasterxml.jackson.annotation.JsonInclude;

import alien4cloud.dao.EsGeneratedId;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * This represents a log entry from orchestrator
 */
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@ESObject
@JsonInclude(JsonInclude.Include.NON_NULL)
public class PaaSDeploymentLog {
    /**
     * Unique id of the log. Note that this field value is generated by elasticsearch. Should always be null before you write it to elastic search.
     */
    @EsGeneratedId
    private String id;

    /**
     * Deployment id is unique for a deployment
     * It corresponds to {@link alien4cloud.model.deployment.Deployment#getId}
     * This field is mandatory
     */
    @TermFilter
    @StringField(indexType = IndexType.not_analyzed, includeInAll = false)
    private String deploymentId;

    /**
     * Deployment PaaS id is unique for an application on a given environment (for ex : Alien-Prod)
     * It corresponds to {@link alien4cloud.model.deployment.Deployment#getOrchestratorDeploymentId}
     * This field is mandatory
     */
    @TermFilter
    @StringField(indexType = IndexType.not_analyzed, includeInAll = false)
    private String deploymentPaaSId;

    /**
     * Log's level
     * This field is mandatory
     */
    @TermFilter
    @TermsFacet
    @StringField(indexType = IndexType.not_analyzed, includeInAll = false)
    private PaaSDeploymentLogLevel level;

    /**
     * The type of the log entry given by the PaaS
     * For cloudify it can be a4c_workflow_event, Task sent, Task started etc ...
     * For puccini it can be operation_output, operation_info, plugin, provider, general ...
     * This field is mandatory
     */
    @TermFilter
    @TermsFacet
    @StringField(indexType = IndexType.not_analyzed, includeInAll = false)
    private String type;

    /**
     * Log's timestamp
     * This field is mandatory
     */
    @TermFilter
    @DateField
    @TimeStamp(format = "", index = IndexType.not_analyzed)
    private Date timestamp;

    /**
     * The timestamp raw value as it was provided by the orchestrator.
     */
    @TermFilter
    @NumberField(index = IndexType.not_analyzed, includeInAll = false)
    private String rawtimestamp;

    /**
     * Id of the workflow that generated the log
{'fraction_non_alphanumeric': 0.08016329560215253, 'fraction_numerical': 0.0018556318426424198, 'mean_word_length': 3.3928280358598206, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '2407210', 'n_tokens_mistral': 1560, 'n_tokens_neox': 1533, 'n_words': 463}