001/* 002 * Copyright 2012-2018 the original author or authors. 003 * 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 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 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 */ 016 017package org.springframework.boot.actuate.autoconfigure.metrics.export.influx; 018 019import io.micrometer.influx.InfluxConsistency; 020 021import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.StepRegistryProperties; 022import org.springframework.boot.context.properties.ConfigurationProperties; 023 024/** 025 * {@link ConfigurationProperties} for configuring Influx metrics export. 026 * 027 * @author Jon Schneider 028 * @author Stephane Nicoll 029 * @since 2.0.0 030 */ 031@ConfigurationProperties(prefix = "management.metrics.export.influx") 032public class InfluxProperties extends StepRegistryProperties { 033 034 /** 035 * Tag that will be mapped to "host" when shipping metrics to Influx. 036 */ 037 private String db = "mydb"; 038 039 /** 040 * Write consistency for each point. 041 */ 042 private InfluxConsistency consistency = InfluxConsistency.ONE; 043 044 /** 045 * Login user of the Influx server. 046 */ 047 private String userName; 048 049 /** 050 * Login password of the Influx server. 051 */ 052 private String password; 053 054 /** 055 * Retention policy to use (Influx writes to the DEFAULT retention policy if one is 056 * not specified). 057 */ 058 private String retentionPolicy; 059 060 /** 061 * Time period for which Influx should retain data in the current database. For 062 * instance 7d, check the influx documentation for more details on the duration 063 * format. 064 */ 065 private String retentionDuration; 066 067 /** 068 * How many copies of the data are stored in the cluster. Must be 1 for a single node 069 * instance. 070 */ 071 private Integer retentionReplicationFactor; 072 073 /** 074 * Time range covered by a shard group. For instance 2w, check the influx 075 * documentation for more details on the duration format. 076 */ 077 private String retentionShardDuration; 078 079 /** 080 * URI of the Influx server. 081 */ 082 private String uri = "http://localhost:8086"; 083 084 /** 085 * Whether to enable GZIP compression of metrics batches published to Influx. 086 */ 087 private boolean compressed = true; 088 089 /** 090 * Whether to create the Influx database if it does not exist before attempting to 091 * publish metrics to it. 092 */ 093 private boolean autoCreateDb = true; 094 095 public String getDb() { 096 return this.db; 097 } 098 099 public void setDb(String db) { 100 this.db = db; 101 } 102 103 public InfluxConsistency getConsistency() { 104 return this.consistency; 105 } 106 107 public void setConsistency(InfluxConsistency consistency) { 108 this.consistency = consistency; 109 } 110 111 public String getUserName() { 112 return this.userName; 113 } 114 115 public void setUserName(String userName) { 116 this.userName = userName; 117 } 118 119 public String getPassword() { 120 return this.password; 121 } 122 123 public void setPassword(String password) { 124 this.password = password; 125 } 126 127 public String getRetentionPolicy() { 128 return this.retentionPolicy; 129 } 130 131 public void setRetentionPolicy(String retentionPolicy) { 132 this.retentionPolicy = retentionPolicy; 133 } 134 135 public String getRetentionDuration() { 136 return this.retentionDuration; 137 } 138 139 public void setRetentionDuration(String retentionDuration) { 140 this.retentionDuration = retentionDuration; 141 } 142 143 public Integer getRetentionReplicationFactor() { 144 return this.retentionReplicationFactor; 145 } 146 147 public void setRetentionReplicationFactor(Integer retentionReplicationFactor) { 148 this.retentionReplicationFactor = retentionReplicationFactor; 149 } 150 151 public String getRetentionShardDuration() { 152 return this.retentionShardDuration; 153 } 154 155 public void setRetentionShardDuration(String retentionShardDuration) { 156 this.retentionShardDuration = retentionShardDuration; 157 } 158 159 public String getUri() { 160 return this.uri; 161 } 162 163 public void setUri(String uri) { 164 this.uri = uri; 165 } 166 167 public boolean isCompressed() { 168 return this.compressed; 169 } 170 171 public void setCompressed(boolean compressed) { 172 this.compressed = compressed; 173 } 174 175 public boolean isAutoCreateDb() { 176 return this.autoCreateDb; 177 } 178 179 public void setAutoCreateDb(boolean autoCreateDb) { 180 this.autoCreateDb = autoCreateDb; 181 } 182 183}