未验证 提交 5cdd4ed5 编写于 作者: 静夜思朝颜's avatar 静夜思朝颜 提交者: GitHub

Introduce the Customized ALS Protocol for Satellite (#8193)

上级 842b5d92
......@@ -60,6 +60,7 @@ Release Notes.
* Upgrade grpc-java to 1.42.1 and protoc to 3.19.1 to allow using native Mac osx-aarch_64 artifacts.
* Fix TopologyQuery.loadEndpointRelation bug.
* Support using IoTDB as a new storage option.
* Add customized envoy ALS protocol receiver for satellite transmit batch data.
#### UI
......
......@@ -95,7 +95,12 @@ public class AccessLogServiceGRPCHandler extends AccessLogServiceGrpc.AccessLogS
@Override
public StreamObserver<StreamAccessLogsMessage> streamAccessLogs(
StreamObserver<StreamAccessLogsResponse> responseObserver) {
StreamObserver<StreamAccessLogsResponse> responseObserver) {
return streamAccessLogs(responseObserver, false);
}
public StreamObserver<StreamAccessLogsMessage> streamAccessLogs(
StreamObserver<StreamAccessLogsResponse> responseObserver, boolean alwaysAnalyzeIdentity) {
return new StreamObserver<StreamAccessLogsMessage>() {
private volatile boolean isFirst = true;
private Role role;
......@@ -105,7 +110,7 @@ public class AccessLogServiceGRPCHandler extends AccessLogServiceGrpc.AccessLogS
public void onNext(StreamAccessLogsMessage message) {
HistogramMetrics.Timer timer = histogram.createTimer();
try {
if (isFirst) {
if (isFirst || (alwaysAnalyzeIdentity && message.hasIdentifier())) {
identifier = message.getIdentifier();
isFirst = false;
role = Role.NONE;
......
......@@ -84,6 +84,7 @@ public class EnvoyMetricReceiverProvider extends ModuleProvider {
final AccessLogServiceGRPCHandler handler = new AccessLogServiceGRPCHandler(getManager(), config);
service.addHandler(handler);
service.addHandler(new AccessLogServiceGRPCHandlerV3(handler));
service.addHandler(new SatelliteAccessLogServiceGRPCHandlerV3(handler));
}
@Override
......
/*
* 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.StreamAccessLogsMessage;
import io.envoyproxy.envoy.service.accesslog.v3.StreamAccessLogsResponse;
import io.grpc.stub.StreamObserver;
import lombok.RequiredArgsConstructor;
import org.apache.skywalking.satellite.envoy.accesslog.v3.SatelliteAccessLogServiceGrpc;
@RequiredArgsConstructor
public class SatelliteAccessLogServiceGRPCHandlerV3 extends SatelliteAccessLogServiceGrpc.SatelliteAccessLogServiceImplBase {
private final AccessLogServiceGRPCHandler delegate;
@Override
public StreamObserver<StreamAccessLogsMessage> streamAccessLogs(StreamObserver<StreamAccessLogsResponse> responseObserver) {
return delegate.streamAccessLogs(responseObserver, true);
}
}
//
// 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.
//
syntax = "proto3";
package satellite.envoy.accesslog.v3;
import "envoy/service/accesslog/v3/als.proto";
option java_package = "org.apache.skywalking.satellite.envoy.accesslog.v3";
option java_outer_classname = "SatelliteAlsProto";
option java_multiple_files = true;
option java_generic_services = true;
// [#protodoc-title: Satellite gRPC Access Log Service (ALS)]
// The new Envoy ALS protocol, work for satellite transmit the ALS message to oap.
service SatelliteAccessLogService {
// Use the same parameters to transmit access log messages.
// The only difference is that the identity information (StreamAccessLogsMessage#identity) may occur on each message.
// Rely on the streaming messages are orderly, so there will be no problems with message processing.
// Therefore, when the satellite transmits the ALS message, it does not need to open, send and close the stream for each different identity (envoy).
// As a result, unnecessary streaming operation requests could be reduced, and the satellite becomes more stable when the satellite sends requests to the upstream.
// Especially when the number of envoys increases, the optimization becomes more obvious.
rpc StreamAccessLogs(stream .envoy.service.accesslog.v3.StreamAccessLogsMessage) returns (.envoy.service.accesslog.v3.StreamAccessLogsResponse) {
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册