org.apache.bookkeeper.stats.StatsLogger Java Examples

The following examples show how to use org.apache.bookkeeper.stats.StatsLogger. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FileCommitLogManager.java    From herddb with Apache License 2.0 6 votes vote down vote up
public FileCommitLogManager(
        Path baseDirectory, long maxLogFileSize, int maxUnsynchedBatchSize,
        int maxUnsynchedBatchBytes,
        int maxSyncTime,
        boolean requireSync,
        boolean enableO_DIRECT,
        int deferredSyncPeriod,
        StatsLogger statsLogger
) {
    this.baseDirectory = baseDirectory;
    this.maxLogFileSize = maxLogFileSize;
    this.statsLogger = statsLogger;
    this.deferredSyncPeriod = deferredSyncPeriod;
    this.maxUnsynchedBatchSize = maxUnsynchedBatchSize;
    this.maxUnsynchedBatchBytes = maxUnsynchedBatchBytes;
    this.maxSyncTime = maxSyncTime;
    this.requireSync = requireSync;
    this.enableO_DIRECT = enableO_DIRECT && OpenFileUtils.isO_DIRECT_Supported();
    LOG.log(Level.INFO, "Txlog settings: fsync: " + requireSync + ", O_DIRECT: " + enableO_DIRECT + ", deferredSyncPeriod:" + deferredSyncPeriod);
}
 
Example #2
Source File: ZKDistributedLock.java    From distributedlog with Apache License 2.0 6 votes vote down vote up
public ZKDistributedLock(
        OrderedScheduler lockStateExecutor,
        SessionLockFactory lockFactory,
        String lockPath,
        long lockTimeout,
        StatsLogger statsLogger) {
    this.lockStateExecutor = lockStateExecutor;
    this.lockPath = lockPath;
    this.lockTimeout = lockTimeout;
    this.lockFactory = lockFactory;

    lockStatsLogger = statsLogger.scope("lock");
    acquireStats = lockStatsLogger.getOpStatsLogger("acquire");
    reacquireStats = lockStatsLogger.getOpStatsLogger("reacquire");
    internalTryRetries = lockStatsLogger.getCounter("internalTryRetries");
}
 
Example #3
Source File: BookKeeperClient.java    From distributedlog with Apache License 2.0 6 votes vote down vote up
BookKeeperClient(DistributedLogConfiguration conf,
                 String name,
                 String zkServers,
                 ZooKeeperClient zkc,
                 String ledgersPath,
                 ClientSocketChannelFactory channelFactory,
                 HashedWheelTimer requestTimer,
                 StatsLogger statsLogger,
                 Optional<FeatureProvider> featureProvider) {
    this.conf = conf;
    this.name = name;
    this.zkServers = zkServers;
    this.ledgersPath = ledgersPath;
    this.passwd = conf.getBKDigestPW().getBytes(UTF_8);
    this.channelFactory = channelFactory;
    this.requestTimer = requestTimer;
    this.statsLogger = statsLogger;
    this.featureProvider = featureProvider;
    this.ownZK = null == zkc;
    if (null != zkc) {
        // reference the passing zookeeper client
        this.zkc = zkc;
    }
}
 
Example #4
Source File: LimitedPermitManager.java    From distributedlog with Apache License 2.0 6 votes vote down vote up
public LimitedPermitManager(final int concurrency, int period, TimeUnit timeUnit,
        ScheduledExecutorService executorService, StatsLogger statsLogger) {
    if (concurrency > 0) {
        this.semaphore = new Semaphore(concurrency);
    } else {
        this.semaphore = null;
    }
    this.period = period;
    this.timeUnit = timeUnit;
    this.executorService = executorService;
    this.statsLogger = statsLogger;
    this.outstandingGauge = new Gauge<Number>() {
        @Override
        public Number getDefaultValue() {
            return 0;
        }

        @Override
        public Number getSample() {
            return null == semaphore ? 0 : concurrency - semaphore.availablePermits();
        }
    };
    this.statsLogger.scope("permits").registerGauge("outstanding", this.outstandingGauge);
}
 
