-
Notifications
You must be signed in to change notification settings - Fork 872
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply both serverAttributes & networkAttributes to Lettuce 5.1 (#10197)
Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
- Loading branch information
Showing
8 changed files
with
112 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 0 additions & 22 deletions
22
...in/java/io/opentelemetry/instrumentation/lettuce/v5_1/LettuceNetworkAttributesGetter.java
This file was deleted.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
...ain/java/io/opentelemetry/instrumentation/lettuce/v5_1/LettuceServerAttributesGetter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.instrumentation.lettuce.v5_1; | ||
|
||
import io.opentelemetry.instrumentation.api.semconv.network.NetworkAttributesGetter; | ||
import io.opentelemetry.instrumentation.api.semconv.network.ServerAttributesGetter; | ||
import io.opentelemetry.instrumentation.lettuce.v5_1.OpenTelemetryTracing.OpenTelemetryEndpoint; | ||
import java.net.InetSocketAddress; | ||
import javax.annotation.Nullable; | ||
|
||
class LettuceServerAttributesGetter | ||
implements ServerAttributesGetter<OpenTelemetryEndpoint>, | ||
NetworkAttributesGetter<OpenTelemetryEndpoint, Void> { | ||
|
||
@Nullable | ||
@Override | ||
public String getServerAddress(OpenTelemetryEndpoint request) { | ||
if (request.address != null) { | ||
return request.address.getHostString(); | ||
} | ||
return null; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public Integer getServerPort(OpenTelemetryEndpoint request) { | ||
if (request.address != null) { | ||
return request.address.getPort(); | ||
} | ||
return null; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public InetSocketAddress getNetworkPeerInetSocketAddress( | ||
OpenTelemetryEndpoint openTelemetryEndpoint, @Nullable Void unused) { | ||
return openTelemetryEndpoint.address; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.