Create StatsdConfig for StatsD Register.

@param conf the metric config from Pravega.
@return instance of StatsdConfig to be used by StatsD Register.
336457
public static StatsdConfig createStatsDConfig(MetricsConfig conf) {
        log.info("Configuring stats with statsD at {}:{}", conf.getStatsDHost(), conf.getStatsDPort());
        return new StatsdConfig() {
            @Override
            public Duration step() {
                return Duration.ofSeconds(conf.getOutputFrequencySeconds().getSeconds());
            }

            @Override
            public String prefix() {
                return conf.getMetricsPrefix();
            }

            @Override
            public String host() {
                return conf.getStatsDHost();
            }

            @Override
            public int port() {
                return conf.getStatsDPort();
            }

            @Override
            public StatsdFlavor flavor() {
                return StatsdFlavor.TELEGRAF;
            }

            @Override
            public String get(String key) {
                return null; // accept the rest of the defaults; see https://micrometer.io/docs/registry/statsD.
            }
        };
    }
1251298
function initConfig(conf) {
  const result = Object.assign({}, conf);
  if (conf.filename) {
    result.filepath = path.dirname(conf.filename);
  }
  return result;
}
777016
@VisibleForTesting
  static Metric createMetric(
      io.opencensus.metrics.export.MetricDescriptor metricDescriptor,
      List<LabelValue> labelValues,
      String domain,
      Map<LabelKey, LabelValue> constantLabels) {
    Metric.Builder builder = Metric.newBuilder();
    builder.setType(generateType(metricDescriptor.getName(), domain));
    Map<String, String> stringTagMap = Maps.newHashMap();
    List<LabelKey> labelKeys = metricDescriptor.getLabelKeys();
    for (int i = 0; i < labelValues.size(); i++) {
      String value = labelValues.get(i).getValue();
      if (value == null) {
        continue;
      }
      stringTagMap.put(labelKeys.get(i).getKey(), value);
    }
    for (Map.Entry<LabelKey, LabelValue> constantLabel : constantLabels.entrySet()) {
      String constantLabelKey = constantLabel.getKey().getKey();
      String constantLabelValue = constantLabel.getValue().getValue();
      constantLabelValue = constantLabelValue == null ? "" : constantLabelValue;
      stringTagMap.put(constantLabelKey, constantLabelValue);
    }
    builder.putAllLabels(stringTagMap);
    return builder.build();
  }
714602
@SuppressWarnings("deprecation")
  private static JobConf createJobConfForCopyByChunk(Configuration conf) {
    JobConf jobconf = new JobConf(conf, DistCp.class);
    jobconf.setJobName(NAME);

    // turn off speculative execution, because DFS doesn't handle
    // multiple writers to the same file.
    jobconf.setReduceSpeculativeExecution(false);

    jobconf.setMapOutputKeyClass(Text.class);
    jobconf.setMapOutputValueClass(IntWritable.class);
    jobconf.setOutputKeyClass(Text.class);
    jobconf.setOutputValueClass(Text.class);

    jobconf.setInputFormat(CopyByChunkInputFormat.class);
    jobconf.setMapperClass(CopyFilesByChunkMapper.class);
    jobconf.setReducerClass(CopyFilesByChunkReducer.class);
    
    // Prevent the reducer from starting until all maps are done.
    jobconf.setInt("mapred.job.rushreduce.reduce.threshold", 0);
    jobconf.setFloat("mapred.reduce.slowstart.completed.maps", 1.0f);
    
    return jobconf;
  }
714911
public static Configuration asyncConfigure(Configuration conf) {
    conf.set(HBASE_CLIENT_ASYNC_CONNECTION_IMPL, BIGTABLE_HBASE_CLIENT_ASYNC_CONNECTION_CLASS);
    conf.set(HBASE_CLIENT_ASYNC_REGISTRY_IMPL, BIGTABLE_HBASE_CLIENT_ASYNC_REGISTRY_CLASS);
    return conf;
  }
802927
public static Config buildConfig(TopologyDef topologyDef) {
        // merge contents of `config` into topology config
        Config conf = new Config();
        conf.putAll(topologyDef.getConfig());
        return conf;
    }
73837
public static function create($conf = null)
    {
        self::$defaultConf = new FakerinoConf();
        self::$defaultConf->loadConfiguration();
        if ($conf !== null) {
            $confArray = $conf;
            if (!is_array($conf)) {
                $confTypeFactory = new FileConfigurationLoaderFactory(
                    $conf
                );
                $confParser = $confTypeFactory->load();
                $confArray = $confParser->toArray();
            }
            $conf = $confArray;
        }
        self::$defaultConf = new FakerinoConf($conf);
        self::$defaultConf->loadConfiguration();

        return new FakeDataFactory(self::getDefaultHandler(), new DoctrineLayer(self::getDatabaseConfig()), new TwigTemplate());
    }
