forked from helidon-io/helidon
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit based on in-progress work from Tomas.
Signed-off-by: Santiago Pericasgeertsen <[email protected]>
- Loading branch information
Showing
48 changed files
with
3,231 additions
and
11 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
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
23 changes: 23 additions & 0 deletions
23
...server/protocols/src/test/java/io/helidon/examples/webserver/protocols/ProtocolsTest.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,23 @@ | ||
/* | ||
* Copyright (c) 2024 Oracle and/or its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.helidon.examples.webserver.protocols; | ||
|
||
import io.helidon.webserver.testing.junit5.ServerTest; | ||
|
||
@ServerTest | ||
class ProtocolsTest { | ||
} |
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,85 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2018, 2024 Oracle and/or its affiliates. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>helidon-grpc-project</artifactId> | ||
<groupId>io.helidon.grpc</groupId> | ||
<version>4.0.0-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>helidon-grpc-core</artifactId> | ||
<name>Helidon gRPC related modules</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.helidon.common</groupId> | ||
<artifactId>helidon-common-context</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.helidon.common</groupId> | ||
<artifactId>helidon-common-config</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.helidon.tracing</groupId> | ||
<artifactId>helidon-tracing</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.grpc</groupId> | ||
<artifactId>grpc-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.grpc</groupId> | ||
<artifactId>grpc-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.grpc</groupId> | ||
<artifactId>grpc-protobuf</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.grpc</groupId> | ||
<artifactId>grpc-stub</artifactId> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>com.google.j2objc</groupId> | ||
<artifactId>j2objc-annotations</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>jakarta.inject</groupId> | ||
<artifactId>jakarta.inject-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>jakarta.annotation</groupId> | ||
<artifactId>jakarta.annotation-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-api</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest-all</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
52 changes: 52 additions & 0 deletions
52
grpc/core/src/main/java/io/helidon/grpc/core/ContextKeys.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,52 @@ | ||
/* | ||
* Copyright (c) 2019, 2021 Oracle and/or its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.helidon.grpc.core; | ||
|
||
import java.lang.reflect.Method; | ||
|
||
import io.grpc.Context; | ||
import io.grpc.Metadata; | ||
|
||
/** | ||
* A collection of common gRPC {@link Context.Key} and | ||
* {@link Metadata.Key} instances. | ||
*/ | ||
public final class ContextKeys { | ||
/** | ||
* The {@link Metadata.Key} to use to obtain the authorization data. | ||
*/ | ||
public static final Metadata.Key<String> AUTHORIZATION = | ||
Metadata.Key.of("Authorization", Metadata.ASCII_STRING_MARSHALLER); | ||
|
||
/** | ||
* The gRPC context key to use to obtain the Helidon {@link io.helidon.common.context.Context} | ||
* from the gRPC {@link Context}. | ||
*/ | ||
public static final Context.Key<io.helidon.common.context.Context> HELIDON_CONTEXT = | ||
Context.key(io.helidon.common.context.Context.class.getCanonicalName()); | ||
|
||
/** | ||
* The {@link Context.Key} to use to obtain the actual underlying rpc {@link Method}. | ||
*/ | ||
public static final Context.Key<Method> SERVICE_METHOD = Context.key(Method.class.getName()); | ||
|
||
/** | ||
* Private constructor for utility class. | ||
*/ | ||
private ContextKeys() { | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
grpc/core/src/main/java/io/helidon/grpc/core/GrpcTracingContext.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,45 @@ | ||
/* | ||
* Copyright (c) 2022 Oracle and/or its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.helidon.grpc.core; | ||
|
||
import java.util.Optional; | ||
|
||
import io.grpc.Context; | ||
import io.helidon.tracing.Span; | ||
|
||
/** | ||
* Contextual information related to Tracing. | ||
*/ | ||
public final class GrpcTracingContext { | ||
private static final String SPAN_KEY_NAME = "io.helidon.tracing.active-span"; | ||
|
||
/** | ||
* Context key for Span instance. | ||
*/ | ||
public static final Context.Key<Span> SPAN_KEY = Context.key(SPAN_KEY_NAME); | ||
|
||
/** | ||
* Get the current active span associated with the context. | ||
* | ||
* @return span if one is in current context | ||
*/ | ||
public static Optional<Span> activeSpan() { | ||
return Optional.ofNullable(SPAN_KEY.get()); | ||
} | ||
|
||
private GrpcTracingContext() { | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
grpc/core/src/main/java/io/helidon/grpc/core/GrpcTracingName.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,32 @@ | ||
/* | ||
* Copyright (c) 2022 Oracle and/or its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.helidon.grpc.core; | ||
|
||
import io.grpc.MethodDescriptor; | ||
|
||
/** | ||
* Name generator for span operation name. | ||
*/ | ||
@FunctionalInterface | ||
public interface GrpcTracingName { | ||
/** | ||
* Constructs a span's operation name from the gRPC method. | ||
* | ||
* @param method method to extract a name from | ||
* @return operation name | ||
*/ | ||
String name(MethodDescriptor<?, ?> method); | ||
} |
Oops, something went wrong.