Interface LogQueryClient
- All Known Implementing Classes:
BetterStackQuery,InMemoryLogQueryClient
public interface LogQueryClient
Reads logs back from the service. A service package implements
search(java.lang.String, codes.grow.packages.betterstack.logging.SearchOptions) and, where the
service offers them, tail(java.lang.String, java.util.function.Consumer<codes.grow.packages.betterstack.logging.LogRecord>, codes.grow.packages.betterstack.logging.TailOptions), listStreams() and listLabels(); the defaults
throw UnsupportedException. The …Async variants run the synchronous method on the
common pool unless overridden.-
Method Summary
Modifier and TypeMethodDescriptionLists the label or field names of the service.default CompletableFuture<List<String>> AsynchronouslistLabels().Lists the log streams (indexes, streams, data sets) of the service.default CompletableFuture<List<String>> AsynchronouslistStreams().default LogSearchResultSearches with default options (limit 100, newest first).search(String query, SearchOptions options) Searches records matching a service query (full text or the service's query language).default CompletableFuture<LogSearchResult> searchAsync(String query, SearchOptions options) Asynchronoussearch(String, SearchOptions).default TailHandletail(String query, Consumer<LogRecord> onRecord, TailOptions options) Streams new matching records toonRecorduntil the handle is stopped.default LogRecordwaitForLog(String query) waitForLog(String, WaitForLogOptions)with defaults.default LogRecordwaitForLog(String query, WaitForLogOptions options) Pollssearch(java.lang.String, codes.grow.packages.betterstack.logging.SearchOptions)until a record matches the query and the predicate.default CompletableFuture<LogRecord> waitForLogAsync(String query, WaitForLogOptions options) AsynchronouswaitForLog(String, WaitForLogOptions).
-
Method Details
-
search
Searches records matching a service query (full text or the service's query language).- Parameters:
query- query textoptions- range, limit, order, cursor- Returns:
- one page of records
-
search
Searches with default options (limit 100, newest first).- Parameters:
query- query text- Returns:
- one page of records
-
searchAsync
Asynchronoussearch(String, SearchOptions).- Parameters:
query- query textoptions- options- Returns:
- future page
-
tail
Streams new matching records toonRecorduntil the handle is stopped.- Parameters:
query- query textonRecord- callback per recordoptions- start time, polling interval, error callback- Returns:
- handle
- Throws:
UnsupportedException- when the service cannot stream or poll
-
listStreams
Lists the log streams (indexes, streams, data sets) of the service.- Returns:
- names
- Throws:
UnsupportedException- when the service has no streams
-
listStreamsAsync
AsynchronouslistStreams().- Returns:
- future names
-
listLabels
Lists the label or field names of the service.- Returns:
- names
- Throws:
UnsupportedException- when the service has no labels
-
listLabelsAsync
AsynchronouslistLabels().- Returns:
- future names
-
waitForLog
Pollssearch(java.lang.String, codes.grow.packages.betterstack.logging.SearchOptions)until a record matches the query and the predicate.- Parameters:
query- query textoptions- timeout (30 s), interval (1 s), predicate, search options- Returns:
- the first matching record
- Throws:
TimeoutException- when nothing matches in time
-
waitForLog
waitForLog(String, WaitForLogOptions)with defaults.- Parameters:
query- query text- Returns:
- the first matching record
-
waitForLogAsync
AsynchronouswaitForLog(String, WaitForLogOptions).- Parameters:
query- query textoptions- options- Returns:
- future record
-