Returns stats for producer.

@param producer {@link OnDemandStatsProducer}
@param name stats name
@return stats for producer
972747
protected final T getStats(OnDemandStatsProducer producer, String name) {
        try {
            return getStatsClass().cast(producer.getStats(name));
        } catch (ClassCastException e) {
            LOGGER.error("getStats(): Unexpected stats type", e);
        } catch (OnDemandStatsProducerException e) {
            LOGGER.error("getStats(): Failed to get stats for name=" + name, e);
        }

        return null;
    }
37687
private static QualityIndicator<List<PointSolution>, Double> getIndicatorFromName(
      String name, List<QualityIndicator<List<PointSolution>, Double>> list) {
    QualityIndicator<List<PointSolution>, Double> result = null ;

    for (QualityIndicator<List<PointSolution>, Double> indicator : list) {
      if (indicator.getName().equals(name)) {
        result = indicator ;
      }
    }

    if (result == null) {
      throw new JMetalException("Indicator " + name + " not available") ;
    }

    return result ;
  }
291668
public static String getMetricName(String name) {
    switch (CommonUtils.PROCESS_TYPE.get()) {
      case CLIENT:
        return getClientMetricName(name);
      case MASTER:
        return getMasterMetricName(name);
      case PROXY:
        return getProxyMetricName(name);
      case WORKER:
        return getWorkerMetricName(name);
      case JOB_MASTER:
        return getJobMasterMetricName(name);
      case JOB_WORKER:
        return getJobWorkerMetricName(name);
      default:
        throw new IllegalStateException("Unknown process type");
    }
  }
483944
private void populateCumulatedStats(final StatDecoratorBean decoratorBean, final List<StatLineAO> allStatLines) {
		if (allStatLines == null || allStatLines.isEmpty()) {
			LOGGER.warn("Producer's stats are empty");
			return;
		}

		final int cumulatedIndex = getCumulatedIndex(allStatLines);
		if (cumulatedIndex == -1)
			return;

		final StatLineAO cumulatedStatLineAO = allStatLines.get(cumulatedIndex);

		final StatBean cumulatedStat = new StatBean();
		cumulatedStat.setName(cumulatedStatLineAO.getStatName());
		cumulatedStat.setValues(cumulatedStatLineAO.getValues());

		decoratorBean.setCumulatedStat(cumulatedStat);
	}
103248
public static inat_stats get(nitro_service service, String name) throws Exception{
		inat_stats obj = new inat_stats();
		obj.set_name(name);
		inat_stats response = (inat_stats) obj.stat_resource(service);
		return response;
	}
728987
public java.util.Map captureStatistics(String name
                    )
                                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this,
                        cclass,
                        "captureStatistics",
                        new Object[] { name });

        java.util.Map statistics = new java.util.HashMap(); // To be returned.

        synchronized (objectManagerState) {
            if (!(objectManagerState.state == ObjectManagerState.stateColdStarted)
                && !(objectManagerState.state == ObjectManagerState.stateWarmStarted)) {
                if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                    trace.exit(this, cclass
                               , "addEntry"
                               , new Object[] { new Integer(objectManagerState.state), ObjectManagerState.stateNames[objectManagerState.state] }
                                    );
                throw new InvalidStateException(this, objectManagerState.state, ObjectManagerState.stateNames[objectManagerState.state]);
            }

            if (name.equals("*")) {
                statistics.putAll(objectManagerState.logOutput.captureStatistics());
                statistics.putAll(captureStatistics());

            } else if (name.equals("LogOutput")) {
                statistics.putAll(objectManagerState.logOutput.captureStatistics());

            } else if (name.equals("ObjectManager")) {
                statistics.putAll(captureStatistics());

            } else {
                if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                    trace.exit(this,
                               cclass,
                               "captureStatistics",
                               new Object[] { name });
                throw new StatisticsNameNotFoundException(this,
                                                          name);
            } // if (name.equals...
        } // synchronized (objectManagerState).

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass
                       , "captureStatistics"
                       , statistics
                            );
        return statistics;
    }
1217757
public static dospolicy_stats get(nitro_service service, String name) throws Exception{
		dospolicy_stats obj = new dospolicy_stats();
		obj.set_name(name);
		dospolicy_stats response = (dospolicy_stats) obj.stat_resource(service);
		return response;
	}
1167476
private OnDemandStatsProducer<PageInBrowserStats> createProducer(final String producerId, final String category, final String subsystem) {
		OnDemandStatsProducer<PageInBrowserStats> producer = limit == -1 ? new OnDemandStatsProducer<PageInBrowserStats>(producerId, category, subsystem, new PageInBrowserStatsFactory()) :
				new EntryCountLimitedOnDemandStatsProducer<PageInBrowserStats>(producerId, category, subsystem, new PageInBrowserStatsFactory(), limit);

		ProducerRegistryFactory.getProducerRegistryInstance().registerProducer(producer);
		return producer;
	}
425225
public static ProducerSnapshot createSnapshot(IStatsProducer producer, String intervalName){
		ProducerSnapshot ret = new ProducerSnapshot();
		ret.setCategory(producer.getCategory());
		ret.setSubsystem(producer.getSubsystem());
		ret.setProducerId(producer.getProducerId());
		ret.setIntervalName(intervalName);


		List<IStats> stats = producer.getStats();
		if (stats!=null && stats.size()>0)
			ret.setStatClassName(stats.get(0).getClass().getName());


		//optimization
		if (stats==null || stats.size()==0)
			return ret;
		List<String> cachedValueNames = stats.get(0).getAvailableValueNames();


		for (IStats stat : stats){
			ret.addSnapshot(createStatSnapshot(stat, intervalName, cachedValueNames));
		}

		return ret;
	}
561254
private void reportMetered(final String name, final Metered meter) {
      EnumSet<MetricField> fields = reportedMetrics.get(name);
      if(fields == null) {
         return;
      }

      String nrName = buildRate(name);

      if(fields.contains(MetricField.ONE_MINUTE_RATE)) {
         NewRelic.recordMetric(nrName, (float)meter.getOneMinuteRate());
      }

      if(fields.contains(MetricField.FIVE_MINUTE_RATE)) {
         NewRelic.recordMetric(nrName, (float)meter.getFiveMinuteRate());
      }

      if(fields.contains(MetricField.FIFTEEN_MINUTE_RATE)) {
         NewRelic.recordMetric(nrName, (float)meter.getOneMinuteRate());
      }

      if(fields.contains(MetricField.MEAN_RATE)) {
         NewRelic.recordMetric(nrName, (float)meter.getMeanRate());
      }

      if(fields.contains(MetricField.COUNT)) {
         NewRelic.recordMetric(nrName, (float)meter.getCount());
      }
   }
272854
public Object getServiceHandler(String name) {
        Map<String, Object> serviceHandlers = getServiceHandlers(false);
        if (serviceHandlers == null) {
            return null;
        }
        return serviceHandlers.get(name);
    }
297376
public ParametricStatement getParametricStatement(String name) {
        ParametricStatement statement = _statements.get(name);
        if (statement != null) {
            return statement;
        } else {
            throw new RuntimeException("ParametricStatement '" + name + "' not found");
        }
    }
339526
public static authenticationvserver_stats get(nitro_service service, String name) throws Exception{
		authenticationvserver_stats obj = new authenticationvserver_stats();
		obj.set_name(name);
		authenticationvserver_stats response = (authenticationvserver_stats) obj.stat_resource(service);
		return response;
	}
1133203
private static String getClientMetricName(String name) {
    String result = CACHED_METRICS.get(name);
    if (result != null) {
      return result;
    }
    return CACHED_METRICS.computeIfAbsent(name,
        n -> getMetricNameWithUniqueId(InstanceType.CLIENT, name));
  }
636024
public MetricsProvider getProvider(String name) throws MetricsException {
		if(container.containsKey(name)) {
			return (MetricsProvider) container.get(name);
		} else {
			throw new MetricsException("No MetricsProvider with name: " + name);
		}
	}
434542
def _get_stats_from_socket(self, name):
        
        try:
            json_blob = subprocess.check_output(
                [self.config['ceph_binary'],
                 '--admin-daemon',
                 name,
                 'perf',
                 'dump',
                 ])
        except subprocess.CalledProcessError as err:
            self.log.info('Could not get stats from %s: %s',
                          name, err)
            self.log.exception('Could not get stats from %s' % name)
            return {}

        try:
            json_data = json.loads(json_blob)
        except Exception as err:
            self.log.info('Could not parse stats from %s: %s',
                          name, err)
            self.log.exception('Could not parse stats from %s' % name)
            return {}

        return json_data
882632
protected final OnDemandStatsProducer getProducer(Class producerClass, String producerId, String category, String subsystem, boolean tracingSupported){
        OnDemandStatsProducer<T> producer = (OnDemandStatsProducer<T>) ProducerRegistryFactory.getProducerRegistryInstance().getProducer(producerId);

        if (producer == null) {
            producer = new OnDemandStatsProducer<T>(producerId, category, subsystem, getStatsFactory());
            producer.setTracingSupported(tracingSupported);
            ProducerRegistryFactory.getProducerRegistryInstance().registerProducer(producer);

            //check for annotations
            createClassLevelAccumulators(producer, producerClass);

            for (Method method : producerClass.getMethods()){
                createMethodLevelAccumulators(producer, method);
            }
        }

        try {
            return  (OnDemandStatsProducer) ProducerRegistryFactory.getProducerRegistryInstance().getProducer(producerId);
        } catch (ClassCastException e) {
            LOGGER.error("getProducer(): Unexpected producer type", e);
            return null;
        }
    }