本文整理汇总了Java中com.netflix.servo.tag.BasicTagList类的典型用法代码示例。如果您正苦于以下问题:Java BasicTagList类的具体用法?Java BasicTagList怎么用?Java BasicTagList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BasicTagList类属于com.netflix.servo.tag包,在下文中一共展示了BasicTagList类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: push
import com.netflix.servo.tag.BasicTagList; //导入依赖的package包/类
/**
* Immediately send metrics to the backend.
*
* @param rawMetrics Metrics to be sent. The names are sanitized,
* and rollup policies
* applied before sending them to the backend publish cluster.
*/
public void push(List<Metric> rawMetrics) {
List<Metric> metricsWithValidValues = ValidCharacters.toValidValues(filter(rawMetrics));
List<Metric> rolledUp = rollupPolicy.rollup(metricsWithValidValues);
LOGGER.debug("Scheduling push of {} metrics", rolledUp.size());
final UpdateTasks tasks = getUpdateTasks(BasicTagList.EMPTY,
identifyCountersForPush(rolledUp));
final int maxAttempts = 5;
int attempts = 0;
while (!pushQueue.offer(tasks) && ++attempts < maxAttempts) {
final UpdateTasks droppedTasks = pushQueue.remove();
LOGGER.warn("Removing old push task due to queue full. Dropping {} metrics.",
droppedTasks.numMetrics);
numMetricsDroppedQueueFull.increment(droppedTasks.numMetrics);
}
if (attempts >= maxAttempts) {
LOGGER.error("Unable to push update of {}", tasks);
numMetricsDroppedQueueFull.increment(tasks.numMetrics);
} else {
LOGGER.debug("Queued push of {}", tasks);
}
}
示例2: EVCacheNodeImpl
import com.netflix.servo.tag.BasicTagList; //导入依赖的package包/类
public EVCacheNodeImpl(SocketAddress sa, SocketChannel c, int bufSize, BlockingQueue<Operation> rq,
BlockingQueue<Operation> wq, BlockingQueue<Operation> iq,
long opQueueMaxBlockTimeMillis, boolean waitForAuth, long dt, long at, ConnectionFactory fa, String appName,
int id, ServerGroup serverGroup, long stTime) {
super(sa, c, bufSize, rq, wq, iq, Long.valueOf(opQueueMaxBlockTimeMillis), waitForAuth, dt, at, fa);
this.id = id;
this._appName = appName;
this._serverGroup = serverGroup;
setConnectTime(stTime);
this.readQ = rq;
this.inputQueue = iq;
this.sendMetrics = EVCacheConfig.getInstance().getDynamicBooleanProperty("EVCacheNodeImpl." + appName + ".sendMetrics", false);
this.tags = BasicTagList.of("ServerGroup", _serverGroup.getName(), "APP", appName, "Id", String.valueOf(id), EVCacheMetricsFactory.OWNER.getKey(), EVCacheMetricsFactory.OWNER.getValue());
this.hostName = ((InetSocketAddress) getSocketAddress()).getHostName();
this.metricPrefix = "EVCacheNode";
this.baseConfig = MonitorConfig.builder(metricPrefix).build();
baseTags = BasicTagList.concat(tags, BasicTagList.of("HOST", hostName));
setupMonitoring();
}
示例3: atlasObserver
import com.netflix.servo.tag.BasicTagList; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(AtlasMetricObserver.class)
public AtlasMetricObserver atlasObserver(Optional<Collection<AtlasTagProvider>> tagProviders, ServoAtlasConfig servoAtlasConfig) {
BasicTagList tags = (BasicTagList) BasicTagList.EMPTY;
if(tagProviders != null && tagProviders.isPresent()) {
for (AtlasTagProvider tagProvider : tagProviders.get()) {
for (Map.Entry<String, String> tag : tagProvider.defaultTags().entrySet()) {
if(tag.getValue() != null)
tags = tags.copy(tag.getKey(), tag.getValue());
}
}
}
return new AtlasMetricObserver(servoAtlasConfig, tags);
}
示例4: getCommonTags
import com.netflix.servo.tag.BasicTagList; //导入依赖的package包/类
private static TagList getCommonTags() {
final Map<String, String> tags = new HashMap<>();
final String cluster = System.getenv("NETFLIX_CLUSTER");
tags.put(CLUSTER, (cluster == null) ? UNKNOWN : cluster);
try {
tags.put(NODE, InetAddress.getLocalHost().getHostName());
} catch (UnknownHostException e) {
tags.put(NODE, UNKNOWN);
}
return BasicTagList.copyOf(tags);
}
示例5: getCounter
import com.netflix.servo.tag.BasicTagList; //导入依赖的package包/类
public static Counter getCounter(String name, String... tags) {
MonitorConfig.Builder cfgBuilder = MonitorConfig.builder(name);
if (tags.length > 0) {
cfgBuilder.withTags(BasicTagList.of(tags));
}
return getCounter(cfgBuilder.build());
}
示例6: getTimer
import com.netflix.servo.tag.BasicTagList; //导入依赖的package包/类
public static Timer getTimer(String name, String... tags) {
MonitorConfig.Builder cfgBuilder = MonitorConfig.builder(name);
if (tags.length > 0) {
cfgBuilder.withTags(BasicTagList.of(tags));
}
return getTimer(cfgBuilder.build());
}
示例7: testValueToRollingCount
import com.netflix.servo.tag.BasicTagList; //导入依赖的package包/类
@Test
void testValueToRollingCount() {
String exprStr = "name,DiscoveryStatus_.*(UP),:re,(,nf.asg,nf.node,),:by,1,:rolling-count,0,:gt,$nf.asg $nf.node,:legend";
ListValueExpression expr = TestUtils.getListExpression(exprStr);
Metric discovery = new Metric("DiscoveryStatus_FOO_UP", BasicTagList.of("a", "a-val", "b", "b-val1", "c", "c-val"), 0L, 1.0);
List<Metric> metrics = ImmutableList.of(discovery);
Map<List<String>, LabeledResult> actual = expr.apply(metrics);
Map<List<String>, LabeledResult> matches = trueValues(actual);
assertEquals(matches.size(), 1);
actual = expr.apply(metrics);
matches = trueValues(actual);
assertEquals(matches.size(), 1);
}
示例8: testMax0
import com.netflix.servo.tag.BasicTagList; //导入依赖的package包/类
@Test
void testMax0() {
String exprStr = "name,totalNumberOfPackages,:eq,:max,100000,:const,:lt,10,:rolling-count,5,:const,:gt,$(nf.node),:legend";
ListValueExpression expr = TestUtils.getListExpression(exprStr);
Metric discovery = new Metric("totalNumberOfPackages", BasicTagList.of("a", "a-val", "b", "b-val1", "c", "c-val"), 0L, 0.0);
List<Metric> metrics = ImmutableList.of(discovery);
for (int i = 0; i < 5; i++) {
assertEquals(trueValues(expr.apply(metrics)).size(), 0);
}
assertEquals(trueValues(expr.apply(metrics)).size(), 1);
}
示例9: equalsContractTest
import com.netflix.servo.tag.BasicTagList; //导入依赖的package包/类
@Test
public void equalsContractTest() {
TagList ts1 = BasicTagList.of("k1", "v1");
TagList ts2 = BasicTagList.of("k1", "v1", "k2", "v2");
EqualsVerifier
.forClass(ServoId.class)
.withPrefabValues(TagList.class, ts1, ts2)
.suppress(Warning.NULL_FIELDS)
.verify();
}
示例10: EVCacheClient
import com.netflix.servo.tag.BasicTagList; //导入依赖的package包/类
EVCacheClient(String appName, String zone, int id, EVCacheServerGroupConfig config,
List<InetSocketAddress> memcachedNodesInZone, int maxQueueSize, DynamicIntProperty maxReadQueueSize,
ChainedDynamicProperty.IntProperty readTimeout, ChainedDynamicProperty.IntProperty bulkReadTimeout,
DynamicIntProperty opQueueMaxBlockTime,
DynamicIntProperty operationTimeout, EVCacheClientPool pool) throws IOException {
this.memcachedNodesInZone = memcachedNodesInZone;
this.id = id;
this.appName = appName;
this.zone = zone;
this.config = config;
this.serverGroup = config.getServerGroup();
this.readTimeout = readTimeout;
this.bulkReadTimeout = bulkReadTimeout;
this.maxReadQueueSize = maxReadQueueSize;
this.operationTimeout = operationTimeout;
this.pool = pool;
this.connectionFactory = pool.getEVCacheClientPoolManager().getConnectionFactoryProvider().getConnectionFactory(appName, id, serverGroup, pool.getEVCacheClientPoolManager());
this.enableChunking = EVCacheConfig.getInstance().getChainedBooleanProperty(this.serverGroup.getName()+ ".chunk.data", appName + ".chunk.data", Boolean.FALSE, null);
this.chunkSize = EVCacheConfig.getInstance().getChainedIntProperty(this.serverGroup.getName() + ".chunk.size", appName + ".chunk.size", 1180, null);
this.writeBlock = EVCacheConfig.getInstance().getChainedIntProperty(appName + "." + this.serverGroup.getName() + ".write.block.duration", appName + ".write.block.duration", 25, null);
this.chunkingTranscoder = new ChunkTranscoder();
this.maxWriteQueueSize = maxQueueSize;
this.ignoreTouch = EVCacheConfig.getInstance().getChainedBooleanProperty(appName + "." + this.serverGroup.getName() + ".ignore.touch", appName + ".ignore.touch", false, null);
this.ignoreInactiveNodes = EVCacheConfig.getInstance().getDynamicBooleanProperty(appName + ".ignore.inactive.nodes", false);
this.evcacheMemcachedClient = new EVCacheMemcachedClient(connectionFactory, memcachedNodesInZone, readTimeout, appName, zone, id, serverGroup, this);
this.connectionObserver = new EVCacheConnectionObserver(appName, serverGroup, id);
this.evcacheMemcachedClient.addObserver(connectionObserver);
this.tags = BasicTagList.of("ServerGroup", serverGroup.getName(), "APP", appName, "Id", String.valueOf(id));
this.decodingTranscoder = new SerializingTranscoder(Integer.MAX_VALUE);
decodingTranscoder.setCompressionThreshold(Integer.MAX_VALUE);
}
示例11: createCommonTagListFromEnvironment
import com.netflix.servo.tag.BasicTagList; //导入依赖的package包/类
private TagList createCommonTagListFromEnvironment() {
return BasicTagList.copyOf(NetflixTagKey.tagsFromEnvironment());
}