File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
reactor-netty-core/src/main/java/reactor/netty Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2019-2022 VMware, Inc. or its affiliates, All Rights Reserved.
2+ * Copyright (c) 2019-2023 VMware, Inc. or its affiliates, All Rights Reserved.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
3939public class Metrics {
4040 public static final MeterRegistry REGISTRY = io .micrometer .core .instrument .Metrics .globalRegistry ;
4141 public static final String OBSERVATION_KEY = "micrometer.observation" ;
42- public static final ObservationRegistry OBSERVATION_REGISTRY = ObservationRegistry .create ();
42+ public static ObservationRegistry OBSERVATION_REGISTRY = ObservationRegistry .create ();
4343 static {
4444 OBSERVATION_REGISTRY .observationConfig ().observationHandler (
4545 new ObservationHandler .FirstMatchingCompositeObservationHandler (
@@ -313,6 +313,18 @@ public static String formatSocketAddress(@Nullable SocketAddress socketAddress)
313313 return null ;
314314 }
315315
316+ /**
317+ * Set the {@link ObservationRegistry} to use in Reactor Netty for tracing related purposes.
318+ *
319+ * @return the previously configured registry.
320+ * @since 1.1.6
321+ */
322+ public static ObservationRegistry observationRegistry (ObservationRegistry observationRegistry ) {
323+ ObservationRegistry previous = OBSERVATION_REGISTRY ;
324+ OBSERVATION_REGISTRY = observationRegistry ;
325+ return previous ;
326+ }
327+
316328 public static Context updateContext (Context context , Object observation ) {
317329 return context .hasKey (OBSERVATION_KEY ) ? context : context .put (OBSERVATION_KEY , observation );
318330 }
You can’t perform that action at this time.
0 commit comments