Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the missed latency field for cgoEvent #394

Merged
merged 2 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@


### Bug fixes
- Add the missed latency field for `cgoEvent` to fix the bug where the `request_sent_time` in `single_net_request_metric_group` is always 0. ([#394](https://github.com/KindlingProject/kindling/pull/394))
- Fix the wrong thread name in the trace profiling function. ([#385])(https://github.com/KindlingProject/kindling/pull/385)
- Remove "reset" method of ScheduledTaskRoutine to fix a potential dead-lock issue. ([#369])(https://github.com/KindlingProject/kindling/pull/369)
- Fix the bug where the pod metadata with persistent IP in the map is deleted incorrectly due to the deleting mechanism with a delay. ([#374](https://github.com/KindlingProject/kindling/pull/374))
Expand Down
8 changes: 5 additions & 3 deletions collector/pkg/component/receiver/cgoreceiver/cgoreceiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ import (
"time"
"unsafe"

"go.uber.org/zap"
"go.uber.org/zap/zapcore"

"github.com/Kindling-project/kindling/collector/pkg/component"
analyzerpackage "github.com/Kindling-project/kindling/collector/pkg/component/analyzer"
"github.com/Kindling-project/kindling/collector/pkg/component/receiver"
"github.com/Kindling-project/kindling/collector/pkg/model"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)

const (
Expand Down Expand Up @@ -65,7 +66,7 @@ func (r *CgoReceiver) Start() error {
return fmt.Errorf("fail to init probe")
}
time.Sleep(2 * time.Second)
r.subEvent()
_ = r.subEvent()
// Wait for the C routine running
time.Sleep(2 * time.Second)
go r.consumeEvents()
Expand Down Expand Up @@ -140,6 +141,7 @@ func convertEvent(cgoEvent *CKindlingEventForGo) *model.KindlingEvent {
ev.Ctx.FdInfo.Destination = uint64(cgoEvent.context.fdInfo.destination)

ev.ParamsNumber = uint16(cgoEvent.paramsNumber)
ev.Latency = uint64(cgoEvent.latency)
for i := 0; i < int(ev.ParamsNumber); i++ {
ev.UserAttributes[i].Key = C.GoString(cgoEvent.userAttributes[i].key)
userAttributesLen := cgoEvent.userAttributes[i].len
Expand Down