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
PerformanceAnalyzerPlugininterface 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:
getActionFiltersprovides OpenSearch with a list of classes that implementActionFilter.action/PerformanceAnalyzerActionFilteris the only class currently returned to OpenSearch as anActionFilter.- when a BulkRequest or SearchRequest is recieved by OpenSearch,
action/PerformanceAnalyzerActionFilterlogs a start event and creates a listener (action/PerformanceAnalyzerActionListener) which waits to record the corresponding end event.
PerformanceAnalyzerPlugin.getRestHandlersreturns all the classes that can handle REST requests to OpenSearch.
-
The classes in
http_action/configdefine all the public API routes for Performance Analyzer.http_action/config/RestConfigdefinesPA_BASE_URI = "/_plugins/_performanceanalyzer"PerformanceAnalyzerResourceProviderdefines themetrics,rca,batchandactionsroutes.PerformanceAnalyzerResourceProvider.SUPPORTED_REDIRECTIONS = ("rca", "metrics", "batch", "actions")
-
listener/PerformanceAnalyzerSearchListenerhooks into OpenSearch core to emit search operation related metrics. -
writer/EventLogQueueProcessor:- contains
purgeQueueAndPersistwhich drainsPerformanceAnalyzerMetrics.metricQueueinto a file that contains all events for a certain time bucket. It also removes old events. Usesevent_process.EventLogFileHandlerin Performance Analyzer Commons for file writing logic. scheduleExecutorperiodically runspurgeQueueAndPersist.
- contains
-
Classes in
collectorsextendPerformanceAnalyzerMetricsCollectorand implementMetricsProcessor.PerformanceAnalyzerMetricsCollectorimplementsRunnableand contains common variables likevaluewhere a collector stores serialized metrics.- A collector is triggered through
PerformanceAnalyzerMetricsCollector.collectMetrics.- The collector will store serialized data in the
valuevariable and then callMetricsProcessor.saveMetricValues. saveMetricValuescallsPerformanceAnalyzerMetrics.emitMetricthat creates anEventfrom the serialized data and adds it to a static queue (PerformanceAnalyzerMetrics.metricQueue) shared across all collectors.
- The collector will store serialized data in the