当前位置: 首页>>代码示例>>Java>>正文


Java HealthCheckModule类代码示例

本文整理汇总了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);
    }
 
开发者ID:KRMAssociatesInc,项目名称:eHMP,代码行数:18,代码来源:POMObjectMapper.java

示例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 );
}
 
开发者ID:werval,项目名称:werval,代码行数:17,代码来源:MetricsPlugin.java

示例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);
}
 
开发者ID:centro,项目名称:monitoring-center,代码行数:38,代码来源:MonitoringCenterServlet.java

示例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 */));
}
 
开发者ID:codeabovelab,项目名称:haven-platform,代码行数:16,代码来源:AmqpReporter.java

示例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);
}
 
开发者ID:jenkinsci,项目名称:support-core-plugin,代码行数:9,代码来源:MetricsContent.java


注:本文中的com.codahale.metrics.json.HealthCheckModule类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。