Example #5
Source File: FileDataStorageManager.java    From herddb with Apache License 2.0 6 votes vote down vote up
public FileDataStorageManager(
        Path baseDirectory, Path tmpDirectory, int swapThreshold,
        boolean requirefsync, boolean pageodirect, boolean indexodirect,
        boolean hashChecksEnabled, boolean hashWritesEnabled, StatsLogger logger
) {
    this.baseDirectory = baseDirectory;
    this.tmpDirectory = tmpDirectory;
    this.swapThreshold = swapThreshold;
    this.logger = logger;
    this.requirefsync = requirefsync;
    this.pageodirect = pageodirect && OpenFileUtils.isO_DIRECT_Supported();
    this.indexodirect = indexodirect && OpenFileUtils.isO_DIRECT_Supported();
    this.hashChecksEnabled = hashChecksEnabled;
    this.hashWritesEnabled = hashWritesEnabled;
    StatsLogger scope = logger.scope("filedatastore");
    this.dataPageReads = scope.getOpStatsLogger("data_pagereads");
    this.dataPageWrites = scope.getOpStatsLogger("data_pagewrites");
    this.indexPageReads = scope.getOpStatsLogger("index_pagereads");
    this.indexPageWrites = scope.getOpStatsLogger("index_pagewrites");
}
 
Example #6
Source File: WorkerHandler.java    From openmessaging-benchmark with Apache License 2.0 6 votes vote down vote up
public WorkerHandler(Javalin app, StatsLogger statsLogger) {
    this.localWorker = new LocalWorker(statsLogger);

    app.post("/initialize-driver", this::handleInitializeDriver);
    app.post("/create-topics", this::handleCreateTopics);
    app.post("/create-producers", this::handleCreateProducers);
    app.post("/probe-producers", this::handleProbeProducers);
    app.post("/create-consumers", this::handleCreateConsumers);
    app.post("/pause-consumers", this::handlePauseConsumers);
    app.post("/resume-consumers", this::handleResumeConsumers);
    app.post("/start-load", this::handleStartLoad);
    app.post("/adjust-publish-rate", this::handleAdjustPublishRate);
    app.post("/stop-all", this::handleStopAll);
    app.get("/period-stats", this::handlePeriodStats);
    app.get("/cumulative-latencies", this::handleCumulativeLatencies);
    app.get("/counters-stats", this::handleCountersStats);
    app.post("/reset-stats", this::handleResetStats);
}
 
Example #7
Source File: BookKeeperClientFactoryImpl.java    From pulsar with Apache License 2.0 6 votes vote down vote up
@Override
public BookKeeper create(ServiceConfiguration conf, ZooKeeper zkClient,
                         Optional<Class<? extends EnsemblePlacementPolicy>> ensemblePlacementPolicyClass,
                         Map<String, Object> properties, StatsLogger statsLogger) throws IOException {
    ClientConfiguration bkConf = createBkClientConfiguration(conf);
    if (properties != null) {
        properties.forEach((key, value) -> bkConf.setProperty(key, value));
    }
    if (ensemblePlacementPolicyClass.isPresent()) {
        setEnsemblePlacementPolicy(bkConf, conf, zkClient, ensemblePlacementPolicyClass.get());
    } else {
        setDefaultEnsemblePlacementPolicy(rackawarePolicyZkCache, clientIsolationZkCache, bkConf, conf, zkClient);
    }
    try {
        return BookKeeper.forConfig(bkConf)
                .allocator(PulsarByteBufAllocator.DEFAULT)
                .statsLogger(statsLogger)
                .build();
    } catch (InterruptedException | BKException e) {
        throw new IOException(e);
    }
}
 
