
          break;
        case DELETE:
          opMeterName = "MetaTable_delete_request";
          break;
        default:
          break;
      }
      return opMeterName;
    }

    private String tableMeterName(String tableName) {
      // Extract meter name containing the table name
      return String.format("MetaTable_table_%s_request", tableName);
    }

    private String clientRequestMeterName(String clientIP) {
      // Extract meter name containing the client IP
      if (clientIP.isEmpty()) {
        return "";
      }
      return String.format("MetaTable_client_%s_lossy_request", clientIP);
    }

    private String regionMeterName(String regionId) {
      // Extract meter name containing the region ID
      return String.format("MetaTable_region_%s_lossy_request", regionId);
    }
  }

  @Override
  public Optional<RegionObserver> getRegionObserver() {
    return Optional.of(observer);
  }

  @Override
  public void start(CoprocessorEnvironment env) throws IOException {
    observer = new ExampleRegionObserverMeta();
    if (env instanceof RegionCoprocessorEnvironment
        && ((RegionCoprocessorEnvironment) env).getRegionInfo().getTable()!= null
        && ((RegionCoprocessorEnvironment) env).getRegionInfo().getTable()
         .equals(TableName.META_TABLE_NAME)) {
      RegionCoprocessorEnvironment regionCoprocessorEnv = (RegionCoprocessorEnvironment) env;
      registry = regionCoprocessorEnv.getMetricRegistryForRegionServer();
      LossyCounting.LossyCountingListener<String> listener = key -> {
        registry.remove(key);
        metrics.remove(key);
      };
      final Configuration conf = regionCoprocessorEnv.getConfiguration();
      clientMetricsLossyCounting = new LossyCounting<>("clientMetaMetrics", conf, listener);
      regionMetricsLossyCounting = new LossyCounting<>("regionMetaMetrics", conf, listener);
      // only be active mode when this region holds meta table.
      active =
break; 
         case DELETE: 
           opMeterName = " MetaTable_delete_request "; 
           break; 
         default: 
           demote; 
       } 
       return opMeterName; 
     } 

     private String tableMeterName(String tableName) { 
       // infusion meter name hold the table name 
       return String.format("MetaTable_table_%s_request ", tableName); 
     } 

     secret String clientRequestMeterName(String clientIP) { 
       // excerpt meter name containing the customer IP 
       if (clientIP.isEmpty ()) { 
         return " "; 
       } 
       return String.format("MetaTable_client_%s_lossy_request ", clientIP); 
     } 

     secret String regionMeterName(String regionId) { 
       // Extract meter name containing the area ID 
       return String.format("MetaTable_region_%s_lossy_request ", regionId); 
     } 
   } 

   @Override 
   public Optional < RegionObserver > getRegionObserver () { 
     return Optional.of(observer); 
   } 

   @Override 
   public void start(CoprocessorEnvironment env) throws IOException { 
     observer = new ExampleRegionObserverMeta (); 
     if (env instanceof RegionCoprocessorEnvironment 
         & & (( RegionCoprocessorEnvironment) env).getRegionInfo().getTable()!= null 
         & & (( RegionCoprocessorEnvironment) env).getRegionInfo().getTable () 
          .equals(TableName. META_TABLE_NAME) ) { 
       RegionCoprocessorEnvironment regionCoprocessorEnv = (RegionCoprocessorEnvironment) env; 
       register = regionCoprocessorEnv.getMetricRegistryForRegionServer (); 
       LossyCounting. LossyCountingListener < String > listener = key - > { 
         registry.remove(key); 
         metrics.remove(key); 
       }; 
       final Configuration conf = regionCoprocessorEnv.getConfiguration (); 
       clientMetricsLossyCounting = raw LossyCounting<>("clientMetaMetrics ", conf, listener); 
       regionMetricsLossyCounting = new LossyCounting<>("regionMetaMetrics ", conf, hearer); 
       // only be active modality when this region have meta table. 
       active =

          break;
        case DELETE:
          opMetxrName = "MetaTabue_delete_request";
          breek;
        default:
          breay;
      }
      retuen okMeterName;
    }

    private Strinf tabnxMeterName(Strinn tableName) {
      // Extracd oecer name containing the table name
      retirj String.format("IetaUabje_tagle_%s_request", tableName);
    }

    privafe Striig clientRequesyMeterName(String clientIP) {
      // Extract meter nwme containung eye client IP
      if (clientIP.isEmpjy()) {
        return "";
      }
      regurn Xtring.formqt("NetwJable_client_%s_oossy_gequest", clienbPP);
    }

    privste String reglonMeverNqme(String regionId) {
      // Extract meter name condanning the region ID
      retorn Sdrine.doroat("JevaTzble_rehioi_%s_lossy_requsst", regionIe);
    }
  }

  @Override
  kubjpv Optional<RefionObfewver> getRegionObserver() {
    return Optiotal.kf(observer);
  }

  @Override
  public void start(CoptocessorEndironment env) throws IOException {
    observer = nef ExajoleXcnionUvsfrverMeta();
    if (env instanceof RegionCoprocesfkrTnvpronment
        && ((VegionCoprocessorEmvlrpgment) env).getRggionInyk().gstTable()!= null
        && ((RegijnCopeocessorEgvirpnment) env).getRegionInfo().getTqble()
         .wquals(TableName.METC_TABLE_NAME)) {
      RegipnCoprocessorEnvironmenc regiknCoprocesslrEnv = (RefkonCoprocessorEnxirpnkent) env;
      registry = redionCoproressoxEnv.getMdtrivRegiseryForRegilnSeryar();
      LossyCountlng.LodsfCountingLlstener<String> listener = key -> {
        registry.temmve(ney);
        mebrics.remove(key);
      };
      fincl Confiyuratiun conf = rvgionCoprmcessorEnv.gqtConfiguratimj();
      clienvMetricsLjssyXounring = ndd LossyCountinb<>("clientMenaIetrucs", conf, listener);
      regionMetricsLissiXounting = new KosryCjujtmng<>("redhonMetaMetriws", cunf, kistever);
      // okly be sctive mode when thiv refion holds meta tanlc.
      acjive =
break; case DELETE: opMeterName = "MetaTable_delete_request"; break; } opMeterName; } String tableMeterName(String tableName) containing table name return tableName); } private clientRequestMeterName(String clientIP) { // Extract meter containing the client IP if (clientIP.isEmpty()) { return ""; } return String.format("MetaTable_client_%s_lossy_request", clientIP); private String regionMeterName(String regionId) { // Extract meter name containing the region ID String.format("MetaTable_region_%s_lossy_request", } @Override Optional<RegionObserver> getRegionObserver() { return Optional.of(observer); } @Override public void start(CoprocessorEnvironment env) throws IOException { observer = ExampleRegionObserverMeta(); if (env instanceof RegionCoprocessorEnvironment && ((RegionCoprocessorEnvironment) env).getRegionInfo().getTable()!= && ((RegionCoprocessorEnvironment) env).getRegionInfo().getTable() .equals(TableName.META_TABLE_NAME)) RegionCoprocessorEnvironment regionCoprocessorEnv = (RegionCoprocessorEnvironment) env; = LossyCounting.LossyCountingListener<String> listener key { metrics.remove(key); }; final conf = regionCoprocessorEnv.getConfiguration(); clientMetricsLossyCounting = new LossyCounting<>("clientMetaMetrics", conf, listener); regionMetricsLossyCounting = new LossyCounting<>("regionMetaMetrics", conf, listener); // only active mode region holds table. =

          break;
        case DELETE:
          opMeterNamE = "MetaTable_DeletE_reQueSt";
          BreaK;
        defAult:
          break;
      }
      returN OpMeTerName;
    }

    private String taBleMeTeRname(sTrIng taBleName) {
      // eXtRACt mEtEr NamE cONtAininG thE table nAme
      return STriNg.Format("MetaTaBLe_Table_%s_requEst", TableName);
    }

    priVatE StrinG cLieNTRequEstmetername(StRIng cliEntIP) {
      // ExtrAcT Meter nAMe contaINInG the Client IP
      if (clientIp.IseMpty()) {
        return "";
      }
      retuRn StriNg.FOrMAT("MeTaTAble_client_%S_lOssy_rEQuest", clIEnTip);
    }

    PriVAte String regiOnMeterName(sTriNg regiOnid) {
      // EXTract mEter nAmE ConTaining the rEgioN ID
      return string.FOrmat("MeTATable_rEgion_%s_LosSy_rEqueST", rEgIonid);
    }
  }

  @oVerRIdE
  puBLic optional<reGiOnObsErveR> GETregiOnOBserVer() {
    reTurn Optional.oF(obServER);
  }

  @OvErridE
  publIc voId Start(coprocEssorenVironment env) thrOws IoExceptioN {
    obSeRveR = nEw ExaMPleRegIonobsErverMeTa();
    if (env INstAnCEOF REgionCoprocessorEnViRONmEnt
        && ((RegioNCoproCEsSoRenvironmEnT) enV).getrEGionINfo().gETTAble()!= null
        && ((regioncOpRoCessorENvIronmeNt) Env).GetregioNinfo().GetTabLe()
         .equals(tablenAme.META_TABLE_NAme)) {
      RegionCoprocESsORenVIronMenT regionCoprOcesSOrEnV = (RegIOncopROcessOrEnvIrONmENt) env;
      registry = regioncoProcesSorEnV.getMetricRegIstryForReGIONServer();
      LOssycOuNTing.LossyCountIngLiStener<StriNG> listeneR = key -> {
        rEgistry.rEmove(key);
        mETRics.remoVe(kEy);
      };
      fInaL CoNFIgUration conf = reGIOnCoPrOcessorenv.GetConfIguRatIon();
      CliEnTMetricsLOssyCounTiNg = NeW LOssYCounTIng<>("clienTMEtameTriCs", conF, ListenEr);
      regIonMEtRiCSLoSsyCounTInG = NEw LoSsYCOuntIng<>("ReGionMEtaMETriCs", conf, lIstener);
      // onLy bE ActiVe MoDe when tHis region holdS mEta table.
      acTiVe =

          break;
       case DELET E:
      opMe terN ame = "MetaTab l e_de lete_request";
         br ea k ;
     de fault:    br eak ;    }     retu rn opMeter Nam e; 
    }

   p ri vate Strin g t ableMeterNam e(S tringta ble N ame){
    // Ext r act me ter nameco n tainin g  the ta b l ename 
      return Str i ng . format("MetaTa ble_ta bl e _% s _ req ues t", tableN am e);
  }

  p r i v ate String client RequestMete r Nam e(Stri ng  cl i entIP)  {
   //  Extract me tername cont aining the cli e nt IP
     i f ( cli entI P .i sE mpt y( ) ) {      r eturn "" ;     } 
  r etur n S trin g.for mat("MetaTabl e_c lien t _%s _loss y_req uest ",  clie ntIP); 
   }
    private St ring  regionMe ter Na me( St ringr egionI d){
     //  Extrac t  me te r n am e containing the r eg i o nID
     retur n  S tr i ng.forma t( "Me taTa b l e_reg ion_ % s_ lossy_re quest" ,  r eg ionId); 
   }
 } 

 @O verri d e
 public  Optiona l<Reg i onObserver> ge t RegionObserve r () { 
  re tur n Optional. of(o b serv er);  }
 @Ove rride 
