Skip to content

Commit

Permalink
feat(analytics): Add Host HTTP header into analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
brasseld authored and NicolasGeraud committed Oct 11, 2018
1 parent c1891f7 commit c01c8a1
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 2 deletions.
Expand Up @@ -57,4 +57,7 @@
<#if metrics.getMappedPath()??>
,"mapped-path":"${metrics.getMappedPath()}"
</#if>
<#if metrics.getHost()??>
,"host":"${metrics.getHost()}"
</#if>
}</@compress>
Expand Up @@ -113,6 +113,10 @@
"mapped-path": {
"index": "not_analyzed",
"type": "string"
},
"host": {
"index": "not_analyzed",
"type": "string"
}
}
}
Expand Down
Expand Up @@ -308,6 +308,10 @@
"mapped-path": {
"type": "string",
"index": "not_analyzed"
},
"host": {
"index": "not_analyzed",
"type": "string"
}
}
},
Expand Down
Expand Up @@ -57,4 +57,7 @@
<#if metrics.getMappedPath()??>
,"mapped-path":"${metrics.getMappedPath()}"
</#if>
<#if metrics.getHost()??>
,"host":"${metrics.getHost()}"
</#if>
}</@compress>
Expand Up @@ -104,6 +104,9 @@
},
"mapped-path": {
"type": "keyword"
},
"host": {
"type": "keyword"
}
}
}
Expand Down
Expand Up @@ -98,6 +98,9 @@
},
"mapped-path": {
"type": "keyword"
},
"host": {
"type": "keyword"
}
}
},
Expand Down
Expand Up @@ -49,4 +49,7 @@
<#if metrics.getMappedPath()??>
,"mapped-path":"${metrics.getMappedPath()}"
</#if>
<#if metrics.getHost()??>
,"host":"${metrics.getHost()}"
</#if>
}</@compress>
Expand Up @@ -104,6 +104,9 @@
},
"mapped-path": {
"type": "keyword"
},
"host": {
"type": "keyword"
}
}
}
Expand Down
Expand Up @@ -77,6 +77,7 @@ final class LogBuilder {
private final static String FIELD_API = "api";
private final static String FIELD_PLAN = "plan";
private final static String FIELD_API_KEY = "api-key";
private final static String FIELD_HOST = "host";

private final static String FIELD_MESSAGE = "message";

Expand Down Expand Up @@ -164,6 +165,11 @@ private static <T extends Log> T createLog(final SearchHit hit, final T log) {
log.setMessage(messageNode.asText());
}

final JsonNode hostNode = source.get(FIELD_HOST);
if (hostNode != null && ! hostNode.isNull()) {
log.setHost(hostNode.asText());
}

return log;
}

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Expand Up @@ -37,9 +37,9 @@
<!-- Gravitee's project versions -->
<gravitee-gateway-api.version>1.11.0</gravitee-gateway-api.version>
<gravitee-common.version>1.13.0-SNAPSHOT</gravitee-common.version>
<gravitee-reporter-api.version>1.11.0</gravitee-reporter-api.version>
<gravitee-reporter-api.version>1.12.0-SNAPSHOT</gravitee-reporter-api.version>
<gravitee-policy-api.version>1.2.0</gravitee-policy-api.version>
<gravitee-repository.version>1.19.0</gravitee-repository.version>
<gravitee-repository.version>1.20.0-SNAPSHOT</gravitee-repository.version>
<gravitee-node.version>1.0.0-SNAPSHOT</gravitee-node.version>
<freemarker.version>2.3.26-incubating</freemarker.version>
</properties>
Expand Down

0 comments on commit c01c8a1

Please sign in to comment.