github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/webapp/javascript/pages/exemplars/filterNonCPU.ts (about)

     1  /**
     2   * filterNonCPU filters out apps that are not cpu
     3   * it DOES not filter apps that can't be identified
     4   * Notice that the heuristic here is weak and should be updated when more info is available (such as units)
     5   */
     6  export function filterNonCPU(appName: string): boolean {
     7    const suffix = appName.split('.').pop();
     8    if (!suffix) {
     9      return true;
    10    }
    11  
    12    // Golang
    13    if (suffix.includes('alloc_objects')) {
    14      return false;
    15    }
    16  
    17    if (suffix.includes('alloc_space')) {
    18      return false;
    19    }
    20  
    21    if (suffix.includes('goroutines')) {
    22      return false;
    23    }
    24  
    25    if (suffix.includes('inuse_objects')) {
    26      return false;
    27    }
    28  
    29    if (suffix.includes('inuse_space')) {
    30      return false;
    31    }
    32  
    33    if (suffix.includes('mutex_count')) {
    34      return false;
    35    }
    36  
    37    if (suffix.includes('mutex_duration')) {
    38      return false;
    39    }
    40  
    41    // Java
    42    if (suffix.includes('alloc_in_new_tlab_bytes')) {
    43      return false;
    44    }
    45  
    46    if (suffix.includes('alloc_in_new_tlab_objects')) {
    47      return false;
    48    }
    49  
    50    if (suffix.includes('lock_count')) {
    51      return false;
    52    }
    53  
    54    if (suffix.includes('lock_duration')) {
    55      return false;
    56    }
    57  
    58    return true;
    59  }