All Downloads are FREE. Search and download functionalities are using the official Maven repository.

freemarker.es7x.index.health.ftl Maven / Gradle / Ivy

The newest version!
<#ftl output_format="JSON">
<#-- @ftlvariable name="index" type="java.lang.String" -->
<#-- @ftlvariable name="@timestamp" type="java.lang.String" -->
<#-- @ftlvariable name="gateway" type="java.lang.String" -->
<#-- @ftlvariable name="date" type="java.lang.String" -->
<#-- @ftlvariable name="status" type="io.gravitee.reporter.api.health.EndpointStatus" -->
<#macro stringOrNull data="">
    <#if data != "">
    "${data}"<#else>
    null

<#if index??>
{ "index" : { "_index" : "${index}", "_id" : "${status.getId()}" } }

<#--noinspection FtlReferencesInspection-->
<@compress single_line=true>
{
    "@timestamp":"${@timestamp}",
<#if !index??>
    "type": "health",
    "date" : "${date}",
    "_id" : "${status.getId()}",

    "api":"${status.getApi()}",
    "api-name":"${status.getApiName()?j_string}",
    "endpoint":"${status.getEndpoint()?j_string}",
    "available":${status.isAvailable()?c},
    "response-time":${status.getResponseTime()},
    "success":${status.isSuccess()?c},
    "state":${status.getState()},
    "transition":${status.isTransition()?c},
    "steps": [
<#list status.getSteps() as step>
        {"name": "${step.getName()}",
        "success":${step.isSuccess()?c},
        "request": {
            "uri":"${step.getRequest().getUri()?j_string}",
            "method":"${step.getRequest().getMethod()}"
            <#if step.getRequest().getBody()??>
            ,"body":"${step.getRequest().getBody()?j_string}"
            
            <#if step.getRequest().getHeaders()??>
            ,"headers":{
                <#list step.getRequest().getHeaders() as headerKey, headerValue>
                    "${headerKey}": [
                    <#list headerValue as value>
                        "${value?j_string}"
                        <#sep>,
                    
                    ]
                    <#sep>,
                
            }
            
        },
        "response": {
            "status":${step.getResponse().getStatus()}
            <#if step.getResponse().getBody()??>
            ,"body":"${step.getResponse().getBody()?j_string}"
            
            <#if step.getResponse().getHeaders()??>
            ,"headers":{
                <#--noinspection FtlTypesInspection-->
                <#list step.getResponse().getHeaders() as headerKey, headerValue>
                    "${headerKey}": [
                    <#list headerValue as value>
                        "${value?j_string}"
                        <#sep>,
                    
                    ]
                    <#sep>,
                
            }
            
        },
        "response-time":${step.getResponseTime()},
        "message":<@stringOrNull data=step.getMessage()/>
    }<#sep>,
],
    "gateway":"${gateway}"
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy