Skip to content

Commit

Permalink
use a custom bindableservice to avoid extra buffer copies
Browse files Browse the repository at this point in the history
  • Loading branch information
ewhauser committed Dec 16, 2018
1 parent 8cdf6cc commit b2a24b0
Show file tree
Hide file tree
Showing 10 changed files with 274 additions and 107 deletions.
58 changes: 2 additions & 56 deletions zipkin-server-grpc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,84 +62,30 @@
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>${grpc.version}</version>
</dependency>

<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>${grpc.version}</version>
</dependency>

<!--
<dependency>
<groupId>com.linecorp.armeria</groupId>
<artifactId>armeria-grpc-shaded</artifactId>
<version>${armeria.grpc.version}</version>
</dependency>
-->

</dependencies>

<build>
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.5.0.Final</version>
</extension>
</extensions>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>${project.basedir}/src/main/proto</directory>
<targetPath>${project.build.directory}/proto</targetPath>
<includes>
<include>**/*.proto</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-proto</id>
<phase>generate-sources</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includeArtifactIds>zipkin-proto3</includeArtifactIds>
<includes>**/*.proto</includes>
<outputDirectory>${project.build.directory}/proto</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.5.1</version>
<configuration>
<protoSourceRoot>${project.build.directory}/proto</protoSourceRoot>
<protocArtifact>com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- disable retrolambda since this module uses java 8 types -->
<plugin>
<groupId>net.orfjackal.retrolambda</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,24 @@
*/
package zipkin2.server.grpc;

import com.linecorp.armeria.common.HttpRequest;
/*import com.linecorp.armeria.common.HttpRequest;
import com.linecorp.armeria.common.HttpResponse;
import com.linecorp.armeria.common.SessionProtocol;
import com.linecorp.armeria.common.logging.LogLevel;
import com.linecorp.armeria.server.Server;
import com.linecorp.armeria.server.ServerBuilder;
import com.linecorp.armeria.server.ServiceWithPathMappings;
import com.linecorp.armeria.server.docs.DocService;
import com.linecorp.armeria.server.grpc.GrpcServiceBuilder;
import com.linecorp.armeria.server.logging.LoggingServiceBuilder;
import com.linecorp.armeria.server.logging.LoggingServiceBuilder;*/
import io.grpc.BindableService;
import zipkin2.collector.CollectorComponent;

public class ArmeriaGrpcCollector extends GrpcCollector {

private final Server server;
//private final Server server;

ArmeriaGrpcCollector(BindableService service, int port) {
ServiceWithPathMappings<HttpRequest, HttpResponse> grpcService = new GrpcServiceBuilder()
/*ServiceWithPathMappings<HttpRequest, HttpResponse> grpcService = new GrpcServiceBuilder()
.addService(service)
.build();
Expand All @@ -42,24 +41,23 @@ public class ArmeriaGrpcCollector extends GrpcCollector {
.successfulResponseLogLevel(LogLevel.INFO)
.failureResponseLogLevel(LogLevel.WARN)
.newDecorator()));
sb.serviceUnder("/docs/", new DocService());
server = sb.build();
server = sb.build();*/
}

/**
* Start serving requests.
*/
public CollectorComponent start() {
server.start();
// server.start();
return this;
}

/**
* Stop serving requests and shutdown resources.
*/
public void close() {
server.stop();
// server.stop();
}

}
Loading

0 comments on commit b2a24b0

Please sign in to comment.