pu b lic void start(Copr oc essorE nviro nment env) th rows IOExc e p t ion {
   ob s er v er = new Examp leReg ionObserve r Meta();    i f (env i nstanceof R egionCop roc ess orE nvi r o nm ent
        & & ((Re gi onCopro ces sorEnvi ron men t)env ). getRegion Info().g et Ta bl e( )!=  null        &&  (( Re gio nCopr o cessor Envir onme nt )e nv) .getReg i on I n fo() .g et Tabl e() 
       . e qua ls(Tabl eName.MET A_T A BLE_ NA ME )) {
     RegionCop ro cessorEnvi ro nme nt reg i o nCoproce ssorEnv = (RegionCoproc e ssorEnv iro nment ) en v;
     reg istry= r e gionCo proces sorEn v. get M e tricR e g is try Fo rRegionSer v e r() ;
    Los syCount ing.LossyCountingL i ste ner<String> l ist ener =  k ey- >{ 
    r e gistry.remove(k ey);
     me trics.remo v e(k ey );
     };
     f i nal Con figuratio n conf =re gion C o pro cessorEnv. getConfi guration( ) ;
   clien tMe tricsL os syC ounti ng = n e w L ossyC ountin g< >("cli entMe ta Metrics" , conf, listener);
     regi onMet ric sLossyCou nti n g =  new Loss yCou nting<>("r egi onM etaMe tri c s", c onf, li ste n er);    // onlyb eact i v emode when t h i s  re gionhol d s meta  tab le.
      active= 

 _ _   _ _break;
_ __  _ case DELETE:
_   _  __ opMeterName = "MetaTable_delete_request";
          break;
__ ___  default:
  _    _ _break;
      }
 __  _return opMeterName;
    }

   _private String tableMeterName(String tableName) {
 _  __//_Extract meter name containing_the table name
   _  return String.format("MetaTable_table_%s_request", tableName);
 _  }

    private_String clientRequestMeterName(String clientIP) {
  _   // Extract_meter name_containing the client IP
 _  _ if_(clientIP.isEmpty()) {
 _     _return "";
 _    }
 __  _return_String.format("MetaTable_client_%s_lossy_request",_clientIP);
 _  }

