PCF (Pivotal Cloud Foundry) Metrics Reference 源码及索引

本文提供了PCF (Pivotal Cloud Foundry) Metrics Reference的源码解析,涵盖domain、service、controller等领域。文章讨论了如何在不同组件中处理SSL验证,如在JMX中跳过SSL验证。还介绍了Spring框架和相关Java库的使用,如Jackson进行JSON转换。此外,详细阐述了PCF中email通知、通知规则、元数据、Bean管理和序列化等方面的内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

PCF Metrics Reference Guide

https://github.com/pivotalservices/foundation-metrics/blob/master/metrics/src/main/java/io/pivotal 文件中domain service controller.后者调用前者

注:第一次接触这些东西,仅仅是粗糙地做了一个索引,以下解释仅作参考
Jia Feiran
1. MetricsApplication.java

package io.pivotal;
/* 
1. Spring-boot is in https://github.com/spring-projects/spring-boot
2. Springframework-scheduling is in https://github.com/spring-projects/spring-framework/tree/master/spring-context/src/main/java/org/springframework/scheduling
*/
import org.springframework.boot.SpringApplication; 
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication
@EnableScheduling
public class MetricsApplication {
   

    public static void main(String[] args) {
        SpringApplication.run(MetricsApplication.class, args);
    }

}
  1. SpringConfiguration.java

    import javax.net.ssl.SSLContext;
    //Instances of this class represent a secure socket protocol implementation which acts as a factory for secure socket factories or SSLEngines.
    import javax.net.ssl.TrustManager;
    //This is the base interface for JSSE trust managers.
    import javax.net.ssl.X509TrustManager;
    //Instance of this interface manage which X509 certificates may be used to authenticate the remote side of a secure socket.
      //http://javadox.com/org.cloudfoundry/cloudfoundry-client-lib/1.0.4/org/cloudfoundry/client/lib/CloudFoundryClient.html
      import org.cloudfoundry.client.lib.CloudCredentials;
      import org.cloudfoundry.client.lib.CloudFoundryClient;
    
      import org.springframework.beans.factory.annotation.Value;
      import org.springframework.context.annotation.Bean;
      import org.springframework.context.annotation.Configuration;
      import org.springframework.context.annotation.Profile;
      import org.springframework.jmx.support.MBeanServerConnectionFactoryBean;
      //http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/jmx/support/MBeanServerConnectionFactoryBean.html
      import org.springframework.mail.javamail.JavaMailSender;
      import org.springframework.mail.javamail.JavaMailSenderImpl;

    定义一个配置类来对bean进行配置。Bean通常被定义在配置文件当中,Bean实例化由Spring的Ioc容器进行管理,Bean的实例可以通过Beanfactory进行访问。

    BeanFactory作用

    • 配置、创建、管理Bean对象
    • 维持Bean对象之间的依赖关系
    • 负责Bean对象的生命周期

domain: Adding email notifications and some basic notification rules

以下class里面,大都有对应各个参数的set和get函数。

  1. Application.java

    在这个java文件下,仅import java.io.Serializable;,用于序列化对象。保存内存中各种对象的状态。

  2. Attribute.java

    import org.apache.commons.lang3.builder.ToStringBuilder;, 该包可以在https://commons.apache.org/proper/commons-lang/javadocs/api-3.1/org/apache/commons/lang3/builder/package-summary.html 中找到。位于commons-lang包应该属于比较基础的操作。

    类Attribute中主要有namevalue两个属性。

  3. CloudUser.java

    类clouduser里,主要有metadataentity两个私有变量。metadata是Metadata(元数据,见下文),为描述数据属性的信息。entity是一个实体类。

  4. CustomJobMetric.java

    类CustomJobMetric里,有私有的jobDetail和customAttributes。jobDetail是JobDetail(见下文), 它定义了Job的实例,包含了Job相关的配置信息。customAttributes是一个ArrayList。

  5. Email.java Adding email notifications and some basic notification rules

  6. FixedAttribute.java

    具有以下变量,描述系统数据

    private String system_healthy;
    private String system_load_1m;
    private String system_swap_percent;
    private String system_swap_kb;
    private String system_cpu_user;
    private String system_disk_ephemeral_inode_percent;
    private String system_disk_ephemeral_percent;
    private String system_disk_system_percent;
    private String system_cpu_sys;
    private String system_disk_persistent_percent;
    private String system_mem_kb;
    private String system_cpu_wait;
    private String system_mem_percent;
    private String system_disk_system_inode_percent;
    private String system_disk_persistent_inode_percent;
  1. JobDetail.java

    该类包括depolyment(部署)、jobipind

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值