Class ElasticsearchLogStorageRetriever
java.lang.Object
io.jenkins.plugins.opentelemetry.backend.elastic.ElasticsearchLogStorageRetriever
- All Implemented Interfaces:
LogStorageRetriever
,Closeable
,AutoCloseable
public class ElasticsearchLogStorageRetriever
extends Object
implements LogStorageRetriever, Closeable
Retrieve the logs from Elasticsearch.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionElasticsearchLogStorageRetriever
(String elasticsearchUrl, boolean disableSslVerifications, org.apache.http.auth.Credentials elasticsearchCredentials, groovy.text.Template buildLogsVisualizationUrlTemplate, TemplateBindingsProvider templateBindingsProvider) TODO verify username:password auth vs apiKey auth -
Method Summary
Modifier and TypeMethodDescriptionExample of a successful check:void
close()
overallLog
(String jobFullName, int runNumber, String traceId, String spanId, boolean complete, Instant startTime, Instant endTime) protected static String
prettyPrintPhaseRetentionPolicy
(co.elastic.clients.elasticsearch.ilm.Phase phase, String phaseName) stepLog
(String jobFullName, int runNumber, String flowNodeId, String traceId, String spanId, boolean complete, Instant startTime, Instant endTime) toString()
-
Field Details
-
KEEPALIVE_INTERVAL_DEFAULT
- See Also:
-
KEEPALIVE_DEFAULT
- See Also:
-
KEEPALIVE_INTERVAL_PROPERTY
-
KEEPALIVE_PROPERTY
-
KEEPALIVE_INTERVAL
public static final int KEEPALIVE_INTERVAL -
KEEPALIVE
public static final boolean KEEPALIVE
-
-
Constructor Details
-
ElasticsearchLogStorageRetriever
@MustBeClosed public ElasticsearchLogStorageRetriever(@NonNull String elasticsearchUrl, boolean disableSslVerifications, @NonNull org.apache.http.auth.Credentials elasticsearchCredentials, @NonNull groovy.text.Template buildLogsVisualizationUrlTemplate, @NonNull TemplateBindingsProvider templateBindingsProvider) TODO verify username:password auth vs apiKey auth
-
-
Method Details
-
overallLog
@NonNull public LogsQueryResult overallLog(@NonNull String jobFullName, int runNumber, @NonNull String traceId, @NonNull String spanId, boolean complete, @NonNull Instant startTime, Instant endTime) - Specified by:
overallLog
in interfaceLogStorageRetriever
- Parameters:
jobFullName
- seeAbstractItem.getFullName()
runNumber
- seeRun.getNumber()
complete
- if true, we claim to be serving the complete log for a build, so implementations should be sure to retrieve final log linesstartTime
- Pipeline run start time. SeeRun.getStartTimeInMillis()
endTime
-null
if the pipeline is still running. SeeRun.getDuration()
-
stepLog
@NonNull public LogsQueryResult stepLog(@NonNull String jobFullName, int runNumber, @NonNull String flowNodeId, @NonNull String traceId, @NonNull String spanId, boolean complete, @NonNull Instant startTime, @Nullable Instant endTime) - Specified by:
stepLog
in interfaceLogStorageRetriever
- Parameters:
jobFullName
- seeAbstractItem.getFullName()
runNumber
- seeRun.getNumber()
flowNodeId
- seeFlowNode.getId()
complete
- if true, we claim to be serving the complete log for a build, so implementations should be sure to retrieve final log linesstartTime
- Pipeline run start time. SeeRun.getStartTimeInMillis()
endTime
-null
if the pipeline is still running. SeeRun.getDuration()
-
checkElasticsearchSetup
Example of a successful check:OK: Verify existence of the Elasticsearch Index Template 'logs-apm.app' used to store Jenkins pipeline logs... OK: Connected to Elasticsearch https://***.es.example.com with user 'jenkins'. OK: Index Template 'logs-apm.app' found. OK: Verify existence of the Index Lifecycle Management (ILM) Policy 'logs-apm.app' associated with the Index Template 'logs-apm.app' to define the time to live of the Jenkins pipeline logs in Elasticsearch... OK: Index Lifecycle Policy 'logs-apm.app_logs-default_policy' found. OK: Logs retention policy: hot[rollover[maxAge=30d, maxSize=50gb]], warm [phase not defined], cold [phase not defined], delete[delete[min_age=10d]].
-
prettyPrintPhaseRetentionPolicy
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
toString
-