Example #8
Source File: BKAsyncLogWriter.java    From distributedlog with Apache License 2.0 6 votes vote down vote up
BKAsyncLogWriter(DistributedLogConfiguration conf,
                 DynamicDistributedLogConfiguration dynConf,
                 BKDistributedLogManager bkdlm,
                 BKLogWriteHandler writeHandler, /** log writer owns the handler **/
                 FeatureProvider featureProvider,
                 StatsLogger dlmStatsLogger) {
    super(conf, dynConf, bkdlm);
    this.writeHandler = writeHandler;
    this.streamFailFast = conf.getFailFastOnStreamNotReady();
    this.disableRollOnSegmentError = conf.getDisableRollingOnLogSegmentError();

    // features
    disableLogSegmentRollingFeature = featureProvider
            .getFeature(CoreFeatureKeys.DISABLE_LOGSEGMENT_ROLLING.name().toLowerCase());
    // stats
    this.statsLogger = dlmStatsLogger.scope("log_writer");
    this.writeOpStatsLogger = statsLogger.getOpStatsLogger("write");
    this.markEndOfStreamOpStatsLogger = statsLogger.getOpStatsLogger("mark_end_of_stream");
    this.bulkWriteOpStatsLogger = statsLogger.getOpStatsLogger("bulk_write");
    this.getWriterOpStatsLogger = statsLogger.getOpStatsLogger("get_writer");
    this.pendingRequestDispatch = statsLogger.getCounter("pending_request_dispatch");
}
 
Example #9
Source File: ZKSessionLockFactory.java    From distributedlog with Apache License 2.0 6 votes vote down vote up
public ZKSessionLockFactory(ZooKeeperClient zkc,
                            String clientId,
                            OrderedScheduler lockStateExecutor,
                            int lockCreationRetries,
                            long lockOpTimeout,
                            long zkRetryBackoffMs,
                            StatsLogger statsLogger) {
    this.zkc = zkc;
    this.clientId = clientId;
    this.lockStateExecutor = lockStateExecutor;
    this.lockCreationRetries = lockCreationRetries;
    this.lockOpTimeout = lockOpTimeout;
    this.zkRetryBackoffMs = zkRetryBackoffMs;

    this.lockStatsLogger = statsLogger.scope("lock");
}
 
Example #10
Source File: SimplePermitLimiter.java    From distributedlog with Apache License 2.0 6 votes vote down vote up
public SimplePermitLimiter(boolean darkmode, int permitsMax, StatsLogger statsLogger,
                           boolean singleton, Feature disableWriteLimitFeature) {
    this.permits = new AtomicInteger(0);
    this.permitsMax = permitsMax;
    this.darkmode = darkmode;
    this.disableWriteLimitFeature = disableWriteLimitFeature;

    // stats
    if (singleton) {
        this.statsLogger = statsLogger;
        this.permitsGauge = new Gauge<Number>() {
            @Override
            public Number getDefaultValue() {
                return 0;
            }
            @Override
            public Number getSample() {
                return permits.get();
            }
        };
        this.permitsGaugeLabel = "permits";
        statsLogger.registerGauge(permitsGaugeLabel, permitsGauge);
    }
    acquireFailureCounter = statsLogger.getCounter("acquireFailure");
    permitsMetric = statsLogger.getOpStatsLogger("permits");
}
 
Example #11
Source File: EnvelopedEntryReader.java    From distributedlog with Apache License 2.0 6 votes vote down vote up
EnvelopedEntryReader(long logSegmentSeqNo,
                     long entryId,
                     long startSequenceId,
                     ByteBuf in,
                     boolean envelopedEntry,
                     boolean deserializeRecordSet,
                     StatsLogger statsLogger)
        throws IOException {
    this.logSegmentSeqNo = logSegmentSeqNo;
    this.entryId = entryId;
    if (envelopedEntry) {
        this.src = EnvelopedEntry.fromEnvelopedBuf(in, statsLogger);
    } else {
        this.src = in;
    }
    this.reader = new LogRecord.Reader(
            this,
            src,
            startSequenceId,
            deserializeRecordSet);
}
 
