本文整理汇总了Java中com.codahale.metrics.json.HealthCheckModule类的典型用法代码示例。如果您正苦于以下问题:Java HealthCheckModule类的具体用法?Java HealthCheckModule怎么用?Java HealthCheckModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HealthCheckModule类属于com.codahale.metrics.json包,在下文中一共展示了HealthCheckModule类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: POMObjectMapper
import com.codahale.metrics.json.HealthCheckModule; //导入依赖的package包/类
public POMObjectMapper(JsonFactory fact) {
super(fact);
this.registerModule(new TolerantHealthTimeModule());
this.registerModule(new MetricsModule(TimeUnit.SECONDS, TimeUnit.MILLISECONDS, false));
this.registerModule(new HealthCheckModule());
// this.registerModule(new ViewDefDefModule());
// the following config could be in its own Jackson Module ("VPRModule") if this list gets unwieldy or we want to
// externalize the VPR's JSON serialization configuration more or not have dependencies on 3rd party libs. No need right now, though.
this.setSerializationInclusion(JsonInclude.Include.NON_NULL);
this.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
this.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
this.addMixInAnnotations(VistaUserDetails.class, VistaUserDetailsJacksonAnnotations.class);
this.addMixInAnnotations(UserDetails.class, UserDetailsJacksonAnnotations.class);
this.addMixInAnnotations(GrantedAuthority.class, GrantedAuthorityJacksonAnnotations.class);
}
示例2: onActivate
import com.codahale.metrics.json.HealthCheckModule; //导入依赖的package包/类
@Override
public void onActivate( Application application )
throws ActivationException
{
application.plugin( JSON.class ).mapper()
.registerModule( new MetricsModule( SECONDS, MILLISECONDS, true ) )
.registerModule( new HealthCheckModule() );
MetricRegistry metrics = new MetricRegistry();
HealthCheckRegistry healthChecks = new HealthCheckRegistry();
registerMetrics( application, metrics );
registerMetricsReporters( application, metrics );
registerHealthChecks( application, healthChecks );
api = new Metrics( metrics, healthChecks );
}
示例3: init
import com.codahale.metrics.json.HealthCheckModule; //导入依赖的package包/类
@Override
public void init(ServletConfig servletConfig) throws ServletException {
super.init(servletConfig);
boolean disableAuthorization = Boolean.TRUE.toString().equalsIgnoreCase(servletConfig.getInitParameter(DISABLE_AUTHORIZATION_INIT_PARAM));
if (!disableAuthorization) {
String credentials = null;
String username = servletConfig.getInitParameter(USERNAME_INIT_PARAM);
String password = servletConfig.getInitParameter(PASSWORD_INIT_PARAM);
if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(password)) {
credentials = username.trim() + ":" + password.trim();
} else {
credentials = DEFAULT_CREDENTIALS;
}
this.encodedCredentials = BaseEncoding.base64().encode(credentials.getBytes());
}
this.objectMapper = new ObjectMapper()
.registerModule(new MetricsModule(TimeUnit.SECONDS, TimeUnit.MICROSECONDS, false))
.registerModule(new HealthCheckModule())
.setSerializationInclusion(JsonInclude.Include.NON_NULL)
.setTimeZone(TimeZone.getDefault())
.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"));
this.graphiteMetricFormatter = new GraphiteMetricFormatter(TimeUnit.SECONDS, TimeUnit.MICROSECONDS);
try {
this.threadDumpGenerator = new ThreadDump(ManagementFactory.getThreadMXBean());
} catch (NoClassDefFoundError ignore) {
}
ServletContext servletContext = servletConfig.getServletContext();
String servletSpecVersion = servletContext.getMajorVersion() + "." + servletContext.getMinorVersion();
this.serverInfo = ServerInfo.create(servletContext.getServerInfo(), servletSpecVersion);
}
示例4: AmqpReporter
import com.codahale.metrics.json.HealthCheckModule; //导入依赖的package包/类
private AmqpReporter(Builder builder) {
super(builder.registry, "amqp-reporter", builder.filter, builder.rateUnit, builder.durationUnit);
this.routingKey = builder.routingKey;
this.exchangeName = builder.exchangeName;
Assert.hasText(this.exchangeName, "exchangeName is null or empty");
this.exchangeFactory = builder.exchangeFactory;
this.messagePropertiesCallback = builder.messagePropertiesCallback;
this.connectionFactoryProvider = builder.connectionFactoryProvider;
Assert.notNull(this.connectionFactoryProvider, "connectionFactoryProvider can't be null");
objectMapper.registerModules(new HealthCheckModule(),
new MetricsModule(builder.rateUnit, builder.durationUnit, false /* if enable histogram data will be serialized */));
}
示例5: MetricsContent
import com.codahale.metrics.json.HealthCheckModule; //导入依赖的package包/类
public MetricsContent(String name, MetricRegistry metricsRegistry) {
super(name);
this.registry = metricsRegistry;
objectMapper = new ObjectMapper();
objectMapper.registerModule(new MetricsModule(TimeUnit.MINUTES, TimeUnit.SECONDS, true));
objectMapper.registerModule(new HealthCheckModule());
objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
}