Search in sources :

Example 16 with MetricsManager

use of com.palantir.atlasdb.util.MetricsManager in project atlasdb by palantir.

the class TransactionManagers method serializableInternal.

@SuppressWarnings("MethodLength")
private TransactionManager serializableInternal(@Output List<AutoCloseable> closeables) {
    MetricsManager metricsManager = setUpMetricsAndGetMetricsManager();
    AtlasDbRuntimeConfigRefreshable runtimeConfigRefreshable = initializeCloseable(() -> AtlasDbRuntimeConfigRefreshable.create(this), closeables);
    Refreshable<AtlasDbRuntimeConfig> runtime = runtimeConfigRefreshable.config();
    Optional<TimeLockFeedbackBackgroundTask> timeLockFeedbackBackgroundTask = getTimeLockFeedbackBackgroundTask(metricsManager, closeables, config(), runtime);
    FreshTimestampSupplierAdapter adapter = new FreshTimestampSupplierAdapter();
    KeyValueServiceConfig installConfig = config().keyValueService();
    ServiceDiscoveringAtlasSupplier atlasFactory = new ServiceDiscoveringAtlasSupplier(metricsManager, installConfig, runtime.map(AtlasDbRuntimeConfig::keyValueService), config().leader(), config().namespace(), Optional.empty(), config().initializeAsync(), adapter);
    DerivedSnapshotConfig derivedSnapshotConfig = atlasFactory.getDerivedSnapshotConfig();
    LockRequest.setDefaultLockTimeout(SimpleTimeDuration.of(config().getDefaultLockTimeoutSeconds(), TimeUnit.SECONDS));
    LockAndTimestampServiceFactory factory = lockAndTimestampServiceFactory().orElseGet(() -> new DefaultLockAndTimestampServiceFactory(metricsManager, config(), runtime, registrar(), () -> LockServiceImpl.create(lockServerOptions()), atlasFactory::getManagedTimestampService, atlasFactory.getTimestampStoreInvalidator(), userAgent(), lockDiagnosticComponents(), reloadingFactory(), timeLockFeedbackBackgroundTask, timelockRequestBatcherProviders(), schemas()));
    LockAndTimestampServices lockAndTimestampServices = factory.createLockAndTimestampServices();
    adapter.setTimestampService(lockAndTimestampServices.managedTimestampService());
    KvsProfilingLogger.setSlowLogThresholdMillis(config().getKvsSlowLogThresholdMillis());
    Refreshable<SweepConfig> sweepConfig = runtime.map(AtlasDbRuntimeConfig::sweep);
    KeyValueService keyValueService = initializeCloseable(() -> {
        KeyValueService kvs = atlasFactory.getKeyValueService();
        kvs = ProfilingKeyValueService.create(kvs);
        kvs = new SafeTableClearerKeyValueService(lockAndTimestampServices.timelock()::getImmutableTimestamp, kvs);
        // table.
        if (!targetedSweepIsFullyEnabled(config(), runtime)) {
            kvs = SweepStatsKeyValueService.create(kvs, new TimelockTimestampServiceAdapter(lockAndTimestampServices.timelock()), sweepConfig.map(SweepConfig::writeThreshold), sweepConfig.map(SweepConfig::writeSizeThreshold), () -> true);
        }
        kvs = TracingKeyValueService.create(kvs);
        kvs = AtlasDbMetrics.instrumentTimed(metricsManager.getRegistry(), KeyValueService.class, kvs, MetricRegistry.name(KeyValueService.class));
        return ValidatingQueryRewritingKeyValueService.create(kvs);
    }, closeables);
    if (config().targetedSweep().enableSweepQueueWrites()) {
        initializeCloseable(() -> OldestTargetedSweepTrackedTimestamp.createStarted(keyValueService, lockAndTimestampServices.timestamp(), PTExecutors.newSingleThreadScheduledExecutor(new NamedThreadFactory("OldestTargetedSweepTrackedTimestamp", true))), closeables);
    }
    TransactionManagersInitializer initializer = TransactionManagersInitializer.createInitialTables(keyValueService, schemas(), config().initializeAsync(), allSafeForLogging());
    TransactionComponents components = createTransactionComponents(closeables, metricsManager, lockAndTimestampServices, keyValueService, runtime);
    TransactionService transactionService = components.transactionService();
    ConflictDetectionManager conflictManager = ConflictDetectionManagers.create(keyValueService);
    SweepStrategyManager sweepStrategyManager = SweepStrategyManagers.createDefault(keyValueService);
    CleanupFollower follower = CleanupFollower.create(schemas());
    Cleaner cleaner = initializeCloseable(() -> new DefaultCleanerBuilder(keyValueService, lockAndTimestampServices.timelock(), ImmutableList.of(follower), transactionService, metricsManager).setBackgroundScrubAggressively(config().backgroundScrubAggressively()).setBackgroundScrubBatchSize(config().getBackgroundScrubBatchSize()).setBackgroundScrubFrequencyMillis(config().getBackgroundScrubFrequencyMillis()).setBackgroundScrubThreads(config().getBackgroundScrubThreads()).setPunchIntervalMillis(config().getPunchIntervalMillis()).setTransactionReadTimeout(config().getTransactionReadTimeoutMillis()).setInitializeAsync(config().initializeAsync()).buildCleaner(), closeables);
    MultiTableSweepQueueWriter targetedSweep = initializeCloseable(() -> uninitializedTargetedSweeper(metricsManager, config().targetedSweep(), follower, runtime.map(AtlasDbRuntimeConfig::targetedSweep)), closeables);
    Supplier<TransactionConfig> transactionConfigSupplier = runtime.map(AtlasDbRuntimeConfig::transaction).map(this::withConsolidatedGrabImmutableTsLockFlag);
    TimestampCache timestampCache = config().timestampCache().orElseGet(() -> new DefaultTimestampCache(metricsManager.getRegistry(), () -> runtime.get().getTimestampCacheSize()));
    ConflictTracer conflictTracer = lockDiagnosticComponents().map(LockDiagnosticComponents::clientLockDiagnosticCollector).<ConflictTracer>map(Function.identity()).orElse(ConflictTracer.NO_OP);
    Callback<TransactionManager> callbacks = new Callback.CallChain<>(timelockConsistencyCheckCallback(config(), runtime.get(), lockAndTimestampServices), targetedSweep.singleAttemptCallback(), asyncInitializationCallback(), createClearsTable());
    TransactionManager transactionManager = initializeCloseable(() -> SerializableTransactionManager.createInstrumented(metricsManager, keyValueService, lockAndTimestampServices.timelock(), lockAndTimestampServices.lockWatcher(), lockAndTimestampServices.managedTimestampService(), lockAndTimestampServices.lock(), transactionService, () -> AtlasDbConstraintCheckingMode.FULL_CONSTRAINT_CHECKING_THROWS_EXCEPTIONS, conflictManager, sweepStrategyManager, cleaner, () -> areTransactionManagerInitializationPrerequisitesSatisfied(initializer, lockAndTimestampServices), allowHiddenTableAccess(), derivedSnapshotConfig.concurrentGetRangesThreadPoolSize(), derivedSnapshotConfig.defaultGetRangesConcurrency(), config().initializeAsync(), timestampCache, targetedSweep, callbacks, validateLocksOnReads(), transactionConfigSupplier, conflictTracer, metricsFilterEvaluationContext(), installConfig.sharedResourcesConfig().map(SharedResourcesConfig::sharedGetRangesPoolSize)), closeables);
    transactionManager.registerClosingCallback(runtimeConfigRefreshable::close);
    timeLockFeedbackBackgroundTask.ifPresent(task -> transactionManager.registerClosingCallback(task::close));
    lockAndTimestampServices.resources().forEach(transactionManager::registerClosingCallback);
    transactionManager.registerClosingCallback(transactionService::close);
    components.schemaInstaller().ifPresent(installer -> transactionManager.registerClosingCallback(installer::close));
    transactionManager.registerClosingCallback(targetedSweep::close);
    initializeCloseable(() -> initializeSweepEndpointAndBackgroundProcess(metricsManager, config(), runtime, registrar(), keyValueService, transactionService, follower, transactionManager, runBackgroundSweepProcess()), closeables);
    initializeCloseable(initializeCompactBackgroundProcess(metricsManager, lockAndTimestampServices, keyValueService, transactionManager, runtime.map(AtlasDbRuntimeConfig::compact)), closeables);
    log.info("Successfully created, and now returning a transaction manager: this may not be fully initialised.");
    return transactionManager;
}
Also used : KeyValueServiceConfig(com.palantir.atlasdb.spi.KeyValueServiceConfig) SafeTableClearerKeyValueService(com.palantir.atlasdb.sweep.queue.clear.SafeTableClearerKeyValueService) SweepStatsKeyValueService(com.palantir.atlasdb.keyvalue.impl.SweepStatsKeyValueService) ValidatingQueryRewritingKeyValueService(com.palantir.atlasdb.keyvalue.impl.ValidatingQueryRewritingKeyValueService) ProfilingKeyValueService(com.palantir.atlasdb.keyvalue.impl.ProfilingKeyValueService) TracingKeyValueService(com.palantir.atlasdb.keyvalue.impl.TracingKeyValueService) KeyValueService(com.palantir.atlasdb.keyvalue.api.KeyValueService) TimelockTimestampServiceAdapter(com.palantir.atlasdb.transaction.impl.TimelockTimestampServiceAdapter) SweepConfig(com.palantir.atlasdb.config.SweepConfig) ConflictTracer(com.palantir.atlasdb.debug.ConflictTracer) DefaultCleanerBuilder(com.palantir.atlasdb.cleaner.DefaultCleanerBuilder) TimestampCache(com.palantir.atlasdb.cache.TimestampCache) DefaultTimestampCache(com.palantir.atlasdb.cache.DefaultTimestampCache) SharedResourcesConfig(com.palantir.atlasdb.spi.SharedResourcesConfig) CleanupFollower(com.palantir.atlasdb.cleaner.CleanupFollower) Cleaner(com.palantir.atlasdb.cleaner.api.Cleaner) SweepStrategyManager(com.palantir.atlasdb.transaction.impl.SweepStrategyManager) TransactionService(com.palantir.atlasdb.transaction.service.TransactionService) TimeLockFeedbackBackgroundTask(com.palantir.lock.client.metrics.TimeLockFeedbackBackgroundTask) NamedThreadFactory(com.palantir.common.concurrent.NamedThreadFactory) MultiTableSweepQueueWriter(com.palantir.atlasdb.sweep.queue.MultiTableSweepQueueWriter) LockDiagnosticComponents(com.palantir.atlasdb.debug.LockDiagnosticComponents) FreshTimestampSupplierAdapter(com.palantir.atlasdb.factory.timestamp.FreshTimestampSupplierAdapter) TransactionConfig(com.palantir.atlasdb.transaction.TransactionConfig) ImmutableTransactionConfig(com.palantir.atlasdb.transaction.ImmutableTransactionConfig) DerivedSnapshotConfig(com.palantir.atlasdb.spi.DerivedSnapshotConfig) MetricsManager(com.palantir.atlasdb.util.MetricsManager) SerializableTransactionManager(com.palantir.atlasdb.transaction.impl.SerializableTransactionManager) TransactionManager(com.palantir.atlasdb.transaction.api.TransactionManager) SafeTableClearerKeyValueService(com.palantir.atlasdb.sweep.queue.clear.SafeTableClearerKeyValueService) DefaultTimestampCache(com.palantir.atlasdb.cache.DefaultTimestampCache) ConflictDetectionManager(com.palantir.atlasdb.transaction.impl.ConflictDetectionManager) AtlasDbRuntimeConfig(com.palantir.atlasdb.config.AtlasDbRuntimeConfig)