Example #12
Source File: BKAsyncLogWriter.java    From distributedlog with Apache License 2.0 6 votes vote down vote up
BKAsyncLogWriter(DistributedLogConfiguration conf,
                 DynamicDistributedLogConfiguration dynConf,
                 BKDistributedLogManager bkdlm,
                 BKLogWriteHandler writeHandler, /** log writer owns the handler **/
                 FeatureProvider featureProvider,
                 StatsLogger dlmStatsLogger) {
    super(conf, dynConf, bkdlm);
    this.writeHandler = writeHandler;
    this.streamFailFast = conf.getFailFastOnStreamNotReady();
    this.disableRollOnSegmentError = conf.getDisableRollingOnLogSegmentError();

    // features
    disableLogSegmentRollingFeature = featureProvider.getFeature(CoreFeatureKeys.DISABLE_LOGSEGMENT_ROLLING.name().toLowerCase());
    // stats
    this.statsLogger = dlmStatsLogger.scope("log_writer");
    this.writeOpStatsLogger = statsLogger.getOpStatsLogger("write");
    this.markEndOfStreamOpStatsLogger = statsLogger.getOpStatsLogger("mark_end_of_stream");
    this.bulkWriteOpStatsLogger = statsLogger.getOpStatsLogger("bulk_write");
    this.getWriterOpStatsLogger = statsLogger.getOpStatsLogger("get_writer");
    this.pendingRequestDispatch = statsLogger.getCounter("pending_request_dispatch");
}
 
Example #13
Source File: DynamicRequestLimiter.java    From distributedlog with Apache License 2.0 6 votes vote down vote up
public DynamicRequestLimiter(DynamicDistributedLogConfiguration dynConf,
                             StatsLogger statsLogger,
                             Feature rateLimitDisabledFeature) {
    final StatsLogger limiterStatsLogger = statsLogger.scope("dynamic");
    this.dynConf = dynConf;
    this.rateLimitDisabledFeature = rateLimitDisabledFeature;
    this.listener = new ConfigurationListener() {
        @Override
        public void configurationChanged(ConfigurationEvent event) {
            // Note that this method may be called several times if several config options
            // are changed. The effect is harmless except that we create and discard more
            // objects than we need to.
            LOG.debug("Config changed callback invoked with event {} {} {} {}", new Object[] {
                    event.getPropertyName(), event.getPropertyValue(), event.getType(),
                    event.isBeforeUpdate()});
            if (!event.isBeforeUpdate()) {
                limiterStatsLogger.getCounter("config_changed").inc();
                LOG.debug("Rebuilding limiter");
                limiter = build();
            }
        }
    };
    LOG.debug("Registering config changed callback");
    dynConf.addConfigurationListener(listener);
}
 
Example #14
Source File: BKLogReadHandler.java    From distributedlog with Apache License 2.0 5 votes vote down vote up
/**
 * Construct a Bookkeeper journal manager.
 */
BKLogReadHandler(LogMetadataForReader logMetadata,
                 Optional<String> subscriberId,
                 DistributedLogConfiguration conf,
                 DynamicDistributedLogConfiguration dynConf,
                 LogStreamMetadataStore streamMetadataStore,
                 LogSegmentMetadataCache metadataCache,
                 LogSegmentEntryStore entryStore,
                 OrderedScheduler scheduler,
                 AlertStatsLogger alertStatsLogger,
                 StatsLogger statsLogger,
                 StatsLogger perLogStatsLogger,
                 String clientId,
                 AsyncNotification readerStateNotification,
                 boolean isHandleForReading) {
    super(logMetadata,
            conf,
            streamMetadataStore,
            metadataCache,
            entryStore,
            scheduler,
            statsLogger,
            alertStatsLogger,
            clientId);
    this.logMetadataForReader = logMetadata;
    this.dynConf = dynConf;
    this.perLogStatsLogger =
            isHandleForReading ? perLogStatsLogger : NullStatsLogger.INSTANCE;
    this.readerStateNotification = readerStateNotification;
    this.subscriberId = subscriberId;
}
 
Example #15
Source File: AbstractFeatureProvider.java    From distributedlog with Apache License 2.0 5 votes vote down vote up
protected AbstractFeatureProvider(String rootScope,
                                  DistributedLogConfiguration conf,
                                  StatsLogger statsLogger) {
    super(rootScope);
    this.conf = conf;
    this.statsLogger = statsLogger;
}
 
