Class ObservationService
java.lang.Object
com.linecorp.armeria.common.util.AbstractUnwrappable<Service<T_I,T_O>>
com.linecorp.armeria.server.DecoratingService<I,O,I,O>
com.linecorp.armeria.server.SimpleDecoratingService<HttpRequest,HttpResponse>
com.linecorp.armeria.server.SimpleDecoratingHttpService
com.linecorp.armeria.server.observation.ObservationService
- All Implemented Interfaces:
Unwrappable
,HttpService
,Service<HttpRequest,
HttpResponse>
Decorates an
HttpService
to trace inbound HttpRequest
s using
Micrometer Observation.
The following may be a typical implementation using a brave implementation:
// create a tracer
BraveCurrentTraceContext braveCurrentTraceContext = new BraveCurrentTraceContext(
tracing.currentTraceContext());
BravePropagator bravePropagator = new BravePropagator(tracing);
BraveTracer braveTracer = new BraveTracer(tracing.tracer(), braveCurrentTraceContext,
new BraveBaggageManager());
// add tracing handlers
List<TracingObservationHandler<?>> tracingHandlers =
Arrays.asList(new PropagatingSenderTracingObservationHandler<>(braveTracer, bravePropagator),
new PropagatingReceiverTracingObservationHandler<>(braveTracer, bravePropagator),
new DefaultTracingObservationHandler(braveTracer));
// create a registry
ObservationRegistry observationRegistry = ObservationRegistry.create();
// add the tracing handlers
observationRegistry.observationConfig().observationHandler(
new FirstMatchingCompositeObservationHandler(tracingHandlers));
// add the decorator
Server.builder()
.decorator(ObservationService.newDecorator(observationRegistry))
...
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic Function<? super HttpService,
ObservationService> newDecorator
(ObservationRegistry observationRegistry) Creates a new micrometer observation integratedHttpService
decorator using the specifiedObservationRegistry
instance.static Function<? super HttpService,
ObservationService> newDecorator
(ObservationRegistry observationRegistry, ObservationConvention<ServiceObservationContext> observationConvention) Creates a new micrometer observation integratedHttpService
decorator using the specifiedObservationRegistry
andObservationConvention
.serve
(ServiceRequestContext ctx, HttpRequest req) Serves an incomingRequest
.Methods inherited from class com.linecorp.armeria.server.SimpleDecoratingHttpService
exchangeType
Methods inherited from class com.linecorp.armeria.server.DecoratingService
serviceAdded, shouldCachePath
Methods inherited from class com.linecorp.armeria.common.util.AbstractUnwrappable
as, toString, unwrap, unwrapAll
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.linecorp.armeria.server.HttpService
decorate, decorate
Methods inherited from interface com.linecorp.armeria.server.Service
as, serviceAdded, shouldCachePath, unwrap
Methods inherited from interface com.linecorp.armeria.common.util.Unwrappable
equalsIgnoreWrapper, unwrapAll
-
Method Details
-
newDecorator
public static Function<? super HttpService,ObservationService> newDecorator(ObservationRegistry observationRegistry) Creates a new micrometer observation integratedHttpService
decorator using the specifiedObservationRegistry
instance. -
newDecorator
public static Function<? super HttpService,ObservationService> newDecorator(ObservationRegistry observationRegistry, ObservationConvention<ServiceObservationContext> observationConvention) Creates a new micrometer observation integratedHttpService
decorator using the specifiedObservationRegistry
andObservationConvention
. -
serve
Description copied from interface:Service
Serves an incomingRequest
.
-