In src/main/java/org/opensearch/performanceanalyzer/
:
-
PerformanceAnalyzerPlugin
's constructor does the following:- Creates a
scheduledMetricCollectorsExecutor
. scheduledMetricCollectorsExecutor.addScheduledMetricCollector(new XYZMetricsCollector())
is called for all collectors.scheduledMetricCollectorsExecutor.start()
is called and thenEventLogQueueProcessor.scheduleExecutor()
.
- Creates a
-
Methods in
PerformanceAnalyzerPlugin
interface with the OpenSearch plugin architectureonIndexModule
,onDiscovery
, etc. are all called by OpenSearch when their corresponding events occur and the plugin can act on them.- For example:
getActionFilters
provides OpenSearch with a list of classes that implementActionFilter
.action/PerformanceAnalyzerActionFilter
is the only class currently returned to OpenSearch as anActionFilter
.- when a BulkRequest or SearchRequest is recieved by OpenSearch,
action/PerformanceAnalyzerActionFilter
logs a start event and creates a listener (action/PerformanceAnalyzerActionListener
) which waits to record the corresponding end event.
PerformanceAnalyzerPlugin.getRestHandlers
returns all the classes that can handle REST requests to OpenSearch.
-
The classes in
http_action/config
define all the public API routes for Performance Analyzer.http_action/config/RestConfig
definesPA_BASE_URI = "/_plugins/_performanceanalyzer"
PerformanceAnalyzerResourceProvider
defines themetrics
,rca
,batch
andactions
routes.PerformanceAnalyzerResourceProvider.SUPPORTED_REDIRECTIONS = ("rca", "metrics", "batch", "actions")
-
listener/PerformanceAnalyzerSearchListener
hooks into OpenSearch core to emit search operation related metrics. -
writer/EventLogQueueProcessor
:- contains
purgeQueueAndPersist
which drainsPerformanceAnalyzerMetrics.metricQueue
into a file that contains all events for a certain time bucket. It also removes old events. Usesevent_process.EventLogFileHandler
in Performance Analyzer Commons for file writing logic. scheduleExecutor
periodically runspurgeQueueAndPersist
.
- contains
-
Classes in
collectors
extendPerformanceAnalyzerMetricsCollector
and implementMetricsProcessor
.PerformanceAnalyzerMetricsCollector
implementsRunnable
and contains common variables likevalue
where a collector stores serialized metrics.- A collector is triggered through
PerformanceAnalyzerMetricsCollector.collectMetrics
.- The collector will store serialized data in the
value
variable and then callMetricsProcessor.saveMetricValues
. saveMetricValues
callsPerformanceAnalyzerMetrics.emitMetric
that creates anEvent
from the serialized data and adds it to a static queue (PerformanceAnalyzerMetrics.metricQueue
) shared across all collectors.
- The collector will store serialized data in the