@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;
    }

    // get the include_enum_values param to determine if results should contain enum values if
    // applicable
    List<String> includeEnumValues = requestWithParams.getQueryParams().get("include_enum_values");

    if ((includeEnumValues != null)
        && (includeEnumValues.size() != 0)
        && (includeEnumValues.get(0).compareToIgnoreCase("true") == 0)) {
      // include_enum_values is present and set to true, use the ENUMS_DISCOVERY_MODULES as the
      // discoveryHandle
      discoveryHandle =
          (DiscoveryIO)
              ModuleLoader.getInstance(DiscoveryIO.class, CoreConfig.ENUMS_DISCOVERY_MODULES);
    } else {
      // 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);
    }
  }