922881
@Override
    public Slf4jMetricReporter init(ConfigurationProperties configurationProperties, MetricRegistry metricRegistry) {
        metricLogReporterMillis = configurationProperties.getMetricLogReporterMillis();
        if (metricLogReporterMillis > 0) {
            this.slf4jReporter = Slf4jReporter
                    .forRegistry(metricRegistry)
                    .outputTo(LOGGER)
                    .build();
        }
        return this;
    }
1207252
static MetricDescriptor createMetricDescriptor(
      io.opencensus.metrics.export.MetricDescriptor metricDescriptor,
      String projectId,
      String domain,
      String displayNamePrefix,
      Map<LabelKey, LabelValue> constantLabels) {

    MetricDescriptor.Builder builder = MetricDescriptor.newBuilder();
    String type = generateType(metricDescriptor.getName(), domain);
    // Name format refers to
    // cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors/create
    builder.setName("projects/" + projectId + "/metricDescriptors/" + type);
    builder.setType(type);
    builder.setDescription(metricDescriptor.getDescription());
    builder.setDisplayName(createDisplayName(metricDescriptor.getName(), displayNamePrefix));
    for (LabelKey labelKey : metricDescriptor.getLabelKeys()) {
      builder.addLabels(createLabelDescriptor(labelKey));
    }
    for (LabelKey labelKey : constantLabels.keySet()) {
      builder.addLabels(createLabelDescriptor(labelKey));
    }

    builder.setUnit(metricDescriptor.getUnit());
    builder.setMetricKind(createMetricKind(metricDescriptor.getType()));
    builder.setValueType(createValueType(metricDescriptor.getType()));
    return builder.build();
  }
660926
@SuppressWarnings("unchecked")
  public static <T> T newInstance(Class<T> theClass, Configuration conf) {
    return newInstance(theClass, conf, true);
  }
1213736
public static ClientProtocol createNamenode(Configuration conf) throws IOException {
    return createNamenode(NameNode.getClientProtocolAddress(conf), conf);
  }
1042381
public static CmsGalleryConfigurationJSO parseConfiguration(String conf) {

        if (CmsStringUtil.isEmptyOrWhitespaceOnly(conf)) {
            conf = "{}";
        }
        return (CmsGalleryConfigurationJSO)CmsDomUtil.parseJSON(conf);
    }
931589
public static Writable newInstance(Class<? extends Writable> c,
      Configuration conf) {
    return newInstance(c, conf, true);
  }
360636
private static JobConf createJobConf(Configuration conf, boolean useFastCopy) {
    Class<? extends InputFormat> inputFormat =
      (useFastCopy) ? FastCopyInputFormat.class : CopyInputFormat.class;
    JobConf jobconf = new JobConf(conf, DistCp.class);
    jobconf.setJobName(NAME);

    // turn off speculative execution, because DFS doesn't handle
    // multiple writers to the same file.
    jobconf.setReduceSpeculativeExecution(false);
    jobconf.setMapOutputKeyClass(FilePairComparable.class);
    jobconf.setMapOutputValueClass(Text.class);
    jobconf.setOutputKeyClass(FilePairComparable.class);
    jobconf.setOutputValueClass(Text.class);

    jobconf.setInputFormat(inputFormat);
    jobconf.setMapperClass(CopyFilesTask.class);
    jobconf.setReducerClass(CopyFilesTask.class);
      
    // Prevent the reducer from starting until all maps are done.
    jobconf.setInt("mapred.job.rushreduce.reduce.threshold", 0);
    jobconf.setFloat("mapred.reduce.slowstart.completed.maps", 1.0f);
    
    return jobconf;
  }
50572
public static VatIdMapSharedConstants create() {
    if (vatIdMapConstants == null) { // NOPMD it's thread save!
      synchronized (VatIdMapConstants.class) {
        if (vatIdMapConstants == null) {
          vatIdMapConstants = GWT.create(VatIdMapConstants.class);
        }
      }
    }
    return vatIdMapConstants;
  }
260517
public static PmiModuleConfig getTranslatedStatsConfig(String statsType, Locale locale) {
        PmiModuleConfig aCfg = getConfig(locale, statsType);
        if (aCfg == null)
            aCfg = _getStatsConfig(statsType, true, locale);

        return aCfg;
    }
1307240
public RDD<Cells> createHDFSRDD(ExtractorConfig<Cells> config) {

        Serializable host = config.getValues().get(ExtractorConstants.HOST);
        Serializable port = config.getValues().get(ExtractorConstants.PORT);
        Serializable path = config.getValues().get(ExtractorConstants.FS_FILE_PATH);

        final TextFileDataTable textFileDataTable = UtilFS.createTextFileMetaDataFromConfig(config, this);

        String filePath = path.toString();
        if (config.getExtractorImplClassName().equals(ExtractorConstants.HDFS)) {
            filePath = ExtractorConstants.HDFS_PREFIX + host.toString() + ":" + port + path.toString();
        }

        return createRDDFromFilePath(filePath, textFileDataTable);
    }