com.netflix.spectator.api.Registry Java Examples
The following examples show how to use
com.netflix.spectator.api.Registry.
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: CommonStorageServiceDAOConfig.java From front50 with Apache License 2.0 | 6 votes |
@Bean ServiceAccountDAO serviceAccountDAO( StorageService storageService, StorageServiceConfigurationProperties storageServiceConfigurationProperties, ObjectKeyLoader objectKeyLoader, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { return new DefaultServiceAccountDAO( storageService, Schedulers.from( Executors.newFixedThreadPool( storageServiceConfigurationProperties.getServiceAccount().getThreadPool())), objectKeyLoader, storageServiceConfigurationProperties.getServiceAccount().getRefreshMs(), storageServiceConfigurationProperties.getServiceAccount().getShouldWarmCache(), registry, circuitBreakerRegistry); }
Example #2
Source File: SQSSubscriberProvider.java From kork with Apache License 2.0 | 6 votes |
@Autowired public SQSSubscriberProvider( AWSCredentialsProvider awsCredentialsProvider, AmazonPubsubProperties properties, PubsubSubscribers pubsubSubscribers, AmazonPubsubMessageHandlerFactory pubsubMessageHandlerFactory, AmazonMessageAcknowledger messageAcknowledger, Registry registry, EurekaStatusListener eurekaStatus, DynamicConfigService dynamicConfig) { this.awsCredentialsProvider = awsCredentialsProvider; this.properties = properties; this.pubsubSubscribers = pubsubSubscribers; this.pubsubMessageHandlerFactory = pubsubMessageHandlerFactory; this.messageAcknowledger = messageAcknowledger; this.registry = registry; this.eurekaStatus = eurekaStatus; this.dynamicConfig = dynamicConfig; }
Example #3
Source File: CommonStorageServiceDAOConfig.java From front50 with Apache License 2.0 | 6 votes |
@Bean ApplicationPermissionDAO applicationPermissionDAO( StorageService storageService, StorageServiceConfigurationProperties storageServiceConfigurationProperties, ObjectKeyLoader objectKeyLoader, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { return new DefaultApplicationPermissionDAO( storageService, Schedulers.from( Executors.newFixedThreadPool( storageServiceConfigurationProperties.getApplicationPermission().getThreadPool())), objectKeyLoader, storageServiceConfigurationProperties.getApplicationPermission().getRefreshMs(), storageServiceConfigurationProperties.getApplicationPermission().getShouldWarmCache(), registry, circuitBreakerRegistry); }
Example #4
Source File: SQSSubscriber.java From kork with Apache License 2.0 | 6 votes |
public SQSSubscriber( AmazonPubsubProperties.AmazonPubsubSubscription subscription, AmazonPubsubMessageHandler messageHandler, AmazonMessageAcknowledger messageAcknowledger, AmazonSNS amazonSNS, AmazonSQS amazonSQS, Supplier<Boolean> isEnabled, Registry registry) { this.subscription = subscription; this.messageHandler = messageHandler; this.messageAcknowledger = messageAcknowledger; this.amazonSNS = amazonSNS; this.amazonSQS = amazonSQS; this.isEnabled = isEnabled; this.registry = registry; this.queueARN = new ARN(subscription.getQueueARN()); this.topicARN = new ARN(subscription.getTopicARN()); }
Example #5
Source File: ExecutionMapper.java From kayenta with Apache License 2.0 | 6 votes |
@Autowired public ExecutionMapper( ObjectMapper objectMapper, Registry registry, String currentInstanceId, Optional<List<CanaryScopeFactory>> canaryScopeFactories, ExecutionLauncher executionLauncher, ExecutionRepository executionRepository) { this.objectMapper = objectMapper; this.registry = registry; this.currentInstanceId = currentInstanceId; this.canaryScopeFactories = canaryScopeFactories.orElseGet(Collections::emptyList); this.executionLauncher = executionLauncher; this.executionRepository = executionRepository; this.pipelineRunId = registry.createId("canary.pipelines.initiated"); this.failureId = registry.createId("canary.pipelines.startupFailed"); }
Example #6
Source File: LongTaskTimer.java From spectator with Apache License 2.0 | 6 votes |
/** * Creates a timer for tracking long running tasks. * * @param registry * Registry to use. * @param id * Identifier for the metric being registered. * @return * Timer instance. */ public static LongTaskTimer get(Registry registry, Id id) { ConcurrentMap<Id, Object> state = registry.state(); Object obj = Utils.computeIfAbsent(state, id, i -> { LongTaskTimer timer = new LongTaskTimer(registry, id); PolledMeter.using(registry) .withId(id) .withTag(Statistic.activeTasks) .monitorValue(timer, LongTaskTimer::activeTasks); PolledMeter.using(registry) .withId(id) .withTag(Statistic.duration) .monitorValue(timer, t -> t.duration() / NANOS_PER_SECOND); return timer; }); if (!(obj instanceof LongTaskTimer)) { Utils.propagateTypeError(registry, id, LongTaskTimer.class, obj.getClass()); obj = new LongTaskTimer(new NoopRegistry(), id); } return (LongTaskTimer) obj; }
Example #7
Source File: S3Config.java From front50 with Apache License 2.0 | 6 votes |
@Bean @ConditionalOnProperty("spinnaker.s3.eventing.enabled") public ObjectKeyLoader eventingS3ObjectKeyLoader( ObjectMapper objectMapper, S3MetadataStorageProperties s3Properties, StorageService storageService, TemporarySQSQueue temporaryQueueSupport, Registry registry) { return new EventingS3ObjectKeyLoader( Executors.newFixedThreadPool(1), objectMapper, s3Properties, temporaryQueueSupport, storageService, registry, true); }
Example #8
Source File: MetadataService.java From metacat with Apache License 2.0 | 6 votes |
/** * Constructor. * * @param config configuration * @param tableService table service * @param partitionService partition service * @param userMetadataService user metadata service * @param tagService tag service * @param helper service helper * @param registry registry */ public MetadataService(final Config config, final TableService tableService, final PartitionService partitionService, final UserMetadataService userMetadataService, final TagService tagService, final MetacatServiceHelper helper, final Registry registry) { this.config = config; this.tableService = tableService; this.partitionService = partitionService; this.userMetadataService = userMetadataService; this.tagService = tagService; this.helper = helper; this.registry = registry; }
Example #9
Source File: ServicesConfig.java From metacat with Apache License 2.0 | 6 votes |
/** * Partition service bean. * * @param catalogService catalog service * @param connectorManager connector manager * @param tableService table service * @param userMetadataService user metadata service * @param threadServiceManager thread manager * @param config configurations * @param eventBus Internal event bus * @param converterUtil utility to convert to/from Dto to connector resources * @param registry registry handle * @return The partition service implementation to use */ @Bean public PartitionService partitionService( final CatalogService catalogService, final ConnectorManager connectorManager, final TableService tableService, final UserMetadataService userMetadataService, final ThreadServiceManager threadServiceManager, final Config config, final MetacatEventBus eventBus, final ConverterUtil converterUtil, final Registry registry ) { return new PartitionServiceImpl( catalogService, connectorManager, tableService, userMetadataService, threadServiceManager, config, eventBus, converterUtil, registry ); }
Example #10
Source File: AmazonPubsubConfig.java From kork with Apache License 2.0 | 6 votes |
@Bean SQSSubscriberProvider subscriberProvider( AWSCredentialsProvider awsCredentialsProvider, AmazonPubsubProperties properties, PubsubSubscribers subscribers, AmazonPubsubMessageHandlerFactory messageHandlerFactory, AmazonMessageAcknowledger messageAcknowledger, Registry registry, EurekaStatusListener eurekaStatus, DynamicConfigService dynamicConfig) { return new SQSSubscriberProvider( awsCredentialsProvider, properties, subscribers, messageHandlerFactory, messageAcknowledger, registry, eurekaStatus, dynamicConfig); }
Example #11
Source File: SQSSubscriber.java From echo with Apache License 2.0 | 6 votes |
public SQSSubscriber( ObjectMapper objectMapper, AmazonPubsubProperties.AmazonPubsubSubscription subscription, PubsubMessageHandler pubsubMessageHandler, AmazonSNS amazonSNS, AmazonSQS amazonSQS, Supplier<Boolean> isEnabled, Registry registry) { this.objectMapper = objectMapper; this.subscription = subscription; this.pubsubMessageHandler = pubsubMessageHandler; this.amazonSNS = amazonSNS; this.amazonSQS = amazonSQS; this.isEnabled = isEnabled; this.registry = registry; this.queueARN = new ARN(subscription.getQueueARN()); this.topicARN = new ARN(subscription.getTopicARN()); }
Example #12
Source File: StackdriverWriter.java From kork with Apache License 2.0 | 6 votes |
/** Add a TimeSeries for each appropriate meter measurement. */ void addMeterToTimeSeries(Registry registry, Meter meter, List<TimeSeries> tsList) { Iterable<Measurement> measurements = meter.measure(); boolean applyFilter = true; if (cache.meterIsTimer(registry, meter)) { measurements = transformTimerMeasurements(measurements); applyFilter = false; } for (Measurement measurement : measurements) { if (applyFilter && !measurementFilter.test(measurement)) { continue; } String descriptorType = cache.idToDescriptorType(measurement.id()); tsList.add(measurementToTimeSeries(descriptorType, registry, meter, measurement)); } }
Example #13
Source File: CassandraTest.java From spectator with Apache License 2.0 | 6 votes |
@Test public void readLatency() throws Exception { Registry r = new DefaultRegistry(new ManualClock()); List<JmxConfig> configs = configs(); JmxData data = timer("keyspace=test,name=ReadLatency,scope=foo,type=ColumnFamily", 0); List<Measurement> ms = measure(r, configs, data); Assertions.assertEquals(7, ms.size()); Assertions.assertEquals( 50.0e-4, Utils.first(ms, "statistic", "percentile_50").value(), 1e-12); data = timer("keyspace=test,name=ReadLatency,scope=foo,type=ColumnFamily", 1); ms = measure(r, configs, data); Assertions.assertEquals(7, ms.size()); Assertions.assertEquals( 50.01e-4, Utils.first(ms, "statistic", "percentile_50").value(), 1e-12); }
Example #14
Source File: FiatStatus.java From fiat with Apache License 2.0 | 6 votes |
@Autowired public FiatStatus( Registry registry, DynamicConfigService dynamicConfigService, FiatClientConfigurationProperties fiatClientConfigurationProperties) { this.dynamicConfigService = dynamicConfigService; this.fiatClientConfigurationProperties = fiatClientConfigurationProperties; this.enabled = new AtomicBoolean(fiatClientConfigurationProperties.isEnabled()); this.legacyFallbackEnabled = new AtomicBoolean(fiatClientConfigurationProperties.isLegacyFallback()); PolledMeter.using(registry) .withName("fiat.enabled") .monitorValue(enabled, value -> enabled.get() ? 1 : 0); PolledMeter.using(registry) .withName("fiat.legacyFallback.enabled") .monitorValue(legacyFallbackEnabled, value -> legacyFallbackEnabled.get() ? 1 : 0); }
Example #15
Source File: BucketDistributionSummaryTest.java From spectator with Apache License 2.0 | 6 votes |
@Test public void basic() { Registry r = new DefaultRegistry(); BucketDistributionSummary c = BucketDistributionSummary.get( r, r.createId("test"), BucketFunctions.latency(4, TimeUnit.SECONDS)); c.record(TimeUnit.MILLISECONDS.toNanos(3750)); Assertions.assertEquals(1, r.distributionSummaries().count()); Assertions.assertEquals(1, sum(r, "test")); c.record(TimeUnit.MILLISECONDS.toNanos(4221)); Assertions.assertEquals(2, r.distributionSummaries().count()); Assertions.assertEquals(2, sum(r, "test")); c.record(TimeUnit.MILLISECONDS.toNanos(4221)); Assertions.assertEquals(2, r.distributionSummaries().count()); Assertions.assertEquals(3, sum(r, "test")); }
Example #16
Source File: DefaultProjectDAO.java From front50 with Apache License 2.0 | 6 votes |
public DefaultProjectDAO( StorageService service, Scheduler scheduler, ObjectKeyLoader objectKeyLoader, long refreshIntervalMs, boolean shouldWarmCache, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { super( ObjectType.PROJECT, service, scheduler, objectKeyLoader, refreshIntervalMs, shouldWarmCache, registry, circuitBreakerRegistry); }
Example #17
Source File: BaseServerStartup.java From zuul with Apache License 2.0 | 6 votes |
@Inject public BaseServerStartup(ServerStatusManager serverStatusManager, FilterLoader filterLoader, SessionContextDecorator sessionCtxDecorator, FilterUsageNotifier usageNotifier, RequestCompleteHandler reqCompleteHandler, Registry registry, DirectMemoryMonitor directMemoryMonitor, EventLoopGroupMetrics eventLoopGroupMetrics, EurekaClient discoveryClient, ApplicationInfoManager applicationInfoManager, AccessLogPublisher accessLogPublisher) { this.serverStatusManager = serverStatusManager; this.registry = registry; this.directMemoryMonitor = directMemoryMonitor; this.eventLoopGroupMetrics = eventLoopGroupMetrics; this.discoveryClient = discoveryClient; this.applicationInfoManager = applicationInfoManager; this.accessLogPublisher = accessLogPublisher; this.sessionCtxDecorator = sessionCtxDecorator; this.reqCompleteHandler = reqCompleteHandler; this.filterLoader = filterLoader; this.usageNotifier = usageNotifier; }
Example #18
Source File: CommonStorageServiceDAOConfig.java From front50 with Apache License 2.0 | 6 votes |
@Bean PipelineDAO pipelineDAO( StorageService storageService, StorageServiceConfigurationProperties storageServiceConfigurationProperties, ObjectKeyLoader objectKeyLoader, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { return new DefaultPipelineDAO( storageService, Schedulers.from( Executors.newFixedThreadPool( storageServiceConfigurationProperties.getPipeline().getThreadPool())), objectKeyLoader, storageServiceConfigurationProperties.getPipeline().getRefreshMs(), storageServiceConfigurationProperties.getPipeline().getShouldWarmCache(), registry, circuitBreakerRegistry); }
Example #19
Source File: VertxMetersInitializer.java From servicecomb-java-chassis with Apache License 2.0 | 6 votes |
@Override public void init(GlobalRegistry globalRegistry, EventBus eventBus, MetricsBootstrapConfig config) { Registry registry = globalRegistry.getDefaultRegistry(); Id endpointsId = registry.createId(VERTX_ENDPOINTS); VertxEndpointsMeter clientMeter = new HttpClientEndpointsMeter( endpointsId.withTag(ENDPOINTS_TYPE, ENDPOINTS_CLINET), SharedVertxFactory.getMetricsFactory() .getVertxMetrics() .getClientEndpointMetricManager() .getClientEndpointMetricMap()); SpectatorUtils.registerMeter(registry, clientMeter); VertxEndpointsMeter serverMeter = new ServerEndpointsMeter( endpointsId.withTag(ENDPOINTS_TYPE, ENDPOINTS_SERVER), SharedVertxFactory.getMetricsFactory() .getVertxMetrics() .getServerEndpointMetricMap()); SpectatorUtils.registerMeter(registry, serverMeter); }
Example #20
Source File: DefaultNotificationDAO.java From front50 with Apache License 2.0 | 6 votes |
public DefaultNotificationDAO( StorageService service, Scheduler scheduler, ObjectKeyLoader objectKeyLoader, long refreshIntervalMs, boolean shouldWarmCache, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { super( ObjectType.NOTIFICATION, service, scheduler, objectKeyLoader, refreshIntervalMs, shouldWarmCache, registry, circuitBreakerRegistry); }
Example #21
Source File: ElasticSearchConfig.java From metacat with Apache License 2.0 | 6 votes |
/** * Traversal action implementation for ElasticSearch refresh. * * @param config System config * @param eventBus Event bus * @param databaseService Database service * @param tableService Table service * @param userMetadataService User metadata service * @param tagService Tag service * @param elasticSearchUtil ElasticSearch client wrapper * @param registry registry of spectator * @return The refresh bean */ @Bean public ElasticSearchCatalogTraversalAction elasticSearchCatalogTraversalAction( final Config config, final MetacatEventBus eventBus, final DatabaseService databaseService, final TableService tableService, final UserMetadataService userMetadataService, final TagService tagService, final ElasticSearchUtil elasticSearchUtil, final Registry registry ) { return new ElasticSearchCatalogTraversalAction( config, eventBus, databaseService, tableService, userMetadataService, tagService, elasticSearchUtil, registry ); }
Example #22
Source File: PercentileDistributionSummaryTest.java From spectator with Apache License 2.0 | 6 votes |
@Test public void builderWithDifferentThresholds() { Registry r = newRegistry(); PercentileDistributionSummary t1 = PercentileDistributionSummary.builder(r) .withName("test") .withRange(10, 50) .build(); PercentileDistributionSummary t2 = PercentileDistributionSummary.builder(r) .withName("test") .withRange(100, 200) .build(); t1.record(5); checkValue(t1, t2, 10.0); t1.record(500); checkValue(t1, t2, 50.0); t2.record(5); checkValue(t1, t2, 100.0); t2.record(500); checkValue(t1, t2, 200.0); }
Example #23
Source File: EmbeddedHiveClient.java From metacat with Apache License 2.0 | 5 votes |
/** * Embedded hive client implementation. * * @param catalogName catalogName * @param handler handler * @param registry registry */ public EmbeddedHiveClient(final String catalogName, @Nullable final IMetacatHMSHandler handler, final Registry registry) { this.handler = handler; this.registry = registry; this.requestTimerId = registry.createId(HiveMetrics.TimerHiveRequest.getMetricName()); this.hiveSqlErrorCounter = registry.counter(HiveMetrics.CounterHiveSqlLockError.getMetricName() + "." + catalogName); }
Example #24
Source File: ReactorSerializedInvokerMetrics.java From titus-control-plane with Apache License 2.0 | 5 votes |
ReactorSerializedInvokerMetrics(String name, Registry registry) { this.name = name; this.registry = registry; this.submitCounter = registry.counter(ROOT_NAME + "submit", "name", name); this.queueFullCounter = registry.counter(ROOT_NAME + "queueFull", "name", name); this.queueSize = registry.gauge(ROOT_NAME + "queueSize", "name", name); this.queueingTimer = registry.timer(ROOT_NAME + "queueingTime", "name", name); this.executionTimer = registry.timer(ROOT_NAME + "executionTime", "name", name, "status", "success"); this.executionErrorTimer = registry.timer(ROOT_NAME + "executionTime", "name", name, "status", "error"); this.executionDisposedTimer = registry.timer(ROOT_NAME + "executionTime", "name", name, "status", "disposed"); }
Example #25
Source File: InstrumentedCache.java From titus-control-plane with Apache License 2.0 | 5 votes |
public InstrumentedCache(String metricNameRoot, Cache<K, V> cache, Registry registry) { this.cache = cache; Preconditions.checkNotNull(registry, "registry"); Preconditions.checkNotNull(cache, "cache"); String metricPrefix = metricNameRoot + ".cache."; requestCountGauge = registry.gauge(metricPrefix + "requestCount"); hitCountGauge = registry.gauge(metricPrefix + "hitCount"); missCountGauge = registry.gauge(metricPrefix + "missCount"); loadSuccessCountGauge = registry.gauge(metricPrefix + "loadSuccessCount"); loadFailureCountGauge = registry.gauge(metricPrefix + "loadFailureCount"); totalLoadTimeGauge = registry.gauge(metricPrefix + "totalLoadTime"); evictionCountGauge = registry.gauge(metricPrefix + "evictionCount"); evictionWeightGauge = registry.gauge(metricPrefix + "evictionWeight"); estimatedSizeGauge = registry.gauge(metricPrefix + "estimatedSize"); metricSubscription = ObservableExt.schedule(metricNameRoot, registry, UPDATE_CACHE_METRICS_NAME, Completable.fromAction(this::updateMetrics), 0, UPDATE_METRICS_INTERVAL_SEC, TimeUnit.SECONDS, Schedulers.computation() ).subscribe( next -> { if (next.isPresent()) { Throwable cause = next.get(); logger.error("Unable to update cache metrics with error", cause); } else { logger.debug("Successfully updated cache metrics"); } } ); }
Example #26
Source File: PercentileTimer.java From spectator with Apache License 2.0 | 5 votes |
/** * Only create a new instance of the counter if there is not a cached copy. The array for * keeping track of the counter per bucket is quite large (1-2k depending on pointer size) * and can lead to a high allocation rate if the timer is not reused in a high volume call * site. */ private static PercentileTimer computeIfAbsent(Registry registry, Id id, long min, long max) { Object timer = Utils.computeIfAbsent( registry.state(), id, i -> new PercentileTimer(registry, id, min, max)); return (timer instanceof PercentileTimer) ? ((PercentileTimer) timer).withRange(min, max) : new PercentileTimer(registry, id, min, max); }
Example #27
Source File: Http2ConnectionCloseHandler.java From zuul with Apache License 2.0 | 5 votes |
@Inject public Http2ConnectionCloseHandler(Registry registry) { super(); this.registry = registry; this.counterBaseId = registry.createId("server.connection.close.handled"); }
Example #28
Source File: PolledMeter.java From spectator with Apache License 2.0 | 5 votes |
/** Create a new instance. */ Builder(Registry registry, Id baseId) { super(); this.registry = registry; this.baseId = baseId; this.delay = registry.config().gaugePollingFrequency().toMillis(); }
Example #29
Source File: IntervalCounter.java From spectator with Apache License 2.0 | 5 votes |
/** * Create a new IntervalCounter using the given registry and base id. */ IntervalCounter(Registry registry, Id id) { this.clock = registry.clock(); this.id = id; this.counter = registry.counter(id.withTag(Statistic.count)); this.lastUpdated = PolledMeter.using(registry) .withId(id) .withTag(Statistic.duration) .monitorValue(new AtomicLong(0L), Functions.age(clock)); }
Example #30
Source File: DefaultLoadBalancerReconciler.java From titus-control-plane with Apache License 2.0 | 5 votes |
DefaultLoadBalancerReconciler(LoadBalancerConfiguration configuration, LoadBalancerStore store, LoadBalancerConnector connector, LoadBalancerJobOperations loadBalancerJobOperations, Runnable afterReconciliation, Registry registry, Scheduler scheduler) { this.store = store; this.connector = connector; this.jobOperations = loadBalancerJobOperations; this.delayMs = configuration.getReconciliationDelayMs(); this.timeoutMs = configuration::getReconciliationTimeoutMs; this.afterReconciliation = afterReconciliation; this.registry = registry; this.scheduler = scheduler; List<Tag> tags = Collections.singletonList(new BasicTag("class", DefaultLoadBalancerReconciler.class.getSimpleName())); final Id updatesCounterId = registry.createId(METRIC_RECONCILER + ".updates", tags); this.registerCounter = registry.counter(updatesCounterId.withTag("operation", "register")); this.deregisterCounter = registry.counter(updatesCounterId.withTag("operation", "deregister")); this.removeCounter = registry.counter(updatesCounterId.withTag("operation", "remove")); this.fullReconciliationMetrics = SpectatorExt.continuousSubscriptionMetrics(METRIC_RECONCILER + ".full", tags, registry); this.orphanUpdateMetrics = SpectatorExt.continuousSubscriptionMetrics(METRIC_RECONCILER + ".orphanUpdates", tags, registry); this.removeMetrics = SpectatorExt.continuousSubscriptionMetrics(METRIC_RECONCILER + ".remove", tags, registry); this.removeTargetsMetrics = SpectatorExt.continuousSubscriptionMetrics(METRIC_RECONCILER + ".removeTargets", tags, registry); this.registeredIpsMetrics = SpectatorExt.continuousSubscriptionMetrics(METRIC_RECONCILER + ".getRegisteredIps", tags, registry); this.ignoredMetricsId = registry.createId(METRIC_RECONCILER + ".ignored", tags); this.orphanMetricsId = registry.createId(METRIC_RECONCILER + ".orphan", tags); PolledMeter.using(registry).withId(ignoredMetricsId).monitorSize(ignored); PolledMeter.using(registry).withId(orphanMetricsId).monitorSize(markedAsOrphan); }