private EventsIO getEventsIO() { if (this.eventsIO == null) { this.eventsIO = (EventsIO) ModuleLoader.getInstance(EventsIO.class, CoreConfig.EVENTS_MODULES); } return this.eventsIO; }
public HttpMetricNamesHandler() { log.info("Token search improvements enabled: " + EXP_TOKEN_SEARCH_IMPROVEMENTS); if (EXP_TOKEN_SEARCH_IMPROVEMENTS) { discoveryHandle = (TokenDiscoveryIO) ModuleLoader.getInstance(TokenDiscoveryIO.class, CoreConfig.TOKEN_DISCOVERY_MODULES); } else { discoveryHandle = (DiscoveryIO) ModuleLoader.getInstance(DiscoveryIO.class, CoreConfig.DISCOVERY_MODULES); } }
private HttpEventsIngestionHandler getHttpEventsIngestionHandler() { if (this.httpEventsIngestionHandler == null) { this.httpEventsIngestionHandler = new HttpEventsIngestionHandler((EventsIO) ModuleLoader.getInstance(EventsIO.class, CoreConfig.EVENTS_MODULES)); } return this.httpEventsIngestionHandler; }
@Override public void handle(ChannelHandlerContext ctx, FullHttpRequest request) { Tracker.getInstance().track(request); final String tenantId = request.headers().get("tenantId"); HttpRequestWithDecodedQueryParams requestWithParams = (HttpRequestWithDecodedQueryParams) request; // get the query param List<String> query = requestWithParams.getQueryParams().get("query"); if (query == null || query.size() != 1) { DefaultHandler.sendErrorResponse(ctx, request, "Invalid Query String", HttpResponseStatus.BAD_REQUEST); return; } // default discoveryHandle to DISCOVERY_MODULES discoveryHandle = (DiscoveryIO) ModuleLoader.getInstance(DiscoveryIO.class, CoreConfig.DISCOVERY_MODULES); if (discoveryHandle == null) { sendResponse(ctx, request, null, HttpResponseStatus.NOT_FOUND); return; } try { List<SearchResult> searchResults = discoveryHandle.search(tenantId, query.get(0)); sendResponse(ctx, request, getSerializedJSON(searchResults), HttpResponseStatus.OK); } catch (Exception e) { log.error(String.format("Exception occurred while trying to get metrics index for %s", tenantId), e); DefaultHandler.sendErrorResponse(ctx, request, "Error getting metrics index", HttpResponseStatus.INTERNAL_SERVER_ERROR); } }
Object discoveryModule = ModuleLoader.getInstance(ElasticIO.class, CoreConfig.DISCOVERY_MODULES); Assert.assertNotNull("discoveryModule should not be null", discoveryModule); Assert.assertTrue( Object eventsModules = ModuleLoader.getInstance(EventsIO.class, CoreConfig.EVENTS_MODULES); Assert.assertNotNull("eventsModules should not be null", eventsModules); Assert.assertTrue( (ModuleLoader.getInstance(DiscoveryIO.class, CoreConfig.DISCOVERY_MODULES)) instanceof EventsIO); (ModuleLoader.getInstance(DiscoveryIO.class, CoreConfig.EVENTS_MODULES)) instanceof DiscoveryIO); } finally { System.clearProperty("DISCOVERY_MODULES");