Example 17 with MetricsManager

use of com.palantir.atlasdb.util.MetricsManager in project atlasdb by palantir.

the class FeedbackHandlerTest method publishesSizeMetricToMetricManager.

@Test
@SuppressWarnings("unchecked")
public void publishesSizeMetricToMetricManager() {
    MetricsManager metricsManager = MetricsManagers.createForTests();
    FeedbackHandler handler = new FeedbackHandler(metricsManager, () -> true);
    handler.handle(FEEDBACK);
    assertThat(metricsManager.getPublishableMetrics().getMetrics()).containsKey(METRIC_NAME).satisfies(map -> assertThat(((Gauge<Long>) map.get(METRIC_NAME)).getValue()).isEqualTo(1L));
}
Also used : MetricsManager(com.palantir.atlasdb.util.MetricsManager) Test(org.junit.Test)

Example 18 with MetricsManager

use of com.palantir.atlasdb.util.MetricsManager in project atlasdb by palantir.

the class InMemoryTimelockServices method before.

@Override
protected void before() throws IOException {
    PaxosInstallConfiguration paxos = PaxosInstallConfiguration.builder().dataDirectory(tryCreateSubFolder(tempFolder)).leaderMode(PaxosLeaderMode.SINGLE_LEADER).sqlitePersistence(ImmutableSqlitePaxosPersistenceConfiguration.builder().dataDirectory(tryCreateSubFolder(tempFolder, client)).build()).isNewService(false).build();
    ClusterInstallConfiguration cluster = ImmutableClusterInstallConfiguration.builder().enableNonstandardAndPossiblyDangerousTopology(true).build();
    TimeLockInstallConfiguration install = TimeLockInstallConfiguration.builder().paxos(paxos).cluster(cluster).build();
    ImmutableDefaultClusterConfiguration clusterConfig = ImmutableDefaultClusterConfiguration.builder().localServer("local").cluster(PartialServiceConfiguration.of(List.of("local"), Optional.empty())).build();
    TimeLockRuntimeConfiguration runtime = ImmutableTimeLockRuntimeConfiguration.builder().permittedBackupToken(BEARER_TOKEN).clusterSnapshot(clusterConfig).build();
    MetricsManager metricsManager = MetricsManagers.createForTests();
    timeLockAgent = TimeLockAgent.create(metricsManager, install, // This won't actually live reload.
    Refreshable.only(runtime), runtime.clusterSnapshot(), USER_AGENT, THREAD_POOL_SIZE, BLOCKING_TIMEOUT_MS, _unused -> {
    }, Optional.empty(), OrderableSlsVersion.valueOf("0.0.0"), ObjectMappers.newServerObjectMapper(), () -> System.exit(0));
    delegate = timeLockAgent.createInvalidatingTimeLockServices(client);
    createHelperServices(metricsManager);
    // Wait for leadership
    Awaitility.await().atMost(Duration.ofSeconds(30L)).pollInterval(Duration.ofMillis(50)).ignoreExceptions().until(() -> delegate.getTimestampService().getFreshTimestamp() > 0);
}
Also used : CommitTimestampGetter(com.palantir.lock.client.CommitTimestampGetter) ObjectMappers(com.palantir.conjure.java.serialization.ObjectMappers) TimeLockInstallConfiguration(com.palantir.timelock.config.TimeLockInstallConfiguration) ImmutableSqlitePaxosPersistenceConfiguration(com.palantir.timelock.config.ImmutableSqlitePaxosPersistenceConfiguration) TimeLockRuntimeConfiguration(com.palantir.timelock.config.TimeLockRuntimeConfiguration) RedirectRetryTargeter(com.palantir.atlasdb.http.RedirectRetryTargeter) NamespacedConjureTimelockServiceImpl(com.palantir.lock.client.NamespacedConjureTimelockServiceImpl) MetricsManager(com.palantir.atlasdb.util.MetricsManager) NamespacedTimelockRpcClient(com.palantir.lock.v2.NamespacedTimelockRpcClient) UserAgent(com.palantir.conjure.java.api.config.service.UserAgent) Duration(java.time.Duration) After(org.junit.After) ImmutableClusterInstallConfiguration(com.palantir.timelock.config.ImmutableClusterInstallConfiguration) AsyncTimelockService(com.palantir.atlasdb.timelock.AsyncTimelockService) TimestampService(com.palantir.timestamp.TimestampService) Refreshable(com.palantir.refreshable.Refreshable) ImmutableSet(com.google.common.collect.ImmutableSet) TimestampManagementService(com.palantir.timestamp.TimestampManagementService) ConjureTimelockResource(com.palantir.atlasdb.timelock.ConjureTimelockResource) OrderableSlsVersion(com.palantir.sls.versions.OrderableSlsVersion) TimeLockServices(com.palantir.atlasdb.timelock.TimeLockServices) TimeLockHelperServices(com.palantir.atlasdb.factory.TimeLockHelperServices) MetricsManagers(com.palantir.atlasdb.util.MetricsManagers) List(java.util.List) ExternalResource(org.junit.rules.ExternalResource) LockWatchCachingConfig(com.palantir.atlasdb.keyvalue.api.LockWatchCachingConfig) ClusterInstallConfiguration(com.palantir.timelock.config.ClusterInstallConfiguration) TransactionStarter(com.palantir.lock.client.TransactionStarter) PartialServiceConfiguration(com.palantir.conjure.java.api.config.service.PartialServiceConfiguration) Optional(java.util.Optional) Awaitility(org.awaitility.Awaitility) PaxosLeaderMode(com.palantir.timelock.config.PaxosInstallConfiguration.PaxosLeaderMode) ConjureTimelockService(com.palantir.atlasdb.timelock.api.ConjureTimelockService) RequestBatchersFactory(com.palantir.lock.client.RequestBatchersFactory) AsyncTimelockResource(com.palantir.atlasdb.timelock.AsyncTimelockResource) ImmutableTimeLockRuntimeConfiguration(com.palantir.timelock.config.ImmutableTimeLockRuntimeConfiguration) RemoteTimelockServiceAdapter(com.palantir.lock.client.RemoteTimelockServiceAdapter) BearerToken(com.palantir.tokens.auth.BearerToken) SafeRuntimeException(com.palantir.logsafe.exceptions.SafeRuntimeException) IOException(java.io.IOException) LockWatchManagerInternal(com.palantir.atlasdb.keyvalue.api.watch.LockWatchManagerInternal) TimelockService(com.palantir.lock.v2.TimelockService) File(java.io.File) LockService(com.palantir.lock.LockService) ImmutableDefaultClusterConfiguration(com.palantir.timelock.config.ImmutableDefaultClusterConfiguration) ManagedTimestampService(com.palantir.timestamp.ManagedTimestampService) LockLeaseService(com.palantir.lock.client.LockLeaseService) Closeable(java.io.Closeable) PaxosInstallConfiguration(com.palantir.timelock.config.PaxosInstallConfiguration) LegacyLeaderTimeGetter(com.palantir.lock.client.LegacyLeaderTimeGetter) TemporaryFolder(org.junit.rules.TemporaryFolder) TimeLockInstallConfiguration(com.palantir.timelock.config.TimeLockInstallConfiguration) ImmutableDefaultClusterConfiguration(com.palantir.timelock.config.ImmutableDefaultClusterConfiguration) MetricsManager(com.palantir.atlasdb.util.MetricsManager) ImmutableClusterInstallConfiguration(com.palantir.timelock.config.ImmutableClusterInstallConfiguration) ClusterInstallConfiguration(com.palantir.timelock.config.ClusterInstallConfiguration) TimeLockRuntimeConfiguration(com.palantir.timelock.config.TimeLockRuntimeConfiguration) ImmutableTimeLockRuntimeConfiguration(com.palantir.timelock.config.ImmutableTimeLockRuntimeConfiguration) PaxosInstallConfiguration(com.palantir.timelock.config.PaxosInstallConfiguration)

