/** * Returns the {@link MeterRegistry} that collects various stats. */ public MeterRegistry meterRegistry() { return config().meterRegistry(); }
void setServerConfig(ServerConfig serverConfig) { if (this.serverConfig != null) { throw new IllegalStateException("VirtualHost cannot be added to more than one Server."); } this.serverConfig = requireNonNull(serverConfig, "serverConfig"); final MeterRegistry registry = serverConfig.meterRegistry(); final MeterIdPrefix idPrefix = new MeterIdPrefix("armeria.server.router.virtualHostCache", "hostnamePattern", hostnamePattern); router.registerMetrics(registry, idPrefix); }
private void setupServerMetrics() { final MeterRegistry meterRegistry = config().meterRegistry(); final GracefulShutdownSupport gracefulShutdownSupport = this.gracefulShutdownSupport; assert gracefulShutdownSupport != null; meterRegistry.gauge("armeria.server.pendingResponses", gracefulShutdownSupport, GracefulShutdownSupport::pendingResponses); meterRegistry.gauge("armeria.server.connections", connectionLimitingHandler, ConnectionLimitingHandler::numConnections); }
Server(ServerConfig config, @Nullable DomainNameMapping<SslContext> sslContexts) { this.config = requireNonNull(config, "config"); this.sslContexts = sslContexts; startStop = new ServerStartStopSupport(config.startStopExecutor()); connectionLimitingHandler = new ConnectionLimitingHandler(config.maxNumConnections()); config.setServer(this); // Server-wide cache metrics. final MeterIdPrefix idPrefix = new MeterIdPrefix("armeria.server.parsedPathCache"); PathAndQuery.registerMetrics(config.meterRegistry(), idPrefix); // Invoke the serviceAdded() method in Service so that it can keep the reference to this Server or // add a listener to it. config.serviceConfigs().forEach(cfg -> ServiceCallbackInvoker.invokeServiceAdded(cfg, cfg.service())); }
@Override public String toString() { String strVal = this.strVal; if (strVal == null) { this.strVal = strVal = toString( getClass(), ports(), null, virtualHosts(), workerGroup(), shutdownWorkerGroupOnStop(), maxNumConnections(), idleTimeoutMillis(), defaultRequestTimeoutMillis(), defaultMaxRequestLength(), verboseResponses(), http2InitialConnectionWindowSize(), http2InitialStreamWindowSize(), http2MaxStreamsPerConnection(), http2MaxFrameSize(), http2MaxHeaderListSize(), http1MaxInitialLineLength(), http1MaxHeaderSize(), http1MaxChunkSize(), proxyProtocolMaxTlvSize(), gracefulShutdownQuietPeriod(), gracefulShutdownTimeout(), blockingTaskExecutor(), meterRegistry(), serviceLoggerPrefix(), accessLogWriter(), shutdownAccessLogWriterOnStop(), channelOptions(), childChannelOptions(), clientAddressSources(), clientAddressTrustedProxyFilter(), clientAddressFilter() ); } return strVal; }