code: public Integer getMonitorId(final MetricIdentity identity) throws IOException, HttpException {
  		Preconditions.checkNotNull(identity);
  		
  		if (monitorIds.containsKey(identity)) {
  			return monitorIds.get(identity);
  		}
  		
  		long lastQuery = 0;
  		
  		if (lastQueries.containsKey(identity)) {
  			lastQuery = lastQueries.get(identity);
  		}
  		
  		long currentTimeMillis = System.currentTimeMillis();
  		
  		if (lastQuery + FIVE_MINUTES_MILLIS < currentTimeMillis) {
  			try {
  				lastQueries.put(identity, lastQuery);
  				
  				AppIdentity appIdentity = appIdentityService.getAppIdentity();
  				
  				if (appIdentity != null) {
  					
  					int monitorId = getMetricInfo(identity, appIdentity);
  					
  					LOGGER.debug("Metric {} monitor id: {}", identity, monitorId);
  					
  					if (0 < monitorId) {
  						monitorIds.put(identity, monitorId);
  					}
  				}
  			} catch (Throwable t) {
  				LOGGER.info("Unable to determine monitor id for metric {}", identity, t);
  			}
  		}
  
  		if (monitorIds.containsKey(identity)) {
  			return monitorIds.get(identity);
  		}
  		
  		return null;
  	}
docs: Gets the monitor id for this metric
  @param identity The metric identity
  @return The monitor id (optional)
  @throws IOException
  @throws HttpException