Example 19 with MetricsManager

use of com.palantir.atlasdb.util.MetricsManager in project atlasdb by palantir.

the class TableMigratorTest method testMigrationToDifferentKvs.

// Table/IndexDefinition syntax
@SuppressWarnings({ "checkstyle:Indentation", "checkstyle:RightCurly" })
@Test
public void testMigrationToDifferentKvs() throws TableMappingNotFoundException {
    final TableReference tableRef = TableReference.create(Namespace.DEFAULT_NAMESPACE, "table");
    final TableReference namespacedTableRef = TableReference.createFromFullyQualifiedName("namespace." + tableRef.getTableName());
    TableDefinition definition = new TableDefinition() {

        {
            rowName();
            rowComponent("r", ValueType.BLOB);
            columns();
            column("c", "c", ValueType.BLOB);
        }
    };
    keyValueService.createTable(tableRef, definition.toTableMetadata().persistToBytes());
    keyValueService.createTable(namespacedTableRef, definition.toTableMetadata().persistToBytes());
    keyValueService.putMetadataForTable(namespacedTableRef, definition.toTableMetadata().persistToBytes());
    final Cell theCell = Cell.create(PtBytes.toBytes("r1"), PtBytes.toBytes("c"));
    final byte[] theValue = PtBytes.toBytes("v1");
    txManager.runTaskWithRetry((TransactionTask<Void, RuntimeException>) txn -> {
        Map<Cell, byte[]> values = ImmutableMap.of(theCell, theValue);
        txn.put(tableRef, values);
        txn.put(namespacedTableRef, values);
        return null;
    });
    final InMemoryKeyValueService kvs2 = new InMemoryKeyValueService(false);
    final ConflictDetectionManager cdm2 = ConflictDetectionManagers.createWithNoConflictDetection();
    final SweepStrategyManager ssm2 = SweepStrategyManagers.completelyConservative();
    final MetricsManager metricsManager = MetricsManagers.createForTests();
    final TestTransactionManagerImpl txManager2 = new TestTransactionManagerImpl(metricsManager, kvs2, inMemoryTimeLockRule.get(), lockService, transactionService, cdm2, ssm2, DefaultTimestampCache.createForTests(), MultiTableSweepQueueWriter.NO_OP, MoreExecutors.newDirectExecutorService());
    kvs2.createTable(tableRef, definition.toTableMetadata().persistToBytes());
    kvs2.createTable(namespacedTableRef, definition.toTableMetadata().persistToBytes());
    TableReference checkpointTable = TableReference.create(Namespace.DEFAULT_NAMESPACE, "checkpoint");
    GeneralTaskCheckpointer checkpointer = new GeneralTaskCheckpointer(checkpointTable, kvs2, txManager2);
    for (final TableReference name : Lists.newArrayList(tableRef, namespacedTableRef)) {
        TransactionRangeMigrator rangeMigrator = new TransactionRangeMigratorBuilder().srcTable(name).readTxManager(txManager).txManager(txManager2).checkpointer(checkpointer).build();
        TableMigratorBuilder builder = new TableMigratorBuilder().srcTable(name).partitions(1).executor(PTExecutors.newSingleThreadExecutor()).checkpointer(checkpointer).rangeMigrator(rangeMigrator);
        TableMigrator migrator = builder.build();
        migrator.migrate();
    }
    checkpointer.deleteCheckpoints();
    final ConflictDetectionManager verifyCdm = ConflictDetectionManagers.createWithNoConflictDetection();
    final SweepStrategyManager verifySsm = SweepStrategyManagers.completelyConservative();
    final TestTransactionManagerImpl verifyTxManager = new TestTransactionManagerImpl(metricsManager, kvs2, inMemoryTimeLockRule.get(), lockService, transactionService, verifyCdm, verifySsm, DefaultTimestampCache.createForTests(), MultiTableSweepQueueWriter.NO_OP, MoreExecutors.newDirectExecutorService());
    final MutableLong count = new MutableLong();
    for (final TableReference name : Lists.newArrayList(tableRef, namespacedTableRef)) {
        verifyTxManager.runTaskReadOnly((TransactionTask<Void, RuntimeException>) txn -> {
            BatchingVisitable<RowResult<byte[]>> bv = txn.getRange(name, RangeRequest.all());
            bv.batchAccept(1000, AbortingVisitors.batching(new AbortingVisitor<RowResult<byte[]>, RuntimeException>() {

                @Override
                public boolean visit(RowResult<byte[]> item) throws RuntimeException {
                    Iterable<Map.Entry<Cell, byte[]>> cells = item.getCells();
                    Map.Entry<Cell, byte[]> entry = Iterables.getOnlyElement(cells);
                    assertThat(entry.getKey()).isEqualTo(theCell);
                    assertThat(entry.getValue()).isEqualTo(theValue);
                    count.increment();
                    return true;
                }
            }));
            return null;
        });
    }
    assertThat(count.longValue()).isEqualTo(2L);
}
Also used : ConflictDetectionManager(com.palantir.atlasdb.transaction.impl.ConflictDetectionManager) Iterables(com.google.common.collect.Iterables) MoreExecutors(com.google.common.util.concurrent.MoreExecutors) TableMappingNotFoundException(com.palantir.common.exception.TableMappingNotFoundException) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) SweepStrategyManager(com.palantir.atlasdb.transaction.impl.SweepStrategyManager) BatchingVisitable(com.palantir.common.base.BatchingVisitable) InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) AtlasDbTestCase(com.palantir.atlasdb.AtlasDbTestCase) PtBytes(com.palantir.atlasdb.encoding.PtBytes) Lists(com.google.common.collect.Lists) MetricsManager(com.palantir.atlasdb.util.MetricsManager) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) PTExecutors(com.palantir.common.concurrent.PTExecutors) MutableLong(org.apache.commons.lang3.mutable.MutableLong) Map(java.util.Map) TableReference(com.palantir.atlasdb.keyvalue.api.TableReference) AbortingVisitors(com.palantir.common.base.AbortingVisitors) ConflictDetectionManagers(com.palantir.atlasdb.transaction.impl.ConflictDetectionManagers) SweepStrategyManagers(com.palantir.atlasdb.transaction.impl.SweepStrategyManagers) Namespace(com.palantir.atlasdb.keyvalue.api.Namespace) ImmutableMap(com.google.common.collect.ImmutableMap) Cell(com.palantir.atlasdb.keyvalue.api.Cell) Test(org.junit.Test) TableDefinition(com.palantir.atlasdb.table.description.TableDefinition) RangeRequest(com.palantir.atlasdb.keyvalue.api.RangeRequest) RowResult(com.palantir.atlasdb.keyvalue.api.RowResult) MetricsManagers(com.palantir.atlasdb.util.MetricsManagers) ValueType(com.palantir.atlasdb.table.description.ValueType) TransactionTask(com.palantir.atlasdb.transaction.api.TransactionTask) TestTransactionManagerImpl(com.palantir.atlasdb.transaction.impl.TestTransactionManagerImpl) MultiTableSweepQueueWriter(com.palantir.atlasdb.sweep.queue.MultiTableSweepQueueWriter) DefaultTimestampCache(com.palantir.atlasdb.cache.DefaultTimestampCache) AbortingVisitor(com.palantir.common.base.AbortingVisitor) InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) BatchingVisitable(com.palantir.common.base.BatchingVisitable) TableReference(com.palantir.atlasdb.keyvalue.api.TableReference) TableDefinition(com.palantir.atlasdb.table.description.TableDefinition) Cell(com.palantir.atlasdb.keyvalue.api.Cell) SweepStrategyManager(com.palantir.atlasdb.transaction.impl.SweepStrategyManager) TestTransactionManagerImpl(com.palantir.atlasdb.transaction.impl.TestTransactionManagerImpl) RowResult(com.palantir.atlasdb.keyvalue.api.RowResult) MutableLong(org.apache.commons.lang3.mutable.MutableLong) MetricsManager(com.palantir.atlasdb.util.MetricsManager) ConflictDetectionManager(com.palantir.atlasdb.transaction.impl.ConflictDetectionManager) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) Test(org.junit.Test)

