Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Envoy {AccessLog,Metrics}Service API V3
- Loading branch information
1 parent
62b690b
commit a1c543b
Showing
38 changed files
with
2,238 additions
and
374 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
62 changes: 62 additions & 0 deletions
62
...n/java/org/apache/skywalking/oap/server/receiver/envoy/AccessLogServiceV2GRPCHandler.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,62 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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 org.apache.skywalking.oap.server.receiver.envoy; | ||
|
||
import io.envoyproxy.envoy.service.accesslog.v2.AccessLogServiceGrpc; | ||
import io.envoyproxy.envoy.service.accesslog.v2.StreamAccessLogsMessage; | ||
import io.envoyproxy.envoy.service.accesslog.v2.StreamAccessLogsResponse; | ||
import io.grpc.stub.StreamObserver; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.skywalking.oap.server.library.module.ModuleManager; | ||
import org.apache.skywalking.oap.server.library.module.ModuleStartException; | ||
|
||
@Slf4j | ||
public class AccessLogServiceV2GRPCHandler extends AccessLogServiceGrpc.AccessLogServiceImplBase { | ||
private final AccessLogServiceGRPCHandler handler; | ||
|
||
public AccessLogServiceV2GRPCHandler(final ModuleManager manager, final EnvoyMetricReceiverConfig config) throws ModuleStartException { | ||
handler = new AccessLogServiceGRPCHandler(manager, config); | ||
} | ||
|
||
@Override | ||
public StreamObserver<StreamAccessLogsMessage> streamAccessLogs(final StreamObserver<StreamAccessLogsResponse> responseObserver) { | ||
handler.reset(); | ||
|
||
return new StreamObserver<StreamAccessLogsMessage>() { | ||
@Override | ||
public void onNext(StreamAccessLogsMessage message) { | ||
handler.handle(message); | ||
} | ||
|
||
@Override | ||
public void onError(Throwable throwable) { | ||
log.error("Error in receiving access log from envoy", throwable); | ||
responseObserver.onCompleted(); | ||
handler.reset(); | ||
} | ||
|
||
@Override | ||
public void onCompleted() { | ||
responseObserver.onNext(StreamAccessLogsResponse.newBuilder().build()); | ||
responseObserver.onCompleted(); | ||
handler.reset(); | ||
} | ||
}; | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
...n/java/org/apache/skywalking/oap/server/receiver/envoy/AccessLogServiceV3GRPCHandler.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,61 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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 org.apache.skywalking.oap.server.receiver.envoy; | ||
|
||
import io.envoyproxy.envoy.service.accesslog.v3.AccessLogServiceGrpc; | ||
import io.envoyproxy.envoy.service.accesslog.v3.StreamAccessLogsMessage; | ||
import io.envoyproxy.envoy.service.accesslog.v3.StreamAccessLogsResponse; | ||
import io.grpc.stub.StreamObserver; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.skywalking.oap.server.library.module.ModuleManager; | ||
import org.apache.skywalking.oap.server.library.module.ModuleStartException; | ||
|
||
@Slf4j | ||
public class AccessLogServiceV3GRPCHandler extends AccessLogServiceGrpc.AccessLogServiceImplBase { | ||
private final AccessLogServiceGRPCHandler handler; | ||
|
||
public AccessLogServiceV3GRPCHandler(final ModuleManager manager, final EnvoyMetricReceiverConfig config) throws ModuleStartException { | ||
handler = new AccessLogServiceGRPCHandler(manager, config); | ||
} | ||
|
||
public StreamObserver<StreamAccessLogsMessage> streamAccessLogs(final StreamObserver<StreamAccessLogsResponse> responseObserver) { | ||
handler.reset(); | ||
|
||
return new StreamObserver<StreamAccessLogsMessage>() { | ||
@Override | ||
public void onNext(StreamAccessLogsMessage message) { | ||
handler.handle(message); | ||
} | ||
|
||
@Override | ||
public void onError(Throwable throwable) { | ||
log.error("Error in receiving access log from envoy", throwable); | ||
responseObserver.onCompleted(); | ||
handler.reset(); | ||
} | ||
|
||
@Override | ||
public void onCompleted() { | ||
responseObserver.onNext(StreamAccessLogsResponse.newBuilder().build()); | ||
responseObserver.onCompleted(); | ||
handler.reset(); | ||
} | ||
}; | ||
} | ||
} |
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.