Class ElasticCollector
- All Implemented Interfaces:
Collector
Documents) in the data streams logs-kubfly-* (events, alerts, health), metrics-kubfly-*
(one document per metric and interval) and, by choice, traces-kubfly-* (frames) — sent by the bulk API in
Smile (kubfly-sdk-codec). On when the URL of the cluster is set (KUBFLY_COLLECTOR_ELASTIC_URL); its
settings are its own (Config), the other collectors do not matter.
At its start the sender asks the cluster what it is (Elasticsearch or OpenSearch), puts the index templates of the
data streams (Templates) and, with KUBFLY_COLLECTOR_ELASTIC_KIBANA, imports the data views and the
dashboard into Kibana; a cluster that does not answer yet is asked again, at most once a minute, and nothing waits
for it.
The threads of the application never send: they put what they got into a bounded queue, and the thread
kf-elastic writes the documents and sends them — a bulk when a batch is full or the oldest document has
waited KUBFLY_COLLECTOR_ELASTIC_DELAY. The answer of a bulk is read item by item: the documents the cluster
could not take now (429, 5xx) are sent again, the refused ones (a mapping, a size) are lost with the reason of the
first; the count of the lost documents is a document of its own.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidalert(long id, long begin, long end, Metric metric, Severity severity, long warnings, long criticals, long unassessed) The state of a metric with thresholds: a document when it changes (the firstOKis not a change).voidA frame begins: nothing, its document is sent when it ends.booleanbridge()Not a bridge to another logging system.booleanenabled()Whether the collector is on.voidend(long id, long time, long duration, long threadId, String threadName, Frame frame, Throwable exception) A frame ends: a document oftraces-kubfly-*, when the frames are documents.voidevent(long id, long time, long threadId, String threadName, Frame frame, Event event, String message, ArgumentKind kind1, long bits1, Object ref1, ArgumentKind kind2, long bits2, Object ref2, Throwable exception) An event: a document oflogs-kubfly-*.voideventN(long id, long time, long threadId, String threadName, Frame frame, Event event, String message, Object[] args, int count, Throwable exception) An event of three toEventArgs.MAX_ARGUMENTSarguments: each with its kind, asevent(long, long, long, String, Frame, Event, String, ArgumentKind, long, Object, ArgumentKind, long, Object, Throwable)keeps two.voidfinish(long id, long time, Environment environment) The process finishes: what waits is sent before the process goes.booleanThe frames of every scope, when they are documents.voidhealth(long id, long time, long duration, HealthCheck check, Health health) A run of a check: a document when its state changes (the firstOKis not a change).voidAn interval of metrics: documents ofmetrics-kubfly-*, of the metrics with observations.voidNot sent: a store of logs is not for the profiles.voidstart(long id, long time, Environment environment) The process starts: its place, and the problems of the configuration as warnings.The lowest level of the events sent.voidtrack(long id, long time, KubFly kubfly, TrackPoint point) A point of a track: a document oflogs-kubfly-*at the time of its fix, when the points are documents (KUBFLY_COLLECTOR_ELASTIC_TRACKS); its place is ageo_point.voidNot sent: a store of logs is not for the links of the traffic.voidUsage snapshots are not sent: their metrics are.
-
Constructor Details
-
ElasticCollector
public ElasticCollector()The collector by its configuration (Config), found byServiceLoader.
-
-
Method Details
-
enabled
-
bridge
-
frames
The frames of every scope, when they are documents. -
threshold
The lowest level of the events sent. -
start
The process starts: its place, and the problems of the configuration as warnings. -
begin
-
event
public void event(long id, long time, long threadId, String threadName, Frame frame, Event event, String message, ArgumentKind kind1, long bits1, Object ref1, ArgumentKind kind2, long bits2, Object ref2, Throwable exception) An event: a document oflogs-kubfly-*.- Specified by:
eventin interfaceCollector- Parameters:
id- the numbertime- the timethreadId- the thread (Thread.threadId())threadName- the name of the thread (Thread.getName())frame- the frame ornullevent- the eventmessage- the templatekind1- the first kindbits1- the first primitiveref1- the first referencekind2- the second kindbits2- the second primitiveref2- the second referenceexception- the exception ornull
-
eventN
public void eventN(long id, long time, long threadId, String threadName, Frame frame, Event event, String message, Object[] args, int count, Throwable exception) An event of three toEventArgs.MAX_ARGUMENTSarguments: each with its kind, asevent(long, long, long, String, Frame, Event, String, ArgumentKind, long, Object, ArgumentKind, long, Object, Throwable)keeps two.- Specified by:
eventNin interfaceCollector- Parameters:
id- the numbertime- the timethreadId- the thread (Thread.threadId())threadName- the name of the thread (Thread.getName())frame- the frame ornullevent- the eventmessage- the templateargs- the arguments as the application passed themcount- the number of the argumentsexception- the exception ornull
-
track
A point of a track: a document oflogs-kubfly-*at the time of its fix, when the points are documents (KUBFLY_COLLECTOR_ELASTIC_TRACKS); its place is ageo_point. -
end
public void end(long id, long time, long duration, long threadId, String threadName, Frame frame, Throwable exception) A frame ends: a document oftraces-kubfly-*, when the frames are documents.- Specified by:
endin interfaceCollector- Parameters:
id- the number of the endtime- the timeduration- the duration, nsthreadId- the thread (Thread.threadId())threadName- the name of the thread (Thread.getName())frame- the frameexception- the exception ornull
-
usage
-
metrics
An interval of metrics: documents ofmetrics-kubfly-*, of the metrics with observations. -
alert
-
traffic
Not sent: a store of logs is not for the links of the traffic. -
profile
-
health
A run of a check: a document when its state changes (the firstOKis not a change). -
finish
The process finishes: what waits is sent before the process goes.
-