Skip to content

Commit 2c1f91b

Browse files
authored
Rename HttpRequestAndChannel to NettyRequest (#15247)
1 parent d6fa7a6 commit 2c1f91b

File tree

44 files changed

+195
-203
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+195
-203
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
import org.jboss.netty.handler.codec.http.HttpRequest;
1111

1212
@AutoValue
13-
public abstract class HttpRequestAndChannel {
13+
public abstract class NettyRequest {
1414

15-
public static HttpRequestAndChannel create(HttpRequest request, Channel channel) {
16-
return new AutoValue_HttpRequestAndChannel(request, channel);
15+
public static NettyRequest create(HttpRequest request, Channel channel) {
16+
return new AutoValue_NettyRequest(request, channel);
1717
}
1818

1919
public abstract HttpRequest request();

instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/HttpClientRequestTracingHandler.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
import io.opentelemetry.context.Context;
1111
import io.opentelemetry.context.Scope;
1212
import io.opentelemetry.instrumentation.api.util.VirtualField;
13-
import io.opentelemetry.javaagent.instrumentation.netty.v3_8.HttpRequestAndChannel;
1413
import io.opentelemetry.javaagent.instrumentation.netty.v3_8.NettyConnectionContext;
14+
import io.opentelemetry.javaagent.instrumentation.netty.v3_8.NettyRequest;
1515
import org.jboss.netty.channel.Channel;
1616
import org.jboss.netty.channel.ChannelHandlerContext;
1717
import org.jboss.netty.channel.MessageEvent;
@@ -42,8 +42,7 @@ public void writeRequested(ChannelHandlerContext ctx, MessageEvent event) throws
4242
parentContext = Context.current();
4343
}
4444

45-
HttpRequestAndChannel request =
46-
HttpRequestAndChannel.create((HttpRequest) message, ctx.getChannel());
45+
NettyRequest request = NettyRequest.create((HttpRequest) message, ctx.getChannel());
4746
if (!instrumenter().shouldStart(parentContext, request)) {
4847
super.writeRequested(ctx, event);
4948
return;

instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/HttpRequestHeadersSetter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
package io.opentelemetry.javaagent.instrumentation.netty.v3_8.client;
77

88
import io.opentelemetry.context.propagation.TextMapSetter;
9-
import io.opentelemetry.javaagent.instrumentation.netty.v3_8.HttpRequestAndChannel;
9+
import io.opentelemetry.javaagent.instrumentation.netty.v3_8.NettyRequest;
1010
import javax.annotation.Nullable;
1111

12-
enum HttpRequestHeadersSetter implements TextMapSetter<HttpRequestAndChannel> {
12+
enum HttpRequestHeadersSetter implements TextMapSetter<NettyRequest> {
1313
INSTANCE;
1414

1515
@Override
16-
public void set(@Nullable HttpRequestAndChannel carrier, String key, String value) {
16+
public void set(@Nullable NettyRequest carrier, String key, String value) {
1717
carrier.request().headers().set(key, value);
1818
}
1919
}

instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyClientRequestAndContexts.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@
77

88
import com.google.auto.value.AutoValue;
99
import io.opentelemetry.context.Context;
10-
import io.opentelemetry.javaagent.instrumentation.netty.v3_8.HttpRequestAndChannel;
10+
import io.opentelemetry.javaagent.instrumentation.netty.v3_8.NettyRequest;
1111
import javax.annotation.Nullable;
1212

1313
@AutoValue
1414
abstract class NettyClientRequestAndContexts {
1515

1616
public static NettyClientRequestAndContexts create(
17-
@Nullable Context parentContext, Context context, HttpRequestAndChannel request) {
17+
@Nullable Context parentContext, Context context, NettyRequest request) {
1818
return new AutoValue_NettyClientRequestAndContexts(parentContext, context, request);
1919
}
2020

2121
abstract Context parentContext();
2222

2323
abstract Context context();
2424

25-
abstract HttpRequestAndChannel request();
25+
abstract NettyRequest request();
2626
}

instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyClientSingletons.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import io.opentelemetry.instrumentation.netty.common.internal.NettyErrorHolder;
1515
import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig;
1616
import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenters;
17-
import io.opentelemetry.javaagent.instrumentation.netty.v3_8.HttpRequestAndChannel;
17+
import io.opentelemetry.javaagent.instrumentation.netty.v3_8.NettyRequest;
1818
import io.opentelemetry.semconv.SchemaUrls;
1919
import org.jboss.netty.channel.Channel;
2020
import org.jboss.netty.handler.codec.http.HttpResponse;
@@ -23,7 +23,7 @@ public final class NettyClientSingletons {
2323

2424
private static final String INSTRUMENTATION_NAME = "io.opentelemetry.netty-3.8";
2525

26-
private static final Instrumenter<HttpRequestAndChannel, HttpResponse> INSTRUMENTER;
26+
private static final Instrumenter<NettyRequest, HttpResponse> INSTRUMENTER;
2727
private static final Instrumenter<NettyConnectionRequest, Channel> CONNECTION_INSTRUMENTER;
2828

2929
static {
@@ -50,7 +50,7 @@ public final class NettyClientSingletons {
5050
.buildInstrumenter(SpanKindExtractor.alwaysClient());
5151
}
5252

53-
public static Instrumenter<HttpRequestAndChannel, HttpResponse> instrumenter() {
53+
public static Instrumenter<NettyRequest, HttpResponse> instrumenter() {
5454
return INSTRUMENTER;
5555
}
5656

instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyHttpClientAttributesGetter.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import static io.opentelemetry.javaagent.instrumentation.netty.v3_8.util.HttpSchemeUtil.getScheme;
99

1010
import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesGetter;
11-
import io.opentelemetry.javaagent.instrumentation.netty.v3_8.HttpRequestAndChannel;
11+
import io.opentelemetry.javaagent.instrumentation.netty.v3_8.NettyRequest;
1212
import io.opentelemetry.javaagent.instrumentation.netty.v3_8.util.ChannelUtil;
1313
import java.net.InetSocketAddress;
1414
import java.net.SocketAddress;
@@ -20,11 +20,11 @@
2020
import org.jboss.netty.handler.codec.http.HttpVersion;
2121

2222
final class NettyHttpClientAttributesGetter
23-
implements HttpClientAttributesGetter<HttpRequestAndChannel, HttpResponse> {
23+
implements HttpClientAttributesGetter<NettyRequest, HttpResponse> {
2424

2525
@Override
2626
@Nullable
27-
public String getUrlFull(HttpRequestAndChannel requestAndChannel) {
27+
public String getUrlFull(NettyRequest requestAndChannel) {
2828
try {
2929
String hostHeader = getHost(requestAndChannel);
3030
String target = requestAndChannel.request().getUri();
@@ -38,48 +38,48 @@ public String getUrlFull(HttpRequestAndChannel requestAndChannel) {
3838
}
3939
}
4040

41-
private String getHost(HttpRequestAndChannel requestAndChannel) {
41+
private String getHost(NettyRequest requestAndChannel) {
4242
List<String> values = getHttpRequestHeader(requestAndChannel, "host");
4343
return values.isEmpty() ? null : values.get(0);
4444
}
4545

4646
@Override
47-
public String getHttpRequestMethod(HttpRequestAndChannel requestAndChannel) {
47+
public String getHttpRequestMethod(NettyRequest requestAndChannel) {
4848
return requestAndChannel.request().getMethod().getName();
4949
}
5050

5151
@Override
52-
public List<String> getHttpRequestHeader(HttpRequestAndChannel requestAndChannel, String name) {
52+
public List<String> getHttpRequestHeader(NettyRequest requestAndChannel, String name) {
5353
return requestAndChannel.request().headers().getAll(name);
5454
}
5555

5656
@Override
5757
public Integer getHttpResponseStatusCode(
58-
HttpRequestAndChannel requestAndChannel, HttpResponse response, @Nullable Throwable error) {
58+
NettyRequest requestAndChannel, HttpResponse response, @Nullable Throwable error) {
5959
return response.getStatus().getCode();
6060
}
6161

6262
@Override
6363
public List<String> getHttpResponseHeader(
64-
HttpRequestAndChannel requestAndChannel, HttpResponse response, String name) {
64+
NettyRequest requestAndChannel, HttpResponse response, String name) {
6565
return response.headers().getAll(name);
6666
}
6767

6868
@Override
6969
public String getNetworkTransport(
70-
HttpRequestAndChannel requestAndChannel, @Nullable HttpResponse response) {
70+
NettyRequest requestAndChannel, @Nullable HttpResponse response) {
7171
return ChannelUtil.getNetworkTransport(requestAndChannel.channel());
7272
}
7373

7474
@Override
7575
public String getNetworkProtocolName(
76-
HttpRequestAndChannel requestAndChannel, @Nullable HttpResponse httpResponse) {
76+
NettyRequest requestAndChannel, @Nullable HttpResponse httpResponse) {
7777
return requestAndChannel.request().getProtocolVersion().getProtocolName();
7878
}
7979

8080
@Override
8181
public String getNetworkProtocolVersion(
82-
HttpRequestAndChannel requestAndChannel, @Nullable HttpResponse httpResponse) {
82+
NettyRequest requestAndChannel, @Nullable HttpResponse httpResponse) {
8383
HttpVersion version = requestAndChannel.request().getProtocolVersion();
8484
if (version.getMinorVersion() == 0) {
8585
return Integer.toString(version.getMajorVersion());
@@ -89,20 +89,20 @@ public String getNetworkProtocolVersion(
8989

9090
@Nullable
9191
@Override
92-
public String getServerAddress(HttpRequestAndChannel requestAndChannel) {
92+
public String getServerAddress(NettyRequest requestAndChannel) {
9393
return null;
9494
}
9595

9696
@Nullable
9797
@Override
98-
public Integer getServerPort(HttpRequestAndChannel requestAndChannel) {
98+
public Integer getServerPort(NettyRequest requestAndChannel) {
9999
return null;
100100
}
101101

102102
@Override
103103
@Nullable
104104
public InetSocketAddress getNetworkPeerInetSocketAddress(
105-
HttpRequestAndChannel requestAndChannel, @Nullable HttpResponse response) {
105+
NettyRequest requestAndChannel, @Nullable HttpResponse response) {
106106
SocketAddress address = requestAndChannel.channel().getRemoteAddress();
107107
if (address instanceof InetSocketAddress) {
108108
return (InetSocketAddress) address;

instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/server/HttpServerRequestTracingHandler.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import io.opentelemetry.context.Context;
1111
import io.opentelemetry.context.Scope;
1212
import io.opentelemetry.instrumentation.api.util.VirtualField;
13-
import io.opentelemetry.javaagent.instrumentation.netty.v3_8.HttpRequestAndChannel;
13+
import io.opentelemetry.javaagent.instrumentation.netty.v3_8.NettyRequest;
1414
import org.jboss.netty.channel.Channel;
1515
import org.jboss.netty.channel.ChannelHandlerContext;
1616
import org.jboss.netty.channel.MessageEvent;
@@ -38,8 +38,7 @@ public void messageReceived(ChannelHandlerContext ctx, MessageEvent event) throw
3838
}
3939

4040
Context parentContext = Context.current();
41-
HttpRequestAndChannel request =
42-
HttpRequestAndChannel.create((HttpRequest) message, ctx.getChannel());
41+
NettyRequest request = NettyRequest.create((HttpRequest) message, ctx.getChannel());
4342
if (!instrumenter().shouldStart(parentContext, request)) {
4443
super.messageReceived(ctx, event);
4544
return;

instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/server/HttpServerResponseTracingHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import io.opentelemetry.instrumentation.api.util.VirtualField;
1313
import io.opentelemetry.instrumentation.netty.common.internal.NettyErrorHolder;
1414
import io.opentelemetry.javaagent.bootstrap.http.HttpServerResponseCustomizerHolder;
15-
import io.opentelemetry.javaagent.instrumentation.netty.v3_8.HttpRequestAndChannel;
15+
import io.opentelemetry.javaagent.instrumentation.netty.v3_8.NettyRequest;
1616
import org.jboss.netty.channel.Channel;
1717
import org.jboss.netty.channel.ChannelHandlerContext;
1818
import org.jboss.netty.channel.MessageEvent;
@@ -34,7 +34,7 @@ public void writeRequested(ChannelHandlerContext ctx, MessageEvent msg) throws E
3434
}
3535

3636
Context context = requestAndContext.context();
37-
HttpRequestAndChannel request = requestAndContext.request();
37+
NettyRequest request = requestAndContext.request();
3838
HttpResponse response = (HttpResponse) msg.getMessage();
3939
customizeResponse(context, response);
4040

instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/server/NettyHeadersGetter.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,26 @@
66
package io.opentelemetry.javaagent.instrumentation.netty.v3_8.server;
77

88
import io.opentelemetry.context.propagation.TextMapGetter;
9-
import io.opentelemetry.javaagent.instrumentation.netty.v3_8.HttpRequestAndChannel;
9+
import io.opentelemetry.javaagent.instrumentation.netty.v3_8.NettyRequest;
1010
import java.util.Iterator;
1111
import javax.annotation.Nullable;
1212

13-
enum NettyHeadersGetter implements TextMapGetter<HttpRequestAndChannel> {
13+
enum NettyHeadersGetter implements TextMapGetter<NettyRequest> {
1414
INSTANCE;
1515

1616
@Override
17-
public Iterable<String> keys(HttpRequestAndChannel requestAndChannel) {
17+
public Iterable<String> keys(NettyRequest requestAndChannel) {
1818
return requestAndChannel.request().headers().names();
1919
}
2020

2121
@Nullable
2222
@Override
23-
public String get(@Nullable HttpRequestAndChannel requestAndChannel, String s) {
23+
public String get(@Nullable NettyRequest requestAndChannel, String s) {
2424
return requestAndChannel.request().headers().get(s);
2525
}
2626

2727
@Override
28-
public Iterator<String> getAll(@Nullable HttpRequestAndChannel carrier, String key) {
28+
public Iterator<String> getAll(@Nullable NettyRequest carrier, String key) {
2929
return carrier.request().headers().getAll(key).iterator();
3030
}
3131
}

instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/server/NettyHttpServerAttributesGetter.java

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
package io.opentelemetry.javaagent.instrumentation.netty.v3_8.server;
77

88
import io.opentelemetry.instrumentation.api.semconv.http.HttpServerAttributesGetter;
9-
import io.opentelemetry.javaagent.instrumentation.netty.v3_8.HttpRequestAndChannel;
9+
import io.opentelemetry.javaagent.instrumentation.netty.v3_8.NettyRequest;
1010
import io.opentelemetry.javaagent.instrumentation.netty.v3_8.util.ChannelUtil;
1111
import io.opentelemetry.javaagent.instrumentation.netty.v3_8.util.HttpSchemeUtil;
1212
import java.net.InetSocketAddress;
@@ -17,64 +17,63 @@
1717
import org.jboss.netty.handler.codec.http.HttpVersion;
1818

1919
final class NettyHttpServerAttributesGetter
20-
implements HttpServerAttributesGetter<HttpRequestAndChannel, HttpResponse> {
20+
implements HttpServerAttributesGetter<NettyRequest, HttpResponse> {
2121

2222
@Override
23-
public String getHttpRequestMethod(HttpRequestAndChannel requestAndChannel) {
23+
public String getHttpRequestMethod(NettyRequest requestAndChannel) {
2424
return requestAndChannel.request().getMethod().getName();
2525
}
2626

2727
@Override
28-
public List<String> getHttpRequestHeader(HttpRequestAndChannel requestAndChannel, String name) {
28+
public List<String> getHttpRequestHeader(NettyRequest requestAndChannel, String name) {
2929
return requestAndChannel.request().headers().getAll(name);
3030
}
3131

3232
@Override
3333
public Integer getHttpResponseStatusCode(
34-
HttpRequestAndChannel requestAndChannel, HttpResponse response, @Nullable Throwable error) {
34+
NettyRequest requestAndChannel, HttpResponse response, @Nullable Throwable error) {
3535
return response.getStatus().getCode();
3636
}
3737

3838
@Override
3939
public List<String> getHttpResponseHeader(
40-
HttpRequestAndChannel requestAndChannel, HttpResponse response, String name) {
40+
NettyRequest requestAndChannel, HttpResponse response, String name) {
4141
return response.headers().getAll(name);
4242
}
4343

4444
@Override
45-
public String getUrlScheme(HttpRequestAndChannel requestAndChannel) {
45+
public String getUrlScheme(NettyRequest requestAndChannel) {
4646
return HttpSchemeUtil.getScheme(requestAndChannel);
4747
}
4848

4949
@Override
50-
public String getUrlPath(HttpRequestAndChannel requestAndChannel) {
50+
public String getUrlPath(NettyRequest requestAndChannel) {
5151
String fullPath = requestAndChannel.request().getUri();
5252
int separatorPos = fullPath.indexOf('?');
5353
return separatorPos == -1 ? fullPath : fullPath.substring(0, separatorPos);
5454
}
5555

5656
@Override
57-
public String getUrlQuery(HttpRequestAndChannel requestAndChannel) {
57+
public String getUrlQuery(NettyRequest requestAndChannel) {
5858
String fullPath = requestAndChannel.request().getUri();
5959
int separatorPos = fullPath.indexOf('?');
6060
return separatorPos == -1 ? null : fullPath.substring(separatorPos + 1);
6161
}
6262

6363
@Override
64-
public String getNetworkTransport(
65-
HttpRequestAndChannel requestAndChannel, HttpResponse response) {
64+
public String getNetworkTransport(NettyRequest requestAndChannel, HttpResponse response) {
6665
return ChannelUtil.getNetworkTransport(requestAndChannel.channel());
6766
}
6867

6968
@Override
7069
public String getNetworkProtocolName(
71-
HttpRequestAndChannel requestAndChannel, @Nullable HttpResponse response) {
70+
NettyRequest requestAndChannel, @Nullable HttpResponse response) {
7271
return requestAndChannel.request().getProtocolVersion().getProtocolName();
7372
}
7473

7574
@Override
7675
public String getNetworkProtocolVersion(
77-
HttpRequestAndChannel requestAndChannel, @Nullable HttpResponse response) {
76+
NettyRequest requestAndChannel, @Nullable HttpResponse response) {
7877
HttpVersion version = requestAndChannel.request().getProtocolVersion();
7978
if (version.getMinorVersion() == 0) {
8079
return Integer.toString(version.getMajorVersion());
@@ -85,7 +84,7 @@ public String getNetworkProtocolVersion(
8584
@Override
8685
@Nullable
8786
public InetSocketAddress getNetworkPeerInetSocketAddress(
88-
HttpRequestAndChannel requestAndChannel, @Nullable HttpResponse response) {
87+
NettyRequest requestAndChannel, @Nullable HttpResponse response) {
8988
SocketAddress address = requestAndChannel.channel().getRemoteAddress();
9089
if (address instanceof InetSocketAddress) {
9190
return (InetSocketAddress) address;
@@ -96,7 +95,7 @@ public InetSocketAddress getNetworkPeerInetSocketAddress(
9695
@Nullable
9796
@Override
9897
public InetSocketAddress getNetworkLocalInetSocketAddress(
99-
HttpRequestAndChannel requestAndChannel, @Nullable HttpResponse response) {
98+
NettyRequest requestAndChannel, @Nullable HttpResponse response) {
10099
SocketAddress address = requestAndChannel.channel().getLocalAddress();
101100
if (address instanceof InetSocketAddress) {
102101
return (InetSocketAddress) address;

0 commit comments

Comments
 (0)