Skip to content

Commit e02e722

Browse files
committed
Experimental
1 parent ad6fe93 commit e02e722

File tree

3 files changed

+291
-0
lines changed

3 files changed

+291
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/*
2+
* Copyright (c) 2023 VMware, Inc. or its affiliates, All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package reactor.netty.observability;
17+
18+
import io.micrometer.observation.Observation;
19+
import io.micrometer.tracing.Span;
20+
import io.micrometer.tracing.Tracer;
21+
import io.micrometer.tracing.handler.TracingObservationHandler;
22+
23+
public final class ReactorNettyDelegatingTracingObservationHandler implements TracingObservationHandler<Observation.Context> {
24+
25+
final ReactorNettyTracingObservationHandler delegate;
26+
27+
public ReactorNettyDelegatingTracingObservationHandler(Tracer tracer) {
28+
this.delegate = new ReactorNettyTracingObservationHandler(tracer);
29+
}
30+
31+
@Override
32+
public Span getParentSpan(Observation.ContextView context) {
33+
return delegate.getParentSpan(context);
34+
}
35+
36+
@Override
37+
public Span getRequiredSpan(Observation.Context context) {
38+
return delegate.getRequiredSpan(context);
39+
}
40+
41+
@Override
42+
public String getSpanName(Observation.Context context) {
43+
return delegate.getSpanName(context);
44+
}
45+
46+
@Override
47+
public Tracer getTracer() {
48+
return delegate.getTracer();
49+
}
50+
51+
@Override
52+
public TracingContext getTracingContext(Observation.Context context) {
53+
return delegate.getTracingContext(context);
54+
}
55+
56+
@Override
57+
public void onError(Observation.Context context) {
58+
delegate.onError(context);
59+
}
60+
61+
@Override
62+
public void onEvent(Observation.Event event, Observation.Context context) {
63+
delegate.onEvent(event, context);
64+
}
65+
66+
@Override
67+
public void onScopeClosed(Observation.Context context) {
68+
delegate.onScopeClosed(context);
69+
}
70+
71+
@Override
72+
public void onScopeOpened(Observation.Context context) {
73+
delegate.onScopeOpened(context);
74+
}
75+
76+
@Override
77+
public void onStart(Observation.Context context) {
78+
delegate.onStart(context);
79+
}
80+
81+
@Override
82+
public void onStop(Observation.Context context) {
83+
delegate.onStop(context);
84+
}
85+
86+
@Override
87+
public boolean supportsContext(Observation.Context handlerContext) {
88+
return delegate.supportsContext(handlerContext);
89+
}
90+
91+
@Override
92+
public void tagSpan(Observation.Context context, Span span) {
93+
delegate.tagSpan(context, span);
94+
}
95+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/*
2+
* Copyright (c) 2023 VMware, Inc. or its affiliates, All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package reactor.netty.http.observability;
17+
18+
import io.micrometer.observation.Observation;
19+
import io.micrometer.observation.transport.ReceiverContext;
20+
import io.micrometer.tracing.Span;
21+
import io.micrometer.tracing.Tracer;
22+
import io.micrometer.tracing.handler.TracingObservationHandler;
23+
import io.micrometer.tracing.propagation.Propagator;
24+
import io.netty.handler.codec.http.HttpRequest;
25+
26+
public final class ReactorNettyDelegatingPropagatingReceiver implements TracingObservationHandler<ReceiverContext<HttpRequest>> {
27+
28+
final ReactorNettyPropagatingReceiverTracingObservationHandler delegate;
29+
30+
public ReactorNettyDelegatingPropagatingReceiver(Tracer tracer, Propagator propagator) {
31+
this.delegate = new ReactorNettyPropagatingReceiverTracingObservationHandler(tracer, propagator);
32+
}
33+
34+
@Override
35+
public Span getParentSpan(Observation.ContextView context) {
36+
return delegate.getParentSpan(context);
37+
}
38+
39+
@Override
40+
public Span getRequiredSpan(ReceiverContext<HttpRequest> context) {
41+
return delegate.getRequiredSpan(context);
42+
}
43+
44+
@Override
45+
public String getSpanName(ReceiverContext<HttpRequest> context) {
46+
return delegate.getSpanName(context);
47+
}
48+
49+
@Override
50+
public Tracer getTracer() {
51+
return delegate.getTracer();
52+
}
53+
54+
@Override
55+
public TracingContext getTracingContext(ReceiverContext<HttpRequest> context) {
56+
return delegate.getTracingContext(context);
57+
}
58+
59+
@Override
60+
public void onError(ReceiverContext<HttpRequest> context) {
61+
delegate.onError(context);
62+
}
63+
64+
@Override
65+
public void onEvent(Observation.Event event, ReceiverContext<HttpRequest> context) {
66+
delegate.onEvent(event, context);
67+
}
68+
69+
@Override
70+
public void onScopeClosed(ReceiverContext<HttpRequest> context) {
71+
delegate.onScopeClosed(context);
72+
}
73+
74+
@Override
75+
public void onScopeOpened(ReceiverContext<HttpRequest> context) {
76+
delegate.onScopeOpened(context);
77+
}
78+
79+
@Override
80+
public void onStart(ReceiverContext<HttpRequest> context) {
81+
delegate.onStart(context);
82+
}
83+
84+
@Override
85+
public void onStop(ReceiverContext<HttpRequest> context) {
86+
delegate.onStop(context);
87+
}
88+
89+
@Override
90+
public boolean supportsContext(Observation.Context context) {
91+
return delegate.supportsContext(context);
92+
}
93+
94+
@Override
95+
public void tagSpan(ReceiverContext<HttpRequest> context, Span span) {
96+
delegate.tagSpan(context, span);
97+
}
98+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/*
2+
* Copyright (c) 2023 VMware, Inc. or its affiliates, All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package reactor.netty.http.observability;
17+
18+
import io.micrometer.observation.Observation;
19+
import io.micrometer.observation.transport.SenderContext;
20+
import io.micrometer.tracing.Span;
21+
import io.micrometer.tracing.Tracer;
22+
import io.micrometer.tracing.handler.TracingObservationHandler;
23+
import io.micrometer.tracing.propagation.Propagator;
24+
import io.netty.handler.codec.http.HttpRequest;
25+
26+
public final class ReactorNettyDelegatingPropagatingSender implements TracingObservationHandler<SenderContext<HttpRequest>> {
27+
28+
final ReactorNettyPropagatingSenderTracingObservationHandler delegate;
29+
30+
public ReactorNettyDelegatingPropagatingSender(Tracer tracer, Propagator propagator) {
31+
this.delegate = new ReactorNettyPropagatingSenderTracingObservationHandler(tracer, propagator);
32+
}
33+
34+
@Override
35+
public Span getParentSpan(Observation.ContextView context) {
36+
return delegate.getParentSpan(context);
37+
}
38+
39+
@Override
40+
public Span getRequiredSpan(SenderContext<HttpRequest> context) {
41+
return delegate.getRequiredSpan(context);
42+
}
43+
44+
@Override
45+
public String getSpanName(SenderContext<HttpRequest> context) {
46+
return delegate.getSpanName(context);
47+
}
48+
49+
@Override
50+
public Tracer getTracer() {
51+
return delegate.getTracer();
52+
}
53+
54+
@Override
55+
public TracingContext getTracingContext(SenderContext<HttpRequest> context) {
56+
return delegate.getTracingContext(context);
57+
}
58+
59+
@Override
60+
public void onError(SenderContext<HttpRequest> context) {
61+
delegate.onError(context);
62+
}
63+
64+
@Override
65+
public void onEvent(Observation.Event event, SenderContext<HttpRequest> context) {
66+
delegate.onEvent(event, context);
67+
}
68+
69+
@Override
70+
public void onScopeClosed(SenderContext<HttpRequest> context) {
71+
delegate.onScopeClosed(context);
72+
}
73+
74+
@Override
75+
public void onScopeOpened(SenderContext<HttpRequest> context) {
76+
delegate.onScopeOpened(context);
77+
}
78+
79+
@Override
80+
public void onStart(SenderContext<HttpRequest> context) {
81+
delegate.onStart(context);
82+
}
83+
84+
@Override
85+
public void onStop(SenderContext<HttpRequest> context) {
86+
delegate.onStop(context);
87+
}
88+
89+
@Override
90+
public boolean supportsContext(Observation.Context context) {
91+
return delegate.supportsContext(context);
92+
}
93+
94+
@Override
95+
public void tagSpan(SenderContext<HttpRequest> context, Span span) {
96+
delegate.tagSpan(context, span);
97+
}
98+
}

0 commit comments

Comments
 (0)