001/**
002 * Copyright (c) 2015-2022, Michael Yang 杨福海 (fuhai999@gmail.com).
003 * <p>
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 * <p>
008 * http://www.apache.org/licenses/LICENSE-2.0
009 * <p>
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package io.jboot.support.metric;
017
018import io.jboot.app.config.annotation.ConfigModel;
019import io.jboot.utils.StrUtil;
020
021@ConfigModel(prefix = "jboot.metric")
022public class JbootMetricConfig {
023
024    public static final String REPORTER_JMX = "jmx";
025    public static final String REPORTER_INFLUXDB = "influxdb";
026    public static final String REPORTER_GRAPHITE = "graphite";
027    public static final String REPORTER_ELASTICSEARCH = "elasticsearch";
028    public static final String REPORTER_GANGLIA = "ganglia";
029    public static final String REPORTER_CONSOLE = "console";
030    public static final String REPORTER_CSV = "csv";
031    public static final String REPORTER_SLF4J = "slf4j";
032    public static final String REPORTER_PROMETHEUS= "prometheus";
033
034    private boolean enable = false;
035
036    private String adminServletMapping;
037    private String reporter = REPORTER_CONSOLE;
038
039    //是否启用 jvm 监控
040    private boolean jvmMetricEnable = true;
041
042    //是否启用请求监控
043    private boolean requestMetricEnable = true;
044    private String requestMetricName = "jboot-http";
045
046
047    public boolean isEnable() {
048        return enable;
049    }
050
051    public void setEnable(boolean enable) {
052        this.enable = enable;
053    }
054
055    public String getAdminServletMapping() {
056        return adminServletMapping;
057    }
058
059    public void setAdminServletMapping(String adminServletMapping) {
060        this.adminServletMapping = adminServletMapping;
061    }
062
063    public String getReporter() {
064        return reporter;
065    }
066
067    public void setReporter(String reporter) {
068        this.reporter = reporter;
069    }
070
071    public boolean isJvmMetricEnable() {
072        return jvmMetricEnable;
073    }
074
075    public void setJvmMetricEnable(boolean jvmMetricEnable) {
076        this.jvmMetricEnable = jvmMetricEnable;
077    }
078
079    public boolean isRequestMetricEnable() {
080        return requestMetricEnable;
081    }
082
083    public void setRequestMetricEnable(boolean requestMetricEnable) {
084        this.requestMetricEnable = requestMetricEnable;
085    }
086
087    public String getRequestMetricName() {
088        return requestMetricName;
089    }
090
091    public void setRequestMetricName(String requestMetricName) {
092        this.requestMetricName = requestMetricName;
093    }
094
095    public boolean isConfigOk() {
096        return StrUtil.isNotBlank(reporter);
097    }
098}
099
100
101