public static String categorizeThreadName()

in src/main/java/org/opensearch/performanceanalyzer/reader/MetricsEmitter.java [514:564]


    public static String categorizeThreadName(String threadName, Dimensions dimensions) {
        // shardSearch and shardBulk os metrics are emitted by emitAggregatedOSMetrics and
        // emitWorkloadMetrics functions.
        // Hence these are ignored in this emitter.
        if (SEARCH_PATTERN.matcher(threadName).matches()) {
            return "search";
        }
        if (BULK_PATTERN.matcher(threadName).matches()
                || WRITE_PATTERN.matcher(threadName).matches()) {
            return "write";
        }

        if (GC_PATTERN.matcher(threadName).matches()) {
            return "GC";
        }
        if (REFRESH_PATTERN.matcher(threadName).matches()) {
            return "refresh";
        }
        if (MANAGEMENT_PATTERN.matcher(threadName).matches()) {
            return "management";
        }
        if (HTTP_SERVER_PATTERN.matcher(threadName).matches()) {
            return "httpServer";
        }
        if (TRANS_WORKER_PATTERN.matcher(threadName).matches()) {
            return "transportWorker";
        }
        if (GENERIC_PATTERN.matcher(threadName).matches()) {
            return "generic";
        }
        if (FLUSH_PATTERN.matcher(threadName).matches()) {
            return "flush";
        }
        if (SNAPSHOT_PATTERN.matcher(threadName).matches()) {
            return "snapshot";
        }
        if (GET_PATTERN.matcher(threadName).matches()) {
            return "get";
        }

        Matcher mergeMatcher = MERGE_PATTERN.matcher(threadName);
        if (mergeMatcher.matches()) {
            dimensions.put(
                    ShardRequestMetricsSnapshot.Fields.INDEX_NAME.toString(),
                    mergeMatcher.group(1));
            dimensions.put(
                    ShardRequestMetricsSnapshot.Fields.SHARD_ID.toString(), mergeMatcher.group(2));
            return "merge";
        }
        return "other";
    }