use of com.palantir.atlasdb.util.MetricsManager in project atlasdb by palantir.
the class CassandraServiceTest method clientPoolWithParams.
private CassandraService clientPoolWithParams(ImmutableSet<InetSocketAddress> servers, ImmutableSet<InetSocketAddress> serversInPool, double weighting) {
config = ImmutableCassandraKeyValueServiceConfig.builder().replicationFactor(3).credentials(ImmutableCassandraCredentialsConfig.builder().username("username").password("password").build()).servers(ImmutableDefaultConfig.builder().addAllThriftHosts(servers).build()).localHostWeighting(weighting).consecutiveAbsencesBeforePoolRemoval(1).build();
blacklist = new Blacklist(config);
MetricsManager metricsManager = MetricsManagers.createForTests();
CassandraService service = new CassandraService(metricsManager, config, blacklist, new CassandraClientPoolMetrics(metricsManager));
service.cacheInitialCassandraHosts();
serversInPool.forEach(service::addPool);
return service;
}
use of com.palantir.atlasdb.util.MetricsManager in project atlasdb by palantir.
the class TransactionManagers method setUpMetricsAndGetMetricsManager.
private MetricsManager setUpMetricsAndGetMetricsManager() {
MetricRegistry internalAtlasDbMetrics = new MetricRegistry();
TaggedMetricRegistry internalTaggedAtlasDbMetrics = new DefaultTaggedMetricRegistry();
MetricsManager metricsManager = MetricsManagers.of(internalAtlasDbMetrics, internalTaggedAtlasDbMetrics, runtimeConfig().map(runtimeConfigRefreshable -> runtimeConfigRefreshable.map(maybeRuntime -> maybeRuntime.map(AtlasDbRuntimeConfig::enableMetricFiltering).orElse(true))).orElseGet(() -> Refreshable.only(true)));
globalTaggedMetricRegistry().addMetrics(AtlasDbMetricNames.LIBRARY_ORIGIN_TAG, AtlasDbMetricNames.LIBRARY_ORIGIN_VALUE, metricsManager.getPublishableMetrics());
return metricsManager;
}
use of com.palantir.atlasdb.util.MetricsManager in project atlasdb by palantir.
the class LockWatchManagerImpl method create.
public static LockWatchManagerInternal create(MetricsManager metricsManager, Set<Schema> schemas, LockWatchStarter lockWatchingService, LockWatchCachingConfig config) {
Set<LockWatchReference> referencesFromSchema = schemas.stream().map(Schema::getLockWatches).flatMap(Set::stream).collect(Collectors.toSet());
Set<TableReference> watchedTablesFromSchema = referencesFromSchema.stream().map(schema -> schema.accept(LockWatchReferencesVisitor.INSTANCE)).collect(Collectors.toSet());
CacheMetrics metrics = CacheMetrics.create(metricsManager);
LockWatchEventCache eventCache = LockWatchEventCacheImpl.create(metrics);
LockWatchValueScopingCache valueCache = LockWatchValueScopingCacheImpl.create(eventCache, metrics, config.cacheSize(), config.validationProbability(), watchedTablesFromSchema);
return new LockWatchManagerImpl(referencesFromSchema, eventCache, valueCache, lockWatchingService);
}
use of com.palantir.atlasdb.util.MetricsManager in project atlasdb by palantir.
the class MetadataCoordinationServiceMetricsTest method handlesMultitenancyCorrectly.
@Test
public void handlesMultitenancyCorrectly() {
CoordinationService<InternalSchemaMetadata> otherService = mock(CoordinationService.class);
MetricsManager otherManager = MetricsManagers.createForTests();
TimestampService otherTimestampService = mock(TimestampService.class);
MetadataCoordinationServiceMetrics.registerMetrics(otherManager, otherService, otherTimestampService);
when(otherService.getLastKnownLocalValue()).thenReturn(Optional.of(ValueAndBound.of(Optional.empty(), TIMESTAMP_2)));
assertThat(getGauge(metricsManager, AtlasDbMetricNames.COORDINATION_LAST_VALID_BOUND).getValue()).isEqualTo(TIMESTAMP_1);
assertThat(getGauge(otherManager, AtlasDbMetricNames.COORDINATION_LAST_VALID_BOUND).getValue()).isEqualTo(TIMESTAMP_2);
}
use of com.palantir.atlasdb.util.MetricsManager in project atlasdb by palantir.
the class CassandraServiceTest method clientPoolWithParams.
private CassandraService clientPoolWithParams(Set<CassandraServer> servers, Set<CassandraServer> serversInPool, double weighting) {
config = ImmutableCassandraKeyValueServiceConfig.builder().credentials(ImmutableCassandraCredentialsConfig.builder().username("username").password("password").build()).localHostWeighting(weighting).consecutiveAbsencesBeforePoolRemoval(1).keyspace("ks").build();
Refreshable<CassandraKeyValueServiceRuntimeConfig> runtimeConfig = Refreshable.only(ImmutableCassandraKeyValueServiceRuntimeConfig.builder().servers(ImmutableDefaultConfig.builder().addAllThriftHosts(servers.stream().map(CassandraServer::proxy).collect(Collectors.toSet())).build()).replicationFactor(3).build());
blacklist = new Blacklist(config, runtimeConfig.map(CassandraKeyValueServiceRuntimeConfig::unresponsiveHostBackoffTimeSeconds));
MetricsManager metricsManager = MetricsManagers.createForTests();
CassandraService service = new CassandraService(metricsManager, config, runtimeConfig, blacklist, new CassandraClientPoolMetrics(metricsManager));
service.cacheInitialCassandraHosts();
serversInPool.forEach(service::addPool);
return service;
}
Aggregations