-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support transmit eBPF Access Log Protocol (#150)
- Loading branch information
Showing
14 changed files
with
367 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Changes by Version | ||
================== | ||
Release Notes. | ||
|
||
1.2.0 | ||
------------------ | ||
#### Features | ||
* Introduce `pprof` module. | ||
* Support export multiple `telemetry` service. | ||
* Update the base docker image. | ||
* Add timeout configuration for gRPC client. | ||
* Reduce log print when the enqueue data to the pipeline error. | ||
* Support transmit the Continuous Profiling protocol. | ||
|
||
#### Bug Fixes | ||
* Fix [CVE-2022-41721](https://avd.aquasec.com/nvd/cve-2022-41721). | ||
* Use Go 19 to build the Docker image to fix CVEs. | ||
|
||
#### Issues and PR | ||
- All issues are [here](https://github.com/apache/skywalking/milestone/170?closed=1) | ||
- All and pull requests are [here](https://github.com/apache/skywalking-satellite/pulls?q=is%3Apr+milestone%3A1.2.0+is%3Aclosed) |
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
9 changes: 9 additions & 0 deletions
9
docs/en/setup/plugins/forwarder_native-ebpf-accesslog-grpc-forwarder.md
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,9 @@ | ||
# Forwarder/native-ebpf-accesslog-grpc-forwarder | ||
## Description | ||
This is a synchronization grpc forwarder with the SkyWalking native eBPF access log protocol. | ||
## DefaultConfig | ||
```yaml``` | ||
## Configuration | ||
|Name|Type|Description| | ||
|----|----|-----------| | ||
|
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
11 changes: 11 additions & 0 deletions
11
docs/en/setup/plugins/receiver_grpc-native-ebpf-accesslog-receiver.md
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,11 @@ | ||
# Receiver/grpc-native-ebpf-accesslog-receiver | ||
## Description | ||
This is a receiver for SkyWalking native accesslog format, which is defined at https://github.com/apache/skywalking-data-collect-protocol/blob/master/ebpf/accesslog.proto. | ||
## Support Forwarders | ||
- [native-ebpf-accesslog-grpc-forwarder](forwarder_native-ebpf-accesslog-grpc-forwarder.md) | ||
## DefaultConfig | ||
```yaml``` | ||
## Configuration | ||
|Name|Type|Description| | ||
|----|----|-----------| | ||
|
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
124 changes: 124 additions & 0 deletions
124
plugins/forwarder/grpc/nativeebpfaccesslog/forwarder.go
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,124 @@ | ||
// Licensed to 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. Apache Software Foundation (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 nativeebpfaccesslog | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"io" | ||
"reflect" | ||
|
||
"google.golang.org/grpc" | ||
|
||
"github.com/apache/skywalking-satellite/internal/pkg/config" | ||
"github.com/apache/skywalking-satellite/internal/pkg/log" | ||
"github.com/apache/skywalking-satellite/internal/satellite/event" | ||
server_grpc "github.com/apache/skywalking-satellite/plugins/server/grpc" | ||
|
||
v3 "skywalking.apache.org/repo/goapi/collect/ebpf/accesslog/v3" | ||
v1 "skywalking.apache.org/repo/goapi/satellite/data/v1" | ||
) | ||
|
||
const ( | ||
Name = "native-ebpf-accesslog-grpc-forwarder" | ||
ShowName = "GRPC Native EBFP Access Log Forwarder" | ||
) | ||
|
||
type Forwarder struct { | ||
config.CommonFields | ||
|
||
accessClient v3.EBPFAccessLogServiceClient | ||
} | ||
|
||
func (f *Forwarder) Name() string { | ||
return Name | ||
} | ||
|
||
func (f *Forwarder) ShowName() string { | ||
return ShowName | ||
} | ||
|
||
func (f *Forwarder) Description() string { | ||
return "This is a synchronization grpc forwarder with the SkyWalking native eBPF access log protocol." | ||
} | ||
|
||
func (f *Forwarder) DefaultConfig() string { | ||
return `` | ||
} | ||
|
||
func (f *Forwarder) Prepare(connection interface{}) error { | ||
client, ok := connection.(*grpc.ClientConn) | ||
if !ok { | ||
return fmt.Errorf("the %s only accepts a grpc client, but received a %s", | ||
f.Name(), reflect.TypeOf(connection).String()) | ||
} | ||
f.accessClient = v3.NewEBPFAccessLogServiceClient(client) | ||
return nil | ||
} | ||
|
||
func (f *Forwarder) Forward(batch event.BatchEvents) (err error) { | ||
var stream v3.EBPFAccessLogService_CollectClient | ||
for _, e := range batch { | ||
data, ok := e.GetData().(*v1.SniffData_EBPFAccessLogList) | ||
if !ok { | ||
continue | ||
} | ||
|
||
stream, err = f.accessClient.Collect(context.Background()) | ||
if err != nil { | ||
log.Logger.Errorf("open grpc stream error: %v", err) | ||
return err | ||
} | ||
|
||
streamClosed := false | ||
for _, message := range data.EBPFAccessLogList.Messages { | ||
err := stream.SendMsg(server_grpc.NewOriginalData(message)) | ||
if err != nil { | ||
log.Logger.Errorf("%s send log data error: %v", f.Name(), err) | ||
f.closeStream(stream) | ||
streamClosed = true | ||
break | ||
} | ||
} | ||
|
||
if !streamClosed { | ||
f.closeStream(stream) | ||
} | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (f *Forwarder) closeStream(stream v3.EBPFAccessLogService_CollectClient) { | ||
_, err := stream.CloseAndRecv() | ||
if err != nil && err != io.EOF { | ||
log.Logger.Errorf("%s close stream error: %v", f.Name(), err) | ||
} | ||
} | ||
|
||
func (f *Forwarder) ForwardType() v1.SniffType { | ||
return v1.SniffType_EBPFAccessLogType | ||
} | ||
|
||
func (f *Forwarder) SyncForward(e *v1.SniffData) (*v1.SniffData, error) { | ||
return nil, fmt.Errorf("unsupport sync forward") | ||
} | ||
|
||
func (f *Forwarder) SupportedSyncInvoke() bool { | ||
return false | ||
} |
Oops, something went wrong.