Example #16
Source File: ZKWatcherManager.java    From distributedlog with Apache License 2.0 5 votes vote down vote up
private ZKWatcherManager(String name,
                         ZooKeeperClient zkc,
                         StatsLogger statsLogger) {
    this.name = name;
    this.zkc = zkc;
    this.statsLogger = statsLogger;

    // watches
    this.childWatches = new ConcurrentHashMap<String, Set<Watcher>>();
    this.allWatchesGauge = new AtomicInteger(0);

    // stats
    totalWatchesGauge = new Gauge<Number>() {
        @Override
        public Number getDefaultValue() {
            return 0;
        }

        @Override
        public Number getSample() {
            return allWatchesGauge.get();
        }
    };
    this.statsLogger.registerGauge(totalWatchesGauageLabel, totalWatchesGauge);

    numChildWatchesGauge = new Gauge<Number>() {
        @Override
        public Number getDefaultValue() {
            return 0;
        }

        @Override
        public Number getSample() {
            return childWatches.size();
        }
    };

    this.statsLogger.registerGauge(numChildWatchesGauageLabel, numChildWatchesGauge);
}
 
Example #17
Source File: StreamRequestLimiter.java    From distributedlog with Apache License 2.0 5 votes vote down vote up
public StreamRequestLimiter(String streamName,
                            DynamicDistributedLogConfiguration dynConf,
                            StatsLogger statsLogger,
                            Feature disabledFeature) {
    super(dynConf, statsLogger, disabledFeature);
    this.limiterStatLogger = statsLogger;
    this.dynConf = dynConf;
    this.streamName = streamName;
    this.limiter = build();
}
 
Example #18
Source File: EnvelopedEntry.java    From distributedlog with Apache License 2.0 5 votes vote down vote up
/**
 * @param statsLogger
 *          Used for getting stats for (de)compression time
 * @param compressionType
 *          The compression type to use
 * @param decompressed
 *          The decompressed payload
 *          NOTE: The size of the byte array passed as the decompressed payload can be larger
 *                than the actual contents to be compressed.
 */
public EnvelopedEntry(byte version,
                      CompressionCodec.Type compressionType,
                      byte[] decompressed,
                      int length,
                      StatsLogger statsLogger)
        throws InvalidEnvelopedEntryException {
    this(version, statsLogger);
    Preconditions.checkNotNull(compressionType);
    Preconditions.checkNotNull(decompressed);
    Preconditions.checkArgument(length >= 0, "Invalid bytes length " + length);

    this.header = new Header(compressionType, length);
    this.payloadDecompressed = new Payload(length, decompressed);
}
 
Example #19
Source File: ComposableRequestLimiter.java    From distributedlog with Apache License 2.0 5 votes vote down vote up
public ComposableRequestLimiter(
        RateLimiter limiter,
        OverlimitFunction<Request> overlimitFunction,
        CostFunction<Request> costFunction,
        StatsLogger statsLogger) {
    Preconditions.checkNotNull(limiter);
    Preconditions.checkNotNull(overlimitFunction);
    Preconditions.checkNotNull(costFunction);
    this.limiter = limiter;
    this.overlimitFunction = overlimitFunction;
    this.costFunction = costFunction;
    this.overlimitCounter = statsLogger.getCounter("overlimit");
}
 
Example #20
Source File: ReadAheadCache.java    From distributedlog with Apache License 2.0 5 votes vote down vote up
public ReadAheadCache(String streamName,
                      StatsLogger statsLogger,
                      AlertStatsLogger alertStatsLogger,
                      AsyncNotification notification,
                      int maxCachedRecords,
                      boolean deserializeRecordSet,
                      boolean traceDeliveryLatencyEnabled,
                      long deliveryLatencyWarnThresholdMillis,
                      Ticker ticker) {
    this.streamName = streamName;
    this.maxCachedRecords = maxCachedRecords;
    this.notification = notification;
    this.deserializeRecordSet = deserializeRecordSet;

    // create the readahead queue
    readAheadRecords = new LinkedBlockingQueue<LogRecordWithDLSN>();

    // start the idle reader detection
    lastEntryProcessTime = Stopwatch.createStarted(ticker);

    // Flags to control delivery latency tracing
    this.traceDeliveryLatencyEnabled = traceDeliveryLatencyEnabled;
    this.deliveryLatencyWarnThresholdMillis = deliveryLatencyWarnThresholdMillis;
    // Stats
    StatsLogger readAheadStatsLogger = statsLogger.scope("readahead");
    this.statsLogger = readAheadStatsLogger;
    this.alertStatsLogger = alertStatsLogger;
    this.readAheadDeliveryLatencyStat =
            readAheadStatsLogger.getOpStatsLogger("delivery_latency");
    this.negativeReadAheadDeliveryLatencyStat =
            readAheadStatsLogger.getOpStatsLogger("negative_delivery_latency");
}
 
