本文整理汇总了Java中org.coursera.metrics.datadog.transport.HttpTransport类的典型用法代码示例。如果您正苦于以下问题:Java HttpTransport类的具体用法?Java HttpTransport怎么用?Java HttpTransport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HttpTransport类属于org.coursera.metrics.datadog.transport包,在下文中一共展示了HttpTransport类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: enableDatadogMetrics
import org.coursera.metrics.datadog.transport.HttpTransport; //导入依赖的package包/类
private DatadogReporter enableDatadogMetrics(MetricRegistry registry) {
log.info("Initializing Datadog reporter on host: {} with period: {} seconds",
getHost() == null ? "localhost" : getHost(), getPeriod());
Transport transport = getApiKey() == null ?
new UdpTransport.Builder().build() : new HttpTransport.Builder().withApiKey(getApiKey()).build();
DatadogReporter reporter = DatadogReporter.forRegistry(registry)
.withHost(getHost())
.withTransport(transport)
.withExpansions(expansions())
.withTags(getTags())
.withPrefix(getPrefix())
.filter(getFilter())
.withMetricNameFormatter(new CustomMetricNameFormatter())
.build();
reporter.start(getPeriod(), TimeUnit.SECONDS);
log.info("Datadog reporter successfully initialized");
return reporter;
}
开发者ID:quanticc,项目名称:sentry,代码行数:19,代码来源:DatadogConfiguration.java
示例2: configureReporters
import org.coursera.metrics.datadog.transport.HttpTransport; //导入依赖的package包/类
@Override
public void configureReporters(MetricRegistry metricRegistry) {
if (Objects.isNull(apiKey)) {
log.error("The 'datadog.apikey' is null. Datadog reporting will be ignored.");
return;
}
HttpTransport httpTransport = new HttpTransport.Builder().withApiKey(apiKey)
.build();
EnumSet<DatadogReporter.Expansion> expansions = DatadogReporter.Expansion.ALL;
DatadogReporter.Builder builder = DatadogReporter.forRegistry(metricRegistry)
.withTransport(httpTransport)
.withExpansions(expansions)
.withTags(tags);
DatadogReporter reporter = (Objects.nonNull(host) ? builder.withHost(host) : builder).build();
reporter.start(period, timeUnit);
registerReporter(reporter);
}
开发者ID:aol,项目名称:micro-server,代码行数:19,代码来源:DatadogMetricsConfigurer.java
示例3: setupMetrics
import org.coursera.metrics.datadog.transport.HttpTransport; //导入依赖的package包/类
@BeforeClass
public static void setupMetrics() {
EnumSet<DatadogReporter.Expansion> expansions = EnumSet.of(COUNT, RATE_1_MINUTE, RATE_15_MINUTE, MEDIAN, MEAN,
P95, P99);
HttpTransport httpTransport = new HttpTransport.Builder().withApiKey(System.getProperty("datadog.key"))
.build();
DatadogReporter.Builder builder = DatadogReporter.forRegistry(metricsRegistry)
.withTransport(httpTransport)
.withExpansions(expansions)
.withTags(Arrays.asList("stage:dev"));
DatadogReporter reporter = builder.build();
int reportPeriod = 5;
TimeUnit reportUnit = TimeUnit.valueOf("SECONDS");
log.info("Reporting to datadog every {} {}", 5, reportUnit);
reporter.start(reportPeriod, reportUnit);
}
开发者ID:aol,项目名称:micro-server,代码行数:17,代码来源:S3UploadSystemTest.java
示例4: setupMetrics
import org.coursera.metrics.datadog.transport.HttpTransport; //导入依赖的package包/类
@BeforeClass
public static void setupMetrics() {
EnumSet<DatadogReporter.Expansion> expansions = EnumSet.of(COUNT, RATE_1_MINUTE, RATE_15_MINUTE, MEDIAN, MEAN,
P95, P99);
HttpTransport httpTransport = new HttpTransport.Builder().withApiKey(System.getProperty("datadog.key"))
.build();
DatadogReporter.Builder builder = DatadogReporter.forRegistry(metricsRegistry)
.withTransport(httpTransport)
.withExpansions(expansions)
.withTags(Arrays.asList("stage:dev"));
DatadogReporter reporter = builder.build();
int reportPeriod = 5;
TimeUnit reportUnit = TimeUnit.valueOf("SECONDS");
log.info("Reporting to datadog every {} {}", reportPeriod, reportUnit);
reporter.start(reportPeriod, reportUnit);
}
开发者ID:aol,项目名称:micro-server,代码行数:17,代码来源:S3DownloadSystemTest.java
示例5: startDatadogReporter
import org.coursera.metrics.datadog.transport.HttpTransport; //导入依赖的package包/类
public void startDatadogReporter(MetricRegistry usher, String datadogApiKey) {
EnumSet<DatadogReporter.Expansion> expansions = EnumSet.of(COUNT, RATE_1_MINUTE, RATE_15_MINUTE, MEDIAN, P95, P99);
HttpTransport httpTransport = new HttpTransport.Builder().withApiKey(datadogApiKey).build();
DatadogReporter reporter;
try {
reporter = DatadogReporter.forRegistry(usher)
.withEC2Host()
.withTransport(httpTransport)
.withExpansions(expansions)
.build();
reporter.start(10, TimeUnit.SECONDS);
logger.info("Datadog reporting started.");
} catch (IOException e) {
logger.error("Could not configure data dog reporter. Right now datadog integration only works with EC2");
}
}
开发者ID:wired-mind,项目名称:usher,代码行数:17,代码来源:Start.java
示例6: get
import org.coursera.metrics.datadog.transport.HttpTransport; //导入依赖的package包/类
@Override
public Transport get() {
switch (configuration.getTransport()) {
case HTTP: {
final HostAndPort proxy = configuration.getHttpProxy();
final Duration connectTimeout = configuration.getHttpConnectTimeout();
final Duration socketTimeout = configuration.getHttpSocketTimeout();
final HttpTransport.Builder builder = new HttpTransport.Builder()
.withApiKey(configuration.getApiKey())
.withConnectTimeout(Ints.saturatedCast(connectTimeout.toMilliseconds()))
.withSocketTimeout(Ints.saturatedCast(socketTimeout.toMilliseconds()));
if (proxy != null) {
builder.withProxy(proxy.getHostText(), proxy.getPortOrDefault(8080));
}
return builder.build();
}
case UDP: {
final HostAndPort udpAddress = configuration.getUdpAddress();
return new UdpTransport.Builder()
.withStatsdHost(udpAddress.getHostText())
.withPort(udpAddress.getPortOrDefault(8125))
.withPrefix(configuration.getUdpPrefix())
.build();
}
default:
throw new IllegalArgumentException("Unknown Datadog transport \"" + configuration.getTransport() + "\"");
}
}
开发者ID:graylog-labs,项目名称:graylog-plugin-metrics-reporter,代码行数:29,代码来源:TransportProvider.java
示例7: getReturnsGraphite
import org.coursera.metrics.datadog.transport.HttpTransport; //导入依赖的package包/类
@Test
public void getReturnsGraphite() throws Exception {
final MetricsDatadogReporterConfiguration configuration = new MetricsDatadogReporterConfiguration() {
@Override
public DatadogTransport getTransport() {
return DatadogTransport.HTTP;
}
};
final TransportProvider provider = new TransportProvider(configuration);
final Transport transport = provider.get();
assertTrue(transport instanceof HttpTransport);
}
开发者ID:graylog-labs,项目名称:graylog-plugin-metrics-reporter,代码行数:14,代码来源:TransportProviderTest.java
示例8: datadogReporter
import org.coursera.metrics.datadog.transport.HttpTransport; //导入依赖的package包/类
@Bean
public DatadogReporter datadogReporter(MetricRegistry registry) throws IOException {
EnumSet<Expansion> expansions = EnumSet.of(Expansion.COUNT,
Expansion.RATE_1_MINUTE, Expansion.RATE_15_MINUTE, Expansion.MEDIAN,
Expansion.P95, Expansion.P99);
HttpTransport httpTransport = new HttpTransport.Builder().withApiKey(this.apiKey)
.build();
DatadogReporter reporter = DatadogReporter.forRegistry(registry)
.withHost("livelessons").withTransport(httpTransport)
.withExpansions(expansions).build();
reporter.start(10, TimeUnit.SECONDS);
return reporter;
}
开发者ID:livelessons-spring,项目名称:building-microservices,代码行数:14,代码来源:OperationsCloudMetricsApplication.java
示例9: datadogReporter
import org.coursera.metrics.datadog.transport.HttpTransport; //导入依赖的package包/类
@Bean
@Autowired
public DatadogReporter datadogReporter(MetricRegistry registry) {
if(LOGGER.isInfoEnabled()) {
LOGGER.info("Initializing Datadog reporter using [ host: {}, period(seconds):{}, api-key:{} ]", getHost(), getPeriod(), getApiKey());
}
EnumSet<Expansion> expansions = DatadogReporter.Expansion.ALL;
HttpTransport httpTransport = new HttpTransport
.Builder()
.withApiKey(getApiKey())
.build();
DatadogReporter reporter = DatadogReporter.forRegistry(registry)
.withHost(getHost())
.withTransport(httpTransport)
.withExpansions(expansions)
.build();
reporter.start(getPeriod(), TimeUnit.SECONDS);
if(LOGGER.isInfoEnabled()) {
LOGGER.info("Datadog reporter successfully initialized");
}
return reporter;
}
开发者ID:jfcorugedo,项目名称:RJavaServer,代码行数:29,代码来源:DatadogReporterConfig.java
示例10: httpTransport
import org.coursera.metrics.datadog.transport.HttpTransport; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(HttpTransport.class)
public HttpTransport httpTransport() {
return new HttpTransport.Builder().withApiKey(properties.getApiKey()).build();
}
开发者ID:spring-cloud,项目名称:spring-cloud-dataflow-metrics-datadog,代码行数:6,代码来源:DatadogAutoConfiguration.java
示例11: datadogMetricWriter
import org.coursera.metrics.datadog.transport.HttpTransport; //导入依赖的package包/类
@Bean
@ExportMetricWriter
public DatadogMetricWriter datadogMetricWriter(HttpTransport httpTransport,
MetricsPrefixResolver metricsPrefixResolver) {
return new DatadogMetricWriter(httpTransport, metricsPrefixResolver);
}
开发者ID:spring-cloud,项目名称:spring-cloud-dataflow-metrics-datadog,代码行数:7,代码来源:DatadogAutoConfiguration.java
示例12: DatadogMetricWriter
import org.coursera.metrics.datadog.transport.HttpTransport; //导入依赖的package包/类
public DatadogMetricWriter(HttpTransport transport,
MetricsPrefixResolver metricsPrefixResolver) {
this.transport = transport;
this.prefix = metricsPrefixResolver.getResolvedPrefix();
}
开发者ID:spring-cloud,项目名称:spring-cloud-dataflow-metrics-datadog,代码行数:6,代码来源:DatadogMetricWriter.java
注:本文中的org.coursera.metrics.datadog.transport.HttpTransport类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论