Example 20 with MetricsManager

use of com.palantir.atlasdb.util.MetricsManager in project atlasdb by palantir.

the class CassandraKeyValueServiceImpl method createForTesting.

public static CassandraKeyValueService createForTesting(CassandraKeyValueServiceConfig config, Refreshable<CassandraKeyValueServiceRuntimeConfig> runtimeConfig) {
    MetricsManager metricsManager = MetricsManagers.createForTests();
    CassandraClientPool clientPool = CassandraClientPoolImpl.createImplForTest(metricsManager, config, runtimeConfig, StartupChecks.RUN, new Blacklist(config, runtimeConfig.map(CassandraKeyValueServiceRuntimeConfig::unresponsiveHostBackoffTimeSeconds)));
    return createOrShutdownClientPool(metricsManager, config, runtimeConfig, clientPool, CassandraMutationTimestampProviders.legacyModeForTestsOnly(), LoggerFactory.getLogger(CassandraKeyValueService.class), AtlasDbConstants.DEFAULT_INITIALIZE_ASYNC);
}
Also used : CassandraKeyValueServiceRuntimeConfig(com.palantir.atlasdb.cassandra.CassandraKeyValueServiceRuntimeConfig) MetricsManager(com.palantir.atlasdb.util.MetricsManager)

Aggregations

MetricsManager (com.palantir.atlasdb.util.MetricsManager)24 Optional (java.util.Optional)9 UserAgent (com.palantir.conjure.java.api.config.service.UserAgent)8 List (java.util.List)7 Refreshable (com.palantir.refreshable.Refreshable)6 ImmutableSet (com.google.common.collect.ImmutableSet)5 TableReference (com.palantir.atlasdb.keyvalue.api.TableReference)5 MetricsManagers (com.palantir.atlasdb.util.MetricsManagers)5 ManagedTimestampService (com.palantir.timestamp.ManagedTimestampService)5 Set (java.util.Set)5 Test (org.junit.Test)5 AuxiliaryRemotingParameters (com.palantir.atlasdb.config.AuxiliaryRemotingParameters)4 ServerListConfig (com.palantir.atlasdb.config.ServerListConfig)4 MultiTableSweepQueueWriter (com.palantir.atlasdb.sweep.queue.MultiTableSweepQueueWriter)4 TransactionManager (com.palantir.atlasdb.transaction.api.TransactionManager)4 ConflictDetectionManager (com.palantir.atlasdb.transaction.impl.ConflictDetectionManager)4 SafeLogger (com.palantir.logsafe.logger.SafeLogger)4 SafeLoggerFactory (com.palantir.logsafe.logger.SafeLoggerFactory)4 Map (java.util.Map)4 Collectors (java.util.stream.Collectors)4