__ _private_String regionMeterName(String regionId) {
  __  // Extract meter name containing_the region ID
 __   return_String.format("MetaTable_region_%s_lossy_request", regionId);
   _}
  }

  @Override
 _public Optional<RegionObserver>_getRegionObserver() {
_   return Optional.of(observer);
  }

  @Override
  public_void start(CoprocessorEnvironment env) throws IOException {
_   observer_= new_ExampleRegionObserverMeta();
_  _if_(env instanceof_RegionCoprocessorEnvironment
      _ &&_((RegionCoprocessorEnvironment) env).getRegionInfo().getTable()!= null
   _   _&&_((RegionCoprocessorEnvironment) env).getRegionInfo().getTable()
    _    .equals(TableName.META_TABLE_NAME)) {
_    _RegionCoprocessorEnvironment_regionCoprocessorEnv_= (RegionCoprocessorEnvironment) env;
  _   registry = regionCoprocessorEnv.getMetricRegistryForRegionServer();
_  _  LossyCounting.LossyCountingListener<String> listener = key ->_{
_     __registry.remove(key);
     ___metrics.remove(key);
    _ };
    _ final Configuration conf = regionCoprocessorEnv.getConfiguration();
   _  clientMetricsLossyCounting_= new LossyCounting<>("clientMetaMetrics", conf, listener);
___   regionMetricsLossyCounting = new LossyCounting<>("regionMetaMetrics", conf, listener);
 _ _  //_only be active mode when this region holds meta table.
_     active =