Example #21
Source File: ArtemisBenchmarkDriver.java    From openmessaging-benchmark with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(File configurationFile, StatsLogger statsLogger) throws IOException {
    this.config = readConfig(configurationFile);
    log.info("ActiveMQ Artemis driver configuration: {}", writer.writeValueAsString(config));
    try {
        ServerLocator serverLocator = ActiveMQClient.createServerLocator(config.brokerAddress);
        serverLocator.setConfirmationWindowSize(1000);
        
        sessionFactory = serverLocator.createSessionFactory();
        session = sessionFactory.createSession();
    } catch (Exception e) {
        throw new IOException(e);
    }
}
 
Example #22
Source File: StreamAcquireLimiter.java    From distributedlog with Apache License 2.0 5 votes vote down vote up
public StreamAcquireLimiter(StreamManager streamManager,
                            MovingAverageRate serviceRps,
                            double serviceRpsLimit,
                            StatsLogger statsLogger) {
    this.streamManager = streamManager;
    this.serviceRps = serviceRps;
    this.serviceRpsLimit = serviceRpsLimit;
    this.overlimitCounter = statsLogger.getCounter("overlimit");
}
 
Example #23
Source File: BKAsyncLogReader.java    From distributedlog with Apache License 2.0 5 votes vote down vote up
BKAsyncLogReader(BKDistributedLogManager bkdlm,
                 OrderedScheduler scheduler,
                 DLSN startDLSN,
                 Optional<String> subscriberId,
                 boolean returnEndOfStreamRecord,
                 StatsLogger statsLogger) {
    this.streamName = bkdlm.getStreamName();
    this.bkDistributedLogManager = bkdlm;
    this.scheduler = scheduler;
    this.readHandler = bkDistributedLogManager.createReadHandler(subscriberId,
            this, true);
    LOG.debug("Starting async reader at {}", startDLSN);
    this.startDLSN = startDLSN;
    this.scheduleDelayStopwatch = Stopwatch.createUnstarted();
    this.readNextDelayStopwatch = Stopwatch.createStarted();
    this.positionGapDetectionEnabled = bkdlm.getConf().getPositionGapDetectionEnabled();
    this.idleErrorThresholdMillis = bkdlm.getConf().getReaderIdleErrorThresholdMillis();
    this.returnEndOfStreamRecord = returnEndOfStreamRecord;

    // Stats
    StatsLogger asyncReaderStatsLogger = statsLogger.scope("async_reader");
    futureSetLatency = asyncReaderStatsLogger.getOpStatsLogger("future_set");
    scheduleLatency = asyncReaderStatsLogger.getOpStatsLogger("schedule");
    backgroundReaderRunTime = asyncReaderStatsLogger.getOpStatsLogger("background_read");
    readNextExecTime = asyncReaderStatsLogger.getOpStatsLogger("read_next_exec");
    timeBetweenReadNexts = asyncReaderStatsLogger.getOpStatsLogger("time_between_read_next");
    delayUntilPromiseSatisfied = asyncReaderStatsLogger.getOpStatsLogger("delay_until_promise_satisfied");
    idleReaderError = asyncReaderStatsLogger.getCounter("idle_reader_error");
    idleReaderCheckCount = asyncReaderStatsLogger.getCounter("idle_reader_check_total");
    idleReaderCheckIdleReadRequestCount = asyncReaderStatsLogger.getCounter("idle_reader_check_idle_read_requests");
    idleReaderCheckIdleReadAheadCount = asyncReaderStatsLogger.getCounter("idle_reader_check_idle_readahead");

    // Lock the stream if requested. The lock will be released when the reader is closed.
    this.lockStream = false;
    this.idleReaderTimeoutTask = scheduleIdleReaderTaskIfNecessary();
    this.lastProcessTime = Stopwatch.createStarted();
}
 
Example #24
Source File: BroadCastStatsLogger.java    From distributedlog with Apache License 2.0 5 votes vote down vote up
@Override
public void removeScope(String scope, StatsLogger statsLogger) {
    if (!(statsLogger instanceof Two)) {
        return;
    }

    Two another = (Two) statsLogger;

    first.removeScope(scope, another.first);
    second.removeScope(scope, another.second);
}
 
Example #25
Source File: ReleaseOp.java    From distributedlog with Apache License 2.0 5 votes vote down vote up
public ReleaseOp(String stream,
                 StatsLogger statsLogger,
                 StatsLogger perStreamStatsLogger,
                 StreamManager streamManager,
                 Long checksum,
                 Feature checksumDisabledFeature,
                 AccessControlManager accessControlManager) {
    super(stream, requestStat(statsLogger, "release"), checksum, checksumDisabledFeature);
    StreamOpStats streamOpStats = new StreamOpStats(statsLogger, perStreamStatsLogger);
    this.deniedReleaseCounter = streamOpStats.requestDeniedCounter("release");
    this.accessControlManager = accessControlManager;
    this.streamManager = streamManager;
}
 
Example #26
Source File: DistributedLogNamespaceImpl.java    From distributedlog with Apache License 2.0 5 votes vote down vote up
@Override
public DistributedLogManager openLog(String logName,
                                     Optional<DistributedLogConfiguration> logConf,
                                     Optional<DynamicDistributedLogConfiguration> dynamicLogConf,
                                     Optional<StatsLogger> perStreamStatsLogger)
        throws InvalidStreamNameException, IOException {
    return new DistributedLogManagerImpl(
        impl.openLog(
            logName,
            gOptional2JOptional(logConf),
            gOptional2JOptional(dynamicLogConf),
            gOptional2JOptional(perStreamStatsLogger)
        ));
}
 
Example #27
Source File: StreamImpl.java    From distributedlog with Apache License 2.0 5 votes vote down vote up
void countException(Throwable t, StatsLogger streamExceptionLogger) {
    String exceptionName = null == t ? "null" : t.getClass().getName();
    Counter counter = exceptionCounters.get(exceptionName);
    if (null == counter) {
        counter = exceptionStatLogger.getCounter(exceptionName);
        Counter oldCounter = exceptionCounters.putIfAbsent(exceptionName, counter);
        if (null != oldCounter) {
            counter = oldCounter;
        }
    }
    counter.inc();
    streamExceptionLogger.getCounter(exceptionName).inc();
}
 
Example #28
Source File: HeartbeatOp.java    From distributedlog with Apache License 2.0 5 votes vote down vote up
public HeartbeatOp(String stream,
                   StatsLogger statsLogger,
                   StatsLogger perStreamStatsLogger,
                   byte dlsnVersion,
                   Long checksum,
                   Feature checksumDisabledFeature,
                   AccessControlManager accessControlManager) {
    super(stream, requestStat(statsLogger, "heartbeat"), checksum, checksumDisabledFeature);
    StreamOpStats streamOpStats = new StreamOpStats(statsLogger, perStreamStatsLogger);
    this.deniedHeartbeatCounter = streamOpStats.requestDeniedCounter("heartbeat");
    this.dlsnVersion = dlsnVersion;
    this.accessControlManager = accessControlManager;
}
 
Example #29
Source File: CreateOp.java    From distributedlog with Apache License 2.0 5 votes vote down vote up
public CreateOp(String stream,
                StatsLogger statsLogger,
                StreamManager streamManager,
                Long checksum,
                Feature checksumEnabledFeature) {
  super(stream,
          streamManager,
          requestStat(statsLogger, "create"),
          checksum,
          checksumEnabledFeature);
}
 
Example #30
Source File: MockedPulsarServiceBaseTest.java    From pulsar with Apache License 2.0 5 votes vote down vote up
@Override
public BookKeeper create(ServiceConfiguration conf, ZooKeeper zkClient,
                         Optional<Class<? extends EnsemblePlacementPolicy>> ensemblePlacementPolicyClass,
                         Map<String, Object> properties, StatsLogger statsLogger) {
    // Always return the same instance (so that we don't loose the mock BK content on broker restart
    return mockBookKeeper;
}