/* Return a self-configured monitored Resource.
969173
public static MonitoredResource getResource(String projectId, String resourceTypeParam) {
    String resourceType = resourceTypeParam;
    if (Strings.isNullOrEmpty(resourceType)) {
      Resource detectedResourceType = getAutoDetectedResourceType();
      resourceType = detectedResourceType.getKey();
    }
    // Currently, "gae_app" is the supported logging Resource type, but we distinguish
    // between "gae_app_flex", "gae_app_standard" to support zone id, instance name logging on flex
    // VMs.
    // Hence, "gae_app_flex", "gae_app_standard" are trimmed to "gae_app"
    String resourceName = resourceType.startsWith("gae_app") ? "gae_app" : resourceType;
    MonitoredResource.Builder builder =
        MonitoredResource.newBuilder(resourceName).addLabel(Label.ProjectId.getKey(), projectId);

    for (Label label : resourceTypeWithLabels.get(resourceType)) {
      String value = getValue(label);
      if (value != null) {
        builder.addLabel(label.getKey(), value);
      }
    }
    return builder.build();
  }
943112
public static lbmonbindings_service_binding[] get(nitro_service service, String monitorname) throws Exception{
		lbmonbindings_service_binding obj = new lbmonbindings_service_binding();
		obj.set_monitorname(monitorname);
		lbmonbindings_service_binding response[] = (lbmonbindings_service_binding[]) obj.get_resources(service);
		return response;
	}
131182
function() {
      var localStorage = root.localStorage;
      if (!hostName) {
        if (localStorage) {hostName = localStorage.hostName;}
        hostName = hostName || Monitor.generateUniqueId();
        if (localStorage) {localStorage.hostName = hostName;}
      }
      return hostName;
    }
1306533
public com.google.api.Monitoring getMonitoring() {
    return monitoring_ == null ? com.google.api.Monitoring.getDefaultInstance() : monitoring_;
  }
773021
def _get_tracker(self, resource):
        
        with self._lock:
            for rt in self._reference_queue:
                if rt is not None and resource is rt.resource:
                    return rt

        raise UnknownResourceError('Resource not created by pool')
1274996
def make_client(api_version, session=None,
                endpoint=None, service_type='monitoring'):
    """"""

    client_cls = utils.get_client_class('monitoring', api_version, VERSION_MAP)
    c = client_cls(
        session=session,
        service_type=service_type,
        endpoint=endpoint,
        app_name='monascaclient',
        app_version=version.version_string,
    )

    return c
184824
private MonitorInformation getMonitorInformation(L location) {
		final K monitorKey = getLocationKey(location);
		MonitorInformation monitorInformation = monitorInformations.get(monitorKey);
		if (monitorInformation == null) {
			// Not found, let's call delegate
			if (delegate.isMonitored(location)) {
				monitorInformation = new MonitorInformation(true, delegate.getMonitor(location));
			} else {
				monitorInformation = NULL_MONITOR_INFORMATION;
			}
			monitorInformations.put(monitorKey, monitorInformation);
		}
		return monitorInformation;
	}
739282
def getMonitorById(self, monitorId):
        
        url = self.baseUrl
        url += "getMonitors?apiKey=%s&monitors=%s" % (self.apiKey, monitorId)
        url += "&noJsonCallback=1&format=json"
        success, response = self.requestApi(url)
        if success:
            status = response.get('monitors').get('monitor')[0].get('status')
            alltimeuptimeratio = response.get('monitors').get('monitor')[0].get('alltimeuptimeratio')
            return status, alltimeuptimeratio
        return None, None
1336978
def monitor(self, operation='', **kw):
        
        mon = self._monitor(operation, hdf5=self.datastore.hdf5)
        self._monitor.calc_id = mon.calc_id = self.datastore.calc_id
        vars(mon).update(kw)
        return mon
947851
@GuardedBy("monitor")
  @VisibleForTesting
  static MetricServiceClient createMetricServiceClient(@Nullable Credentials credentials)
      throws IOException {
    MetricServiceSettings.Builder settingsBuilder =
        MetricServiceSettings.newBuilder()
            .setTransportChannelProvider(
                InstantiatingGrpcChannelProvider.newBuilder()
                    .setHeaderProvider(OPENCENSUS_USER_AGENT_HEADER_PROVIDER)
                    .build());
    if (credentials != null) {
      settingsBuilder.setCredentialsProvider(FixedCredentialsProvider.create(credentials));
    }
    return MetricServiceClient.create(settingsBuilder.build());
  }
708041
public EventRecord[] monitor() {

    ArrayList<EventRecord> recs = new ArrayList<EventRecord>();
    EventRecord er;

    while ((er = getNext()) != null)
      recs.add(er);

    EventRecord[] T = new EventRecord[recs.size()];

    return recs.toArray(T);
  }
635963
private synchronized JobMonitor getJobMonitor(JobStatus status) {
    UUID jobId = status.getJobId();
    JobMonitor monitor = monitors.get(jobId);
    if (monitor == null) {
      monitor = new JobMonitor(factory.createProgressMonitor(status.getDescription()));
      monitors.put(jobId, monitor);
    }
    return monitor;
  }
765784
public static lbmonitor_binding get(nitro_service service, String monitorname) throws Exception{
		lbmonitor_binding obj = new lbmonitor_binding();
		obj.set_monitorname(monitorname);
		lbmonitor_binding response = (lbmonitor_binding) obj.get_resource(service);
		return response;
	}
935144
@Bean
	@ConditionalOnProperty(prefix = JavaMelodyConfigurationProperties.PREFIX, name = "spring-monitoring-enabled", matchIfMissing = true)
	public MonitoringSpringAdvisor monitoringSpringRestControllerAdvisor() {
		return new MonitoringSpringAdvisor(new AnnotationMatchingPointcut(RestController.class));
	}
312746
@Bean
	@ConditionalOnProperty(prefix = JavaMelodyConfigurationProperties.PREFIX, name = "management-endpoint-monitoring-enabled", matchIfMissing = false)
	public MonitoringEndpoint monitoringEndpoint(final ServletContext servletContext) {
		return new MonitoringEndpoint(servletContext);
	}
1043577
protected M getMonitorForCurrentContext() {
    MonitorConfig contextConfig = getConfig();
    M monitor = monitors.get(contextConfig);
    if (monitor == null) {
      M newMon = newMonitor.apply(contextConfig);
      if (newMon instanceof SpectatorMonitor) {
        ((SpectatorMonitor) newMon).initializeSpectator(spectatorTags);
      }
      monitor = monitors.putIfAbsent(contextConfig, newMon);
      if (monitor == null) {
        monitor = newMon;
      }
    }
    return monitor;
  }
744460
def get_resource(self):
        '''
        
        '''
        # Basename could be used for controlling caching
        # basename = 'viewers_%s' % settings.get_cache_string()
        node_packages = self.get_node_packages()
        # sort_keys is essential to ensure resulting string is
        # deterministic (and thus hashable)
        viewers_data_str = json.dumps(node_packages, sort_keys=True)
        viewers_data = viewers_data_str.encode('utf8')
        viewers_resource = ForeignBytesResource(
            viewers_data,
            extension=VIEWER_EXT,
            # basename=basename,
        )
        return viewers_resource