Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
f64f5a0f
Commit
f64f5a0f
authored
Apr 06, 2020
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose Elastic's pipeline and indexDateSeparator properties
Closes gh-20852
parent
f293f6ad
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
6 deletions
+57
-6
ElasticProperties.java
...toconfigure/metrics/export/elastic/ElasticProperties.java
+28
-3
ElasticPropertiesConfigAdapter.java
...etrics/export/elastic/ElasticPropertiesConfigAdapter.java
+11
-1
ElasticPropertiesConfigAdapterTests.java
...s/export/elastic/ElasticPropertiesConfigAdapterTests.java
+15
-1
ElasticPropertiesTests.java
...figure/metrics/export/elastic/ElasticPropertiesTests.java
+3
-1
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticProperties.java
View file @
f64f5a0f
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -40,11 +40,15 @@ public class ElasticProperties extends StepRegistryProperties {
private
String
index
=
"metrics"
;
/**
* Index date format used for rolling indices. Appended to the index name, preceded by
* a '-'.
* Index date format used for rolling indices. Appended to the index name.
*/
private
String
indexDateFormat
=
"yyyy-MM"
;
/**
* Prefix to separate the index name from the date format used for rolling indices.
*/
private
String
indexDateSeparator
=
"-"
;
/**
* Name of the timestamp field.
*/
...
...
@@ -65,6 +69,11 @@ public class ElasticProperties extends StepRegistryProperties {
*/
private
String
password
=
""
;
/**
* Ingest pipeline name. By default, events are not pre-processed.
*/
private
String
pipeline
=
""
;
public
String
getHost
()
{
return
this
.
host
;
}
...
...
@@ -89,6 +98,14 @@ public class ElasticProperties extends StepRegistryProperties {
this
.
indexDateFormat
=
indexDateFormat
;
}
public
String
getIndexDateSeparator
()
{
return
this
.
indexDateSeparator
;
}
public
void
setIndexDateSeparator
(
String
indexDateSeparator
)
{
this
.
indexDateSeparator
=
indexDateSeparator
;
}
public
String
getTimestampFieldName
()
{
return
this
.
timestampFieldName
;
}
...
...
@@ -121,4 +138,12 @@ public class ElasticProperties extends StepRegistryProperties {
this
.
password
=
password
;
}
public
String
getPipeline
()
{
return
this
.
pipeline
;
}
public
void
setPipeline
(
String
pipeline
)
{
this
.
pipeline
=
pipeline
;
}
}
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticPropertiesConfigAdapter.java
View file @
f64f5a0f
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -47,6 +47,11 @@ class ElasticPropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapter
return
get
(
ElasticProperties:
:
getIndexDateFormat
,
ElasticConfig
.
super
::
indexDateFormat
);
}
@Override
public
String
indexDateSeparator
()
{
return
get
(
ElasticProperties:
:
getIndexDateSeparator
,
ElasticConfig
.
super
::
indexDateSeparator
);
}
@Override
public
String
timestampFieldName
()
{
return
get
(
ElasticProperties:
:
getTimestampFieldName
,
ElasticConfig
.
super
::
timestampFieldName
);
...
...
@@ -67,4 +72,9 @@ class ElasticPropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapter
return
get
(
ElasticProperties:
:
getPassword
,
ElasticConfig
.
super
::
password
);
}
@Override
public
String
pipeline
()
{
return
get
(
ElasticProperties:
:
getPipeline
,
ElasticConfig
.
super
::
pipeline
);
}
}
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticPropertiesConfigAdapterTests.java
View file @
f64f5a0f
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -48,6 +48,13 @@ class ElasticPropertiesConfigAdapterTests {
assertThat
(
new
ElasticPropertiesConfigAdapter
(
properties
).
indexDateFormat
()).
isEqualTo
(
"yyyy"
);
}
@Test
void
whenPropertiesIndexDateSeparatorIsSetAdapterIndexDateFormatReturnsIt
()
{
ElasticProperties
properties
=
new
ElasticProperties
();
properties
.
setIndexDateSeparator
(
"*"
);
assertThat
(
new
ElasticPropertiesConfigAdapter
(
properties
).
indexDateSeparator
()).
isEqualTo
(
"*"
);
}
@Test
void
whenPropertiesTimestampFieldNameIsSetAdapterTimestampFieldNameReturnsIt
()
{
ElasticProperties
properties
=
new
ElasticProperties
();
...
...
@@ -76,4 +83,11 @@ class ElasticPropertiesConfigAdapterTests {
assertThat
(
new
ElasticPropertiesConfigAdapter
(
properties
).
password
()).
isEqualTo
(
"secret"
);
}
@Test
void
whenPropertiesPipelineIsSetAdapterPasswordReturnsIt
()
{
ElasticProperties
properties
=
new
ElasticProperties
();
properties
.
setPipeline
(
"testPipeline"
);
assertThat
(
new
ElasticPropertiesConfigAdapter
(
properties
).
pipeline
()).
isEqualTo
(
"testPipeline"
);
}
}
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticPropertiesTests.java
View file @
f64f5a0f
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -38,10 +38,12 @@ class ElasticPropertiesTests extends StepRegistryPropertiesTests {
assertThat
(
properties
.
getHost
()).
isEqualTo
(
config
.
host
());
assertThat
(
properties
.
getIndex
()).
isEqualTo
(
config
.
index
());
assertThat
(
properties
.
getIndexDateFormat
()).
isEqualTo
(
config
.
indexDateFormat
());
assertThat
(
properties
.
getIndexDateSeparator
()).
isEqualTo
(
config
.
indexDateSeparator
());
assertThat
(
properties
.
getPassword
()).
isEqualTo
(
config
.
password
());
assertThat
(
properties
.
getTimestampFieldName
()).
isEqualTo
(
config
.
timestampFieldName
());
assertThat
(
properties
.
getUserName
()).
isEqualTo
(
config
.
userName
());
assertThat
(
properties
.
isAutoCreateIndex
()).
isEqualTo
(
config
.
autoCreateIndex
());
assertThat
(
properties
.
getPipeline
()).
isEqualTo
(
config
.
pipeline
());
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment