This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-rover.git
The following commit(s) were added to refs/heads/main by this push:
new d76ee40 enhance the access log (#110)
d76ee40 is described below
commit d76ee403bda8557de79bd4e5b9fc6a6fc2646f27
Author: mrproliu <[email protected]>
AuthorDate: Mon Jan 8 09:42:32 2024 +0800
enhance the access log (#110)
---
.github/workflows/compatibility.yaml | 4 +-
.github/workflows/rover.yaml | 4 +-
CHANGES.md | 2 +
bpf/accesslog/common/connection.h | 12 +-
bpf/accesslog/l24/l24.h | 2 +-
bpf/accesslog/process/process.c | 9 +-
bpf/accesslog/syscalls/connect_conntrack.c | 19 +-
bpf/accesslog/syscalls/transfer.c | 18 +-
bpf/accesslog/syscalls/transfer.h | 6 +
configs/rover_configs.yaml | 11 +-
docker/Dockerfile.base | 2 +-
docker/Dockerfile.debug | 45 ++++
docs/en/setup/configuration/core.md | 1 +
.../examples/deploy/kubernetes/rover-daemonset.yml | 7 +
go.mod | 13 +-
go.sum | 78 ++++++-
pkg/accesslog/collector/connect.go | 80 +++++--
pkg/accesslog/collector/l24.go | 5 +-
pkg/accesslog/collector/protocols/http1.go | 16 +-
pkg/accesslog/collector/protocols/http2.go | 13 +-
pkg/accesslog/collector/protocols/protocol.go | 2 +-
pkg/accesslog/collector/protocols/queue.go | 14 +-
pkg/accesslog/collector/tls.go | 2 +-
pkg/accesslog/common/config.go | 7 +-
pkg/accesslog/common/connection.go | 242 +++++++++++++++++----
pkg/accesslog/common/queue.go | 6 +
pkg/accesslog/events/connect.go | 8 +-
pkg/accesslog/runner.go | 45 +++-
pkg/core/api.go | 2 +
pkg/core/config.go | 1 +
pkg/core/module.go | 6 +
pkg/process/finders/kubernetes/finder.go | 24 +-
pkg/process/finders/manager.go | 3 +-
pkg/tools/buffer/buffer.go | 8 +-
pkg/tools/ip.go | 2 +-
pkg/tools/ip/conntrack.go | 116 ++++++++++
pkg/tools/ip/tcpresolver.go | 14 ++
pkg/tools/ssl/openssl.go | 3 +
scripts/build/docker.mk | 11 +-
scripts/build/lint.mk | 2 +-
test/e2e/cases/process/istio/e2e.yaml | 6 +-
test/e2e/cases/process/istio/expected/process.yml | 12 +-
test/e2e/cases/process/istio/expected/service.yml | 48 ++--
test/e2e/cases/process/istio/rover.yaml | 2 +
.../cases/profiling/task/network/envoy/e2e.yaml | 76 +++----
.../network/envoy/expected/dependency-processs.yml | 26 +--
.../task/network/envoy/expected/process.yml | 18 +-
.../network/envoy/expected/service-instance.yml | 4 +-
.../task/network/envoy/expected/service.yml | 48 ++--
49 files changed, 855 insertions(+), 250 deletions(-)
diff --git a/.github/workflows/compatibility.yaml
b/.github/workflows/compatibility.yaml
index 90be685..348cb1f 100644
--- a/.github/workflows/compatibility.yaml
+++ b/.github/workflows/compatibility.yaml
@@ -45,10 +45,10 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- - name: Set up Go 1.18
+ - name: Set up Go 1.20
uses: actions/setup-go@v2
with:
- go-version: 1.18
+ go-version: "1.20"
- id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
diff --git a/.github/workflows/rover.yaml b/.github/workflows/rover.yaml
index f1ab03f..c0db1e2 100644
--- a/.github/workflows/rover.yaml
+++ b/.github/workflows/rover.yaml
@@ -25,10 +25,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- - name: Set up Go 1.18
+ - name: Set up Go 1.20
uses: actions/setup-go@v2
with:
- go-version: 1.18
+ go-version: "1.20"
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
diff --git a/CHANGES.md b/CHANGES.md
index fd5d057..7cb4d1f 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -12,6 +12,8 @@ Release Notes.
* Improve the stability of Off CPU Profiling.
* Support collecting the access log from Kubernetes.
* Remove the scanner mode in the process discovery module.
+* Upgrade Go library to `1.20`.
+* Support using `make docker.debug` to building the debug docker image.
#### Bug Fixes
diff --git a/bpf/accesslog/common/connection.h
b/bpf/accesslog/common/connection.h
index eb51267..dbb5307 100644
--- a/bpf/accesslog/common/connection.h
+++ b/bpf/accesslog/common/connection.h
@@ -95,16 +95,16 @@ struct socket_connect_event_t {
// upstream
__u32 remote_addr_v4;
- __u8 remote_addr_v6[16];
__u32 remote_port;
+ __u8 remote_addr_v6[16];
// downstream
__u32 local_addr_v4;
- __u8 local_addr_v6[16];
__u32 local_port;
+ __u8 local_addr_v6[16];
- __u32 conntrack_upstream_port;
- __u64 conntrack_upstream_iph;
__u64 conntrack_upstream_ipl;
+ __u64 conntrack_upstream_iph;
+ __u32 conntrack_upstream_port;
};
struct {
__uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);
@@ -209,8 +209,8 @@ static __always_inline void submit_new_connection(void*
ctx, bool success, __u32
event->conntrack_upstream_ipl = 0;
event->conntrack_upstream_port = 0;
if (conntrack != NULL) {
- event->conntrack_upstream_iph = conntrack->iph;
- event->conntrack_upstream_ipl = conntrack->ipl;
+ event->conntrack_upstream_iph = (__u64)conntrack->iph;
+ event->conntrack_upstream_ipl = (__u64)conntrack->ipl;
event->conntrack_upstream_port = conntrack->port;
}
event->success = success;
diff --git a/bpf/accesslog/l24/l24.h b/bpf/accesslog/l24/l24.h
index 9ce716d..3f9c1b2 100644
--- a/bpf/accesslog/l24/l24.h
+++ b/bpf/accesslog/l24/l24.h
@@ -38,7 +38,7 @@ struct skb_receive_detail {
struct {
__uint(type, BPF_MAP_TYPE_HASH);
- __uint(max_entries, 10000);
+ __uint(max_entries, 100000);
__type(key, struct sk_buff *);
__type(value, struct skb_receive_detail);
} sk_buff_receive_detail_map SEC(".maps");
diff --git a/bpf/accesslog/process/process.c b/bpf/accesslog/process/process.c
index bdd29ed..7ad6723 100644
--- a/bpf/accesslog/process/process.c
+++ b/bpf/accesslog/process/process.c
@@ -27,11 +27,14 @@ struct process_execute_event {
};
struct sched_comm_fork_ctx {
- __u64 __pad_0;
+ unsigned short common_type;
+ unsigned char common_flags;
+ unsigned char common_preempt_count;
+ int common_pid;
char parent_comm[16];
- __u32 parent_pid;
+ pid_t parent_pid;
char child_comm[16];
- __u32 child_pid;
+ pid_t child_pid;
};
SEC("tracepoint/sched/sched_process_fork")
diff --git a/bpf/accesslog/syscalls/connect_conntrack.c
b/bpf/accesslog/syscalls/connect_conntrack.c
index 483599b..d7180d5 100644
--- a/bpf/accesslog/syscalls/connect_conntrack.c
+++ b/bpf/accesslog/syscalls/connect_conntrack.c
@@ -19,9 +19,10 @@
#include "../common/data_args.h"
static __always_inline void nf_conntrack_read_in6_addr(__u64 *addr_h, __u64
*addr_l, const struct in6_addr *in6) {
- BPF_CORE_READ_INTO(addr_h, in6, s6_addr32[0]);
- BPF_CORE_READ_INTO(addr_l, in6, s6_addr32[2]);
+ bpf_probe_read(addr_h, sizeof(*addr_h), &in6->s6_addr32[0]);
+ bpf_probe_read(addr_l, sizeof(*addr_l), &in6->s6_addr32[2]);
}
+
static __always_inline int
nf_conntrack_tuple_to_conntrack_tuple(conntrack_tuple_t *t, const struct
nf_conntrack_tuple *ct) {
__builtin_memset(t, 0, sizeof(conntrack_tuple_t));
@@ -51,13 +52,13 @@ static __always_inline int
nf_conntrack_tuple_to_conntrack_tuple(conntrack_tuple
if (!t->saddr_l || !t->daddr_l) {
return 0;
}
-// } else if (ct->src.l3num == AF_INET6) {
-// nf_conntrack_read_in6_addr(&t->saddr_h, &t->saddr_l,
&ct->src.u3.in6);
-// nf_conntrack_read_in6_addr(&t->daddr_h, &t->daddr_l,
&ct->dst.u3.in6);
-//
-// if (!t->saddr_h || !t->saddr_l || !t->daddr_h || !t->daddr_l) {
-// return 0;
-// }
+ } else if (ct->src.l3num == AF_INET6) {
+ nf_conntrack_read_in6_addr(&t->saddr_h, &t->saddr_l, &ct->src.u3.in6);
+ nf_conntrack_read_in6_addr(&t->daddr_h, &t->daddr_l, &ct->dst.u3.in6);
+
+ if (!t->saddr_h || !t->saddr_l || !t->daddr_h || !t->daddr_l) {
+ return 0;
+ }
}
return 1;
}
diff --git a/bpf/accesslog/syscalls/transfer.c
b/bpf/accesslog/syscalls/transfer.c
index 23e01da..f3a2608 100644
--- a/bpf/accesslog/syscalls/transfer.c
+++ b/bpf/accesslog/syscalls/transfer.c
@@ -565,12 +565,21 @@ int tracepoint_exit_recvmmsg(struct
trace_point_common_exit *ctx) {
SEC("tracepoint/skb/skb_copy_datagram_iovec")
int tracepoint_skb_copy_datagram_iovec(struct
trace_point_skb_copy_datagram_iovec* ctx) {
__u64 id = bpf_get_current_pid_tgid();
+ struct sk_buff *buff = ctx->skb;
struct sock_data_args_t *data_args =
bpf_map_lookup_elem(&socket_data_args, &id);
if (data_args == NULL) {
+ bpf_map_delete_elem(&sk_buff_receive_detail_map, &buff);
return 0;
}
- struct sk_buff *buff = ctx->skb;
+ struct sock *sock = _(buff->sk);
+ if (sock != NULL) {
+ data_args->sk_role = get_sock_role(data_args->sk_role, sock);
+ }
+
+ data_args->package_count++;
+ data_args->total_package_size += _(buff->len);
+
struct skb_receive_detail *detail =
bpf_map_lookup_elem(&sk_buff_receive_detail_map, &buff);
if (detail == NULL) {
return 0;
@@ -596,8 +605,6 @@ int tracepoint_skb_copy_datagram_iovec(struct
trace_point_skb_copy_datagram_iove
// l2
data_args->ifindex = detail->ifindex;
- data_args->package_count++;
- data_args->total_package_size += _(buff->len);
if (detail->netif_receive_time > 0 && detail->ip_local_time > 0) {
data_args->total_package_to_queue_time += detail->ip_local_time -
detail->netif_receive_time;
}
@@ -605,11 +612,6 @@ int tracepoint_skb_copy_datagram_iovec(struct
trace_point_skb_copy_datagram_iove
data_args->total_package_receive_from_queue_time += bpf_ktime_get_ns()
- detail->ip_local_time;
}
- struct sock *sock = _(buff->sk);
- if (sock != NULL) {
- data_args->sk_role = get_sock_role(data_args->sk_role, sock);
- }
-
return 0;
}
diff --git a/bpf/accesslog/syscalls/transfer.h
b/bpf/accesslog/syscalls/transfer.h
index 2c72d51..1321be9 100644
--- a/bpf/accesslog/syscalls/transfer.h
+++ b/bpf/accesslog/syscalls/transfer.h
@@ -321,6 +321,12 @@ static __always_inline void process_write_data(void *ctx,
__u64 id, struct sock_
conn->ssl = true;
}
+ // if the cannot getting the package size and count, then try to get it
from the data args
+ if (args->total_package_size == 0 && args->package_count == 0) {
+ args->total_package_size = bytes_count;
+ args->package_count = 1;
+ }
+
// if the protocol or role is unknown in the connection and the current
data content is plaintext
// then try to use protocol analyzer to analyze request or response and
protocol type
__u32 msg_type = 0;
diff --git a/configs/rover_configs.yaml b/configs/rover_configs.yaml
index 2d3814c..62ff764 100644
--- a/configs/rover_configs.yaml
+++ b/configs/rover_configs.yaml
@@ -20,6 +20,8 @@ logger:
level: ${ROVER_LOGGER_LEVEL:INFO}
core:
+ # The name of the cluster.
+ cluster_name: ${ROVER_CORE_CLUSTER_NAME:}
backend:
# The backend server address
addr: ${ROVER_BACKEND_ADDR:localhost:11800}
@@ -56,7 +58,7 @@ process_discovery:
-
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_ENVOY_HAS_ENVOY:.Pod.HasContainer
"istio-proxy"}
-
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_ENVOY_CONTAINER_IS_ENVOY:eq
.Container.Name "istio-proxy"}
layer:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_ENVOY_LAYER:MESH_DP}
- service_name:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_ENVOY_SERVICE_NAME:{{.Pod.Namespace}}::{{.Pod.LabelValue
"service.istio.io/canonical-name,app.kubernetes.io/name,app" ""}}}
+ service_name:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_ENVOY_SERVICE_NAME:{{.Pod.LabelValue
"service.istio.io/canonical-name,app.kubernetes.io/name,app"
""}}.{{.Pod.Namespace}}}
instance_name:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_ENVOY_INSTANCE_NAME:{{.Pod.Name}}}
process_name:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_ENVOY_PROCESS_NAME:{{.Process.ExeName}}}
labels:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_ENVOY_LABELS:mesh-envoy}
@@ -65,7 +67,7 @@ process_discovery:
-
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_APPLICATION_HAS_ENVOY:.Pod.HasContainer
"istio-proxy"}
-
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_APPLICATION_CONTAINER_NOT_ENVOY:ne
.Container.Name "istio-proxy"}
layer:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_APPLICATION_LAYER:MESH}
- service_name:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_APPLICATION_SERVICE_NAME:{{.Pod.Namespace}}::{{.Pod.LabelValue
"service.istio.io/canonical-name,app.kubernetes.io/name,app" ""}}}
+ service_name:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_APPLICATION_SERVICE_NAME:{{.Pod.LabelValue
"service.istio.io/canonical-name,app.kubernetes.io/name,app"
""}}.{{.Pod.Namespace}}}
instance_name:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_APPLICATION_INSTANCE_NAME:{{.Pod.Name}}}
process_name:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_APPLICATION_PROCESS_NAME:{{.Process.ExeName}}}
labels:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_APPLICATION_LABELS:mesh-application}
@@ -73,7 +75,7 @@ process_discovery:
filters:
-
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_K8S_SERVICE_HAS_SERVICE:.Pod.HasServiceName}
layer:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_K8S_SERVICE_LAYER:K8S_SERVICE}
- service_name:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_K8S_SERVICE_NAME:{{.Pod.Namespace}}::{{.Pod.ServiceName}}}
+ service_name:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_K8S_SERVICE_NAME:{{.Pod.ServiceName}}.{{.Pod.Namespace}}}
instance_name:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_K8S_SERVICE_INSTANCE_NAME:{{.Pod.Name}}}
process_name:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_K8S_SERVICE_PROCESS_NAME:{{.Process.ExeName}}}
labels:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_K8S_SERVICE_LABLES:k8s-service}
@@ -129,9 +131,10 @@ profiling:
access_log:
# Is active the access log monitoring
active: ${ROVER_ACCESS_LOG_ACTIVE:false}
+ exclude_namespaces:
${ROVER_ACCESS_LOG_EXCLUDE_NAMESPACES:istio-system,cert-manager,kube-system}
flush:
# The max count of access log when flush to the backend
- max_count: ${ROVER_ACCESS_LOG_FLUSH_MAX_COUNT:2000}
+ max_count: ${ROVER_ACCESS_LOG_FLUSH_MAX_COUNT:10000}
# The period of flush access log to the backend
period: ${ROVER_ACCESS_LOG_FLUSH_PERIOD:5s}
protocol_analyze:
diff --git a/docker/Dockerfile.base b/docker/Dockerfile.base
index 9dc31c0..3c5dcf1 100644
--- a/docker/Dockerfile.base
+++ b/docker/Dockerfile.base
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-FROM golang:1.18
+FROM golang:1.20
RUN apt update && \
git clone --depth 1 --branch v1.1.0 https://github.com/libbpf/libbpf.git
&& \
diff --git a/docker/Dockerfile.debug b/docker/Dockerfile.debug
new file mode 100644
index 0000000..8068590
--- /dev/null
+++ b/docker/Dockerfile.debug
@@ -0,0 +1,45 @@
+# 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.
+
+ARG BASE_IMAGE=apache/skywalking-rover:latest
+FROM $BASE_IMAGE as build
+
+ARG VERSION="latest"
+
+WORKDIR /src
+
+COPY . .
+
+ENV CGO_ENABLED=0
+
+RUN go install github.com/go-delve/delve/cmd/dlv@latest
+
+RUN VERSION=$VERSION make generate && make linux
+RUN mv /src/bin/skywalking-rover-${VERSION}-linux-* /src/bin/skywalking-rover
+
+FROM ubuntu:22.04
+
+VOLUME /skywalking/configs
+
+WORKDIR /skywalking
+
+COPY --from=build /go/bin/dlv /dlv
+COPY --from=build /src/bin/skywalking-rover /
+COPY --from=build /src/configs /skywalking/configs
+
+EXPOSE 40000
+
+CMD ["/dlv", "--listen=:40000", "--headless=true", "--api-version=2", "--log",
"--accept-multiclient", "exec", "/skywalking-rover", "--", "start", "--config",
"/skywalking/configs/rover_configs.yaml"]
\ No newline at end of file
diff --git a/docs/en/setup/configuration/core.md
b/docs/en/setup/configuration/core.md
index 618a174..0ef922e 100644
--- a/docs/en/setup/configuration/core.md
+++ b/docs/en/setup/configuration/core.md
@@ -7,6 +7,7 @@ It provides APIs for other modules to establish connections
with the backend.
| Name | Default | Environment Key
| Description
|
|-----------------------------------|-----------------|------------------------------------|-----------------------------------------------------------------------------------------------------|
+| core.cluster_name | |
ROVER_CORE_CLUSTER_NAME | The name of the cluster.
|
| core.backend.addr | localhost:11800 | ROVER_BACKEND_ADDR
| The backend server address.
|
| core.backend.enable_TLS | false |
ROVER_BACKEND_ENABLE_TLS | The TLS switch.
|
| core.backend.client_pem_path | client.pem | ROVER_BACKEND_PEM_PATH
| The file path of client.pem. The config only works when opening
the TLS switch. |
diff --git a/docs/en/setup/examples/deploy/kubernetes/rover-daemonset.yml
b/docs/en/setup/examples/deploy/kubernetes/rover-daemonset.yml
index 7d402e9..a3b92c4 100644
--- a/docs/en/setup/examples/deploy/kubernetes/rover-daemonset.yml
+++ b/docs/en/setup/examples/deploy/kubernetes/rover-daemonset.yml
@@ -72,6 +72,9 @@ spec:
- name: host
mountPath: /host
readOnly: true
+ - name: sys
+ mountPath: /sys
+ readOnly: true
env:
- name: ROVER_PROCESS_DISCOVERY_KUBERNETES_ACTIVE
value: "true"
@@ -92,3 +95,7 @@ spec:
hostPath:
path: /
type: Directory
+ - name: sys
+ hostPath:
+ path: /sys
+ type: Directory
\ No newline at end of file
diff --git a/go.mod b/go.mod
index 94fc0b8..278c8a8 100644
--- a/go.mod
+++ b/go.mod
@@ -1,11 +1,12 @@
module github.com/apache/skywalking-rover
-go 1.18
+go 1.20
require (
github.com/agiledragon/gomonkey/v2 v2.9.0
github.com/cilium/ebpf v0.9.3
github.com/docker/go-units v0.5.0
+ github.com/florianl/go-conntrack v0.4.0
github.com/google/uuid v1.3.0
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/golang-lru v0.5.4
@@ -25,10 +26,11 @@ require (
k8s.io/apimachinery v0.23.5
k8s.io/client-go v0.23.5
k8s.io/utils v0.0.0-20211116205334-6203023598ed
- skywalking.apache.org/repo/goapi v0.0.0-20231225085619-53f5be6739c4
+ skywalking.apache.org/repo/goapi v0.0.0-20240104145220-ba7202308dd4
)
require (
+ github.com/BurntSushi/toml v0.4.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/go-logr/logr v1.2.0 // indirect
@@ -41,8 +43,11 @@ require (
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
+ github.com/josharian/native v0.0.0-20200817173448-b6b71def0850 //
indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/magiconair/properties v1.8.5 // indirect
+ github.com/mdlayher/netlink v1.5.0 // indirect
+ github.com/mdlayher/socket v0.1.0 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd //
indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
@@ -56,10 +61,13 @@ require (
github.com/tklauser/go-sysconf v0.3.9 // indirect
github.com/tklauser/numcpus v0.3.0 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
+ golang.org/x/mod v0.8.0 // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
+ golang.org/x/sync v0.1.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
+ golang.org/x/tools v0.6.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa //
indirect
google.golang.org/protobuf v1.31.0 // indirect
@@ -67,6 +75,7 @@ require (
gopkg.in/ini.v1 v1.66.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
+ honnef.co/go/tools v0.2.2 // indirect
k8s.io/klog/v2 v2.30.0 // indirect
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect
diff --git a/go.sum b/go.sum
index f9e5af8..b94d84d 100644
--- a/go.sum
+++ b/go.sum
@@ -54,6 +54,8 @@ github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod
h1:LTp+uSrOhSkaKrUy935
github.com/Azure/go-autorest/logger v0.2.1/go.mod
h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8=
github.com/Azure/go-autorest/tracing v0.6.0/go.mod
h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU=
github.com/BurntSushi/toml v0.3.1/go.mod
h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/BurntSushi/toml v0.4.1
h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw=
+github.com/BurntSushi/toml v0.4.1/go.mod
h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod
h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod
h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod
h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
@@ -85,6 +87,8 @@ github.com/cespare/xxhash/v2 v2.1.2/go.mod
h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL
github.com/chzyer/logex v1.1.10/go.mod
h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod
h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod
h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
+github.com/cilium/ebpf v0.5.0/go.mod
h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs=
+github.com/cilium/ebpf v0.7.0/go.mod
h1:/oI2+1shJiTGAMgl6/RgJr36Eo1jzrRcAWbcXO2usCA=
github.com/cilium/ebpf v0.9.3 h1:5KtxXZU+scyERvkJMEm16TbScVvuuMrlhPly78ZMbSc=
github.com/cilium/ebpf v0.9.3/go.mod
h1:w27N4UjpaQ9X/DGrSugxUG+H+NhgntDuPb5lCzxCn8A=
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod
h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
@@ -127,8 +131,11 @@ github.com/evanphx/json-patch v4.12.0+incompatible/go.mod
h1:50XU6AFN0ol/bzJsmQL
github.com/fatih/color v1.7.0/go.mod
h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.9.0/go.mod
h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/fatih/color v1.13.0/go.mod
h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
+github.com/florianl/go-conntrack v0.4.0
h1:TlYkxytdwgVayfU0cKwkHurQA0Rd1ZSEBRckRYDUu18=
+github.com/florianl/go-conntrack v0.4.0/go.mod
h1:iPDx4oIats2T7X7Jm3PFyRCJM1GfZhJaSHOWROYOrE8=
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod
h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod
h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
+github.com/frankban/quicktest v1.11.3/go.mod
h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k=
github.com/frankban/quicktest v1.14.0
h1:+cqqvzZV87b4adx/5ayVOaYZ2CrvM4ejQvUdBzPPUss=
github.com/fsnotify/fsnotify v1.4.7/go.mod
h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod
h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
@@ -287,6 +294,18 @@ github.com/ianlancetaylor/demangle
v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:
github.com/imdario/mergo v0.3.5/go.mod
h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/inconshreveable/mousetrap v1.0.0
h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod
h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
+github.com/josharian/native v0.0.0-20200817173448-b6b71def0850
h1:uhL5Gw7BINiiPAo24A2sxkcDI0Jt/sqp1v5xQCniEFA=
+github.com/josharian/native v0.0.0-20200817173448-b6b71def0850/go.mod
h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w=
+github.com/jsimonetti/rtnetlink v0.0.0-20190606172950-9527aa82566a/go.mod
h1:Oz+70psSo5OFh8DBl0Zv2ACw7Esh6pPUphlvZG9x7uw=
+github.com/jsimonetti/rtnetlink v0.0.0-20200117123717-f846d4f6c1f4/go.mod
h1:WGuG/smIU4J/54PblvSbh+xvCZmpJnFgr3ds6Z55XMQ=
+github.com/jsimonetti/rtnetlink v0.0.0-20201009170750-9c6f07d100c1/go.mod
h1:hqoO/u39cqLeBLebZ8fWdE96O7FxrAsRYhnVOdgHxok=
+github.com/jsimonetti/rtnetlink v0.0.0-20201216134343-bde56ed16391/go.mod
h1:cR77jAZG3Y3bsb8hF6fHJbFoyFukLFOkQ98S0pQz3xw=
+github.com/jsimonetti/rtnetlink v0.0.0-20201220180245-69540ac93943/go.mod
h1:z4c53zj6Eex712ROyh8WI0ihysb5j2ROyV42iNogmAs=
+github.com/jsimonetti/rtnetlink v0.0.0-20210122163228-8d122574c736/go.mod
h1:ZXpIyOK59ZnN7J0BV99cZUPmsqDRZ3eq5X+st7u/oSA=
+github.com/jsimonetti/rtnetlink v0.0.0-20210212075122-66c871082f2b/go.mod
h1:8w9Rh8m+aHZIG69YPGGem1i5VzoyRC8nw2kA8B+ik5U=
+github.com/jsimonetti/rtnetlink v0.0.0-20210525051524-4cc836578190/go.mod
h1:NmKSdU4VGSiv1bMsdqNALI4RSvvjtz65tTMCnD05qLo=
+github.com/jsimonetti/rtnetlink v0.0.0-20211022192332-93da33804786
h1:N527AHMa793TP5z5GNAn/VLPzlc0ewzWdeP/25gDfgQ=
+github.com/jsimonetti/rtnetlink v0.0.0-20211022192332-93da33804786/go.mod
h1:v4hqbTdfQngbVSZJVWUhGE/lbTFf9jb+ygmNUDQMuOs=
github.com/json-iterator/go v1.1.6/go.mod
h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.9/go.mod
h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.11/go.mod
h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
@@ -303,6 +322,7 @@ github.com/kr/fs v0.1.0/go.mod
h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod
h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod
h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.0/go.mod
h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
+github.com/kr/pretty v0.2.1/go.mod
h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod
h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
@@ -325,6 +345,27 @@ github.com/mattn/go-isatty v0.0.11/go.mod
h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOA
github.com/mattn/go-isatty v0.0.12/go.mod
h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.14/go.mod
h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod
h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
+github.com/mdlayher/ethtool v0.0.0-20210210192532-2b88debcdd43/go.mod
h1:+t7E0lkKfbBsebllff1xdTmyJt8lH37niI6kwFk9OTo=
+github.com/mdlayher/ethtool v0.0.0-20211028163843-288d040e9d60
h1:tHdB+hQRHU10CfcK0furo6rSNgZ38JT8uPh70c/pFD8=
+github.com/mdlayher/ethtool v0.0.0-20211028163843-288d040e9d60/go.mod
h1:aYbhishWc4Ai3I2U4Gaa2n3kHWSwzme6EsG/46HRQbE=
+github.com/mdlayher/genetlink v1.0.0
h1:OoHN1OdyEIkScEmRgxLEe2M9U8ClMytqA5niynLtfj0=
+github.com/mdlayher/genetlink v1.0.0/go.mod
h1:0rJ0h4itni50A86M2kHcgS85ttZazNt7a8H2a2cw0Gc=
+github.com/mdlayher/netlink v0.0.0-20190409211403-11939a169225/go.mod
h1:eQB3mZE4aiYnlUsyGGCOpPETfdQq4Jhsgf1fk3cwQaA=
+github.com/mdlayher/netlink v1.0.0/go.mod
h1:KxeJAFOFLG6AjpyDkQ/iIhxygIUKD+vcwqcnu43w/+M=
+github.com/mdlayher/netlink v1.1.0/go.mod
h1:H4WCitaheIsdF9yOYu8CFmCgQthAPIWZmcKp9uZHgmY=
+github.com/mdlayher/netlink v1.1.1/go.mod
h1:WTYpFb/WTvlRJAyKhZL5/uy69TDDpHHu2VZmb2XgV7o=
+github.com/mdlayher/netlink v1.2.0/go.mod
h1:kwVW1io0AZy9A1E2YYgaD4Cj+C+GPkU6klXCMzIJ9p8=
+github.com/mdlayher/netlink v1.2.1/go.mod
h1:bacnNlfhqHqqLo4WsYeXSqfyXkInQ9JneWI68v1KwSU=
+github.com/mdlayher/netlink v1.2.2-0.20210123213345-5cc92139ae3e/go.mod
h1:bacnNlfhqHqqLo4WsYeXSqfyXkInQ9JneWI68v1KwSU=
+github.com/mdlayher/netlink v1.3.0/go.mod
h1:xK/BssKuwcRXHrtN04UBkwQ6dY9VviGGuriDdoPSWys=
+github.com/mdlayher/netlink v1.4.0/go.mod
h1:dRJi5IABcZpBD2A3D0Mv/AiX8I9uDEu5oGkAVrekmf8=
+github.com/mdlayher/netlink v1.4.1/go.mod
h1:e4/KuJ+s8UhfUpO9z00/fDZZmhSrs+oxyqAS9cNgn6Q=
+github.com/mdlayher/netlink v1.5.0
h1:r4fa439+SsMarM0rMONU3iSshSV3ArVqJl6H/zjrhh4=
+github.com/mdlayher/netlink v1.5.0/go.mod
h1:1Kr8BBFxGyUyNmztC9WLOayqYVAd2wsgOZm18nqGuzQ=
+github.com/mdlayher/socket v0.0.0-20210307095302-262dc9984e00/go.mod
h1:GAFlyu4/XV68LkQKYzKhIo/WW7j3Zi0YRAz/BOoanUc=
+github.com/mdlayher/socket v0.0.0-20211007213009-516dcbdf0267/go.mod
h1:nFZ1EtZYK8Gi/k6QNu7z7CgO20i/4ExeQswwWuPmG/g=
+github.com/mdlayher/socket v0.1.0
h1:PBV/PxzCp56zuT74AY8vz2dtifidvlI2p65OTqIsqhM=
+github.com/mdlayher/socket v0.1.0/go.mod
h1:mYV5YIZAfHh4dzDVzI8x8tWLWCliuX8Mon5Awbj+qDs=
github.com/miekg/dns v1.0.14/go.mod
h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/miekg/dns v1.1.26/go.mod
h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso=
github.com/miekg/dns v1.1.41/go.mod
h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI=
@@ -445,6 +486,7 @@ github.com/yuin/goldmark v1.1.27/go.mod
h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
github.com/yuin/goldmark v1.1.32/go.mod
h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod
h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod
h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
+github.com/yuin/goldmark v1.4.0/go.mod
h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod
h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yusufpapurcu/wmi v1.2.2
h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg=
github.com/yusufpapurcu/wmi v1.2.2/go.mod
h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
@@ -515,7 +557,9 @@ golang.org/x/mod v0.4.0/go.mod
h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
+golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod
h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
+golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod
h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod
h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -535,6 +579,7 @@ golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod
h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod
h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod
h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod
h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20191007182048-72f939374954/go.mod
h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod
h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod
h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod
h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
@@ -550,18 +595,26 @@ golang.org/x/net
v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod
h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod
h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod
h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
+golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod
h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod
h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod
h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod
h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod
h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20201216054612-986b41b23924/go.mod
h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod
h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod
h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod
h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod
h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod
h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod
h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8=
golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod
h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod
h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod
h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod
h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b/go.mod
h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+golang.org/x/net v0.0.0-20211020060615-d418f374d309/go.mod
h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod
h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+golang.org/x/net v0.0.0-20220107192237-5cfca573fb4d/go.mod
h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod
h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
@@ -597,6 +650,7 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod
h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod
h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod
h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod
h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod
h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod
h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -607,6 +661,7 @@ golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod
h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod
h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod
h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190411185658-b44545bcd369/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -614,6 +669,7 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod
h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -643,10 +699,17 @@ golang.org/x/sys
v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201009025420-dfb3f7c4e634/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201118182958-a01c418693c7/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201218084310-7d0127a74742/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210110051926-789bb1bd4061/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210123111255-9b0068b26619/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210216163648-f7da38b97c65/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -657,20 +720,26 @@ golang.org/x/sys
v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210525143221-35b2ab0089ea/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -758,7 +827,9 @@ golang.org/x/tools v0.1.2/go.mod
h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.3/go.mod
h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.4/go.mod
h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod
h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
+golang.org/x/tools v0.1.7/go.mod
h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/tools v0.1.12/go.mod
h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
+golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
golang.org/x/tools v0.6.0/go.mod
h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod
h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod
h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@@ -950,6 +1021,9 @@ honnef.co/go/tools
v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3/go.mod
h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod
h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod
h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
+honnef.co/go/tools v0.2.1/go.mod
h1:lPVVZ2BS5TfnjLyizF7o7hv7j9/L+8cZY2hLyjP9cGY=
+honnef.co/go/tools v0.2.2 h1:MNh1AVMyVX23VUHE2O27jm6lNj3vjO5DexS4A1xvnzk=
+honnef.co/go/tools v0.2.2/go.mod
h1:lPVVZ2BS5TfnjLyizF7o7hv7j9/L+8cZY2hLyjP9cGY=
k8s.io/api v0.23.5 h1:zno3LUiMubxD/V1Zw3ijyKO3wxrhbUF1Ck+VjBvfaoA=
k8s.io/api v0.23.5/go.mod h1:Na4XuKng8PXJ2JsploYYrivXrINeTaycCGcYgF91Xm8=
k8s.io/apimachinery v0.23.5 h1:Va7dwhp8wgkUPWsEXk6XglXWU4IKYLKNlv8VkX7SDM0=
@@ -976,5 +1050,5 @@ sigs.k8s.io/structured-merge-diff/v4 v4.2.1
h1:bKCqE9GvQ5tiVHn5rfn1r+yao3aLQEaLz
sigs.k8s.io/structured-merge-diff/v4 v4.2.1/go.mod
h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4=
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
-skywalking.apache.org/repo/goapi v0.0.0-20231225085619-53f5be6739c4
h1:boI2sHrjhiXdidajUn1KyVNC7CvC/pwIn9zr52TuXBQ=
-skywalking.apache.org/repo/goapi v0.0.0-20231225085619-53f5be6739c4/go.mod
h1:oD2dxcDAHVIt95Ee7kJHgZ5f64QNhrqTjQYARwfafc4=
+skywalking.apache.org/repo/goapi v0.0.0-20240104145220-ba7202308dd4
h1:3YIFmsshgsU6FzHgnkG9Z24CkXkgoexBN5O0aSzK79g=
+skywalking.apache.org/repo/goapi v0.0.0-20240104145220-ba7202308dd4/go.mod
h1:oD2dxcDAHVIt95Ee7kJHgZ5f64QNhrqTjQYARwfafc4=
diff --git a/pkg/accesslog/collector/connect.go
b/pkg/accesslog/collector/connect.go
index a93a215..958103a 100644
--- a/pkg/accesslog/collector/connect.go
+++ b/pkg/accesslog/collector/connect.go
@@ -20,11 +20,14 @@ package collector
import (
"encoding/binary"
+ "github.com/sirupsen/logrus"
+
"github.com/apache/skywalking-rover/pkg/accesslog/common"
"github.com/apache/skywalking-rover/pkg/accesslog/events"
"github.com/apache/skywalking-rover/pkg/accesslog/forwarder"
"github.com/apache/skywalking-rover/pkg/logger"
"github.com/apache/skywalking-rover/pkg/module"
+ "github.com/apache/skywalking-rover/pkg/tools"
"github.com/apache/skywalking-rover/pkg/tools/enums"
"github.com/apache/skywalking-rover/pkg/tools/ip"
@@ -39,10 +42,15 @@ var connectLogger = logger.GetLogger("access_log",
"collector", "connect")
var connectCollectInstance = NewConnectCollector()
type ConnectCollector struct {
+ connTracker *ip.ConnTrack
}
func NewConnectCollector() *ConnectCollector {
- return &ConnectCollector{}
+ track, err := ip.NewConnTrack()
+ if err != nil {
+ connectLogger.Warnf("cannot create the connection tracker, %v",
err)
+ }
+ return &ConnectCollector{connTracker: track}
}
func (c *ConnectCollector) Start(_ *module.Manager, context
*common.AccessLogContext) error {
@@ -67,15 +75,18 @@ func (c *ConnectCollector) Start(_ *module.Manager, context
*common.AccessLogCon
context.BPF.ReadEventAsync(context.BPF.SocketConnectionEventQueue,
func(data interface{}) {
event := data.(*events.SocketConnectEvent)
- connectLogger.Debugf("receive connect event, connection ID: %d,
randomID: %d, pid: %d, fd: %d, role: %s: func: %s, family: %d, success: %d",
+ connectLogger.Debugf("receive connect event, connection ID: %d,
randomID: %d, "+
+ "pid: %d, fd: %d, role: %s: func: %s, family: %d,
success: %d, conntrack exist: %t",
event.ConID, event.RandomID, event.PID, event.SocketFD,
enums.ConnectionRole(event.Role), enums.SocketFunctionName(event.FuncName),
- event.SocketFamily, event.ConnectSuccess)
- socketPair := buildSocketFromConnectEvent(event)
+ event.SocketFamily, event.ConnectSuccess,
event.ConnTrackUpstreamPort != 0)
+ socketPair := c.buildSocketFromConnectEvent(event)
if socketPair == nil {
connectLogger.Debugf("cannot found the socket paire
from connect event, connection ID: %d, randomID: %d",
event.ConID, event.RandomID)
return
}
+ connectLogger.Debugf("build socket pair success, connection ID:
%d, randomID: %d, role: %s, local: %s:%d, remote: %s:%d",
+ event.ConID, event.RandomID, socketPair.Role,
socketPair.SrcIP, socketPair.SrcPort, socketPair.DestIP, socketPair.DestPort)
context.ConnectionMgr.OnConnectEvent(event, socketPair)
forwarder.SendConnectEvent(context, event, socketPair)
}, func() interface{} {
@@ -88,17 +99,17 @@ func (c *ConnectCollector) Start(_ *module.Manager, context
*common.AccessLogCon
func (c *ConnectCollector) Stop() {
}
-func buildSocketFromConnectEvent(event *events.SocketConnectEvent)
*ip.SocketPair {
+func (c *ConnectCollector) buildSocketFromConnectEvent(event
*events.SocketConnectEvent) *ip.SocketPair {
if event.SocketFamily != unix.AF_INET && event.SocketFamily !=
unix.AF_INET6 && event.SocketFamily != enums.SocketFamilyUnknown {
// if not ipv4, ipv6 or unknown, ignore
return nil
}
- socketPair := buildSocketPair(event)
+ socketPair := c.buildSocketPair(event)
if socketPair != nil && socketPair.IsValid() {
return socketPair
}
// if only the local port not success, maybe the upstream port is not
open, so it could be continued
- if isOnlyLocalPortEmpty(socketPair) {
+ if c.isOnlyLocalPortEmpty(socketPair) {
event.ConnectSuccess = 0
return socketPair
}
@@ -108,11 +119,14 @@ func buildSocketFromConnectEvent(event
*events.SocketConnectEvent) *ip.SocketPai
connectLogger.Warnf("cannot found the socket, pid: %d, socket
FD: %d", event.PID, event.SocketFD)
return nil
}
+ connectLogger.Debugf("found the connection from the socket, connection
ID: %d, randomID: %d",
+ event.ConID, event.RandomID)
pair.Role = enums.ConnectionRole(event.Role)
+ c.tryToUpdateSocketFromConntrack(event, pair)
return pair
}
-func isOnlyLocalPortEmpty(socketPair *ip.SocketPair) bool {
+func (c *ConnectCollector) isOnlyLocalPortEmpty(socketPair *ip.SocketPair)
bool {
if socketPair == nil {
return false
}
@@ -124,18 +138,25 @@ func isOnlyLocalPortEmpty(socketPair *ip.SocketPair) bool
{
return socketPair.IsValid()
}
-func buildSocketPair(event *events.SocketConnectEvent) *ip.SocketPair {
+func (c *ConnectCollector) buildSocketPair(event *events.SocketConnectEvent)
*ip.SocketPair {
var result *ip.SocketPair
+ haveConnTrack := false
if event.SocketFamily == unix.AF_INET {
result = &ip.SocketPair{
Family: uint32(event.SocketFamily),
- Role: enums.ConnectionRoleClient,
+ Role: enums.ConnectionRole(event.Role),
SrcIP: ip.ParseIPV4(event.LocalAddrV4),
SrcPort: uint16(event.LocalAddrPort),
}
if event.ConnTrackUpstreamIPl != 0 &&
event.ConnTrackUpstreamPort != 0 {
+ haveConnTrack = true
result.DestIP =
ip.ParseIPV4(uint32(event.ConnTrackUpstreamIPl))
result.DestPort = uint16(event.ConnTrackUpstreamPort)
+
+ if connectLogger.Enable(logrus.DebugLevel) {
+ connectLogger.Debugf("found the connection from
the conntrack, connection ID: %d, randomID: %d, original: %s:%d, conntrack:
%s:%d",
+ event.ConID, event.RandomID,
ip.ParseIPV4(event.RemoteAddrV4), uint16(event.RemoteAddrPort), result.DestIP,
result.DestPort)
+ }
} else {
result.DestIP = ip.ParseIPV4(event.RemoteAddrV4)
result.DestPort = uint16(event.RemoteAddrPort)
@@ -143,20 +164,49 @@ func buildSocketPair(event *events.SocketConnectEvent)
*ip.SocketPair {
} else if event.SocketFamily == unix.AF_INET6 {
result = &ip.SocketPair{
Family: uint32(event.SocketFamily),
- Role: enums.ConnectionRoleClient,
+ Role: enums.ConnectionRole(event.Role),
SrcIP: ip.ParseIPV6(event.LocalAddrV6),
SrcPort: uint16(event.LocalAddrPort),
}
if event.ConnTrackUpstreamIPl != 0 &&
event.ConnTrackUpstreamPort != 0 {
- var ipv6 [16]uint8
- binary.BigEndian.PutUint64(ipv6[0:8],
event.ConnTrackUpstreamIPh)
- binary.BigEndian.PutUint64(ipv6[8:16],
event.ConnTrackUpstreamIPl)
- result.DestIP = ip.ParseIPV6(ipv6)
+ haveConnTrack = true
+ if event.ConnTrackUpstreamIPh != 0 {
+ var ipv6 [16]uint8
+ binary.BigEndian.PutUint64(ipv6[0:8],
event.ConnTrackUpstreamIPh)
+ binary.BigEndian.PutUint64(ipv6[8:16],
event.ConnTrackUpstreamIPl)
+ result.DestIP = ip.ParseIPV6(ipv6)
+ } else {
+ result.DestIP =
ip.ParseIPV4(uint32(event.ConnTrackUpstreamIPl))
+ }
result.DestPort = uint16(event.ConnTrackUpstreamPort)
+ if connectLogger.Enable(logrus.DebugLevel) {
+ connectLogger.Debugf("found the connection from
the conntrack, connection ID: %d, randomID: %d, original: %s:%d, conntrack:
%s:%d",
+ event.ConID, event.RandomID,
ip.ParseIPV6(event.RemoteAddrV6), uint16(event.RemoteAddrPort), result.DestIP,
result.DestPort)
+ }
} else {
result.DestIP = ip.ParseIPV6(event.RemoteAddrV6)
result.DestPort = uint16(event.RemoteAddrPort)
}
}
+
+ if haveConnTrack {
+ return result
+ }
+
+ c.tryToUpdateSocketFromConntrack(event, result)
return result
}
+
+func (c *ConnectCollector) tryToUpdateSocketFromConntrack(event
*events.SocketConnectEvent, socket *ip.SocketPair) {
+ if socket != nil && socket.IsValid() && c.connTracker != nil &&
!tools.IsLocalHostAddress(socket.DestIP) {
+ // if no contract and socket data is valid, then trying to get
the remote address from the socket
+ // to encase the remote address is not the real remote address
+ originalIP := socket.DestIP
+ originalPort := socket.DestPort
+ if c.connTracker.UpdateRealPeerAddress(socket) {
+ connectLogger.Debugf("update the socket address from
conntrack success, "+
+ "connection ID: %d, randomID: %d, original
remote: %s:%d, new remote: %s:%d",
+ event.ConID, event.RandomID, originalIP,
originalPort, socket.DestIP, socket.DestPort)
+ }
+ }
+}
diff --git a/pkg/accesslog/collector/l24.go b/pkg/accesslog/collector/l24.go
index 109617a..aaf4182 100644
--- a/pkg/accesslog/collector/l24.go
+++ b/pkg/accesslog/collector/l24.go
@@ -50,9 +50,10 @@ func (c *L24Collector) startRead(_ *module.Manager, context
*common.AccessLogCon
context.BPF.AddLink(link.Kprobe, map[string]*ebpf.Program{"ip_rcv":
context.BPF.IpRcv})
context.BPF.AddLink(link.Kretprobe, map[string]*ebpf.Program{"ip_rcv":
context.BPF.IpRcvRet})
context.BPF.AddLink(link.Kprobe,
map[string]*ebpf.Program{"ip_rcv_finish": context.BPF.IpRcvFinish})
- context.BPF.AddLink(link.Kprobe,
map[string]*ebpf.Program{"ip_sublist_rcv_finish":
context.BPF.IpSublistRcvFinish})
context.BPF.AddLink(link.Kprobe,
map[string]*ebpf.Program{"ip_local_deliver": context.BPF.IpLocalDeliver})
- context.BPF.AddLink(link.Kprobe,
map[string]*ebpf.Program{"ip_local_deliver_finish":
context.BPF.IpLocalDeliverFinish})
+ // it's not exist in old kernel versions
+ _ = context.BPF.AddLinkOrError(link.Kprobe,
map[string]*ebpf.Program{"ip_sublist_rcv_finish":
context.BPF.IpSublistRcvFinish})
+ _ = context.BPF.AddLinkOrError(link.Kprobe,
map[string]*ebpf.Program{"ip_local_deliver_finish":
context.BPF.IpLocalDeliverFinish})
// l4
context.BPF.AddLink(link.Kprobe, map[string]*ebpf.Program{"tcp_v4_rcv":
context.BPF.TcpV4Rcv})
diff --git a/pkg/accesslog/collector/protocols/http1.go
b/pkg/accesslog/collector/protocols/http1.go
index e25b5c1..530463b 100644
--- a/pkg/accesslog/collector/protocols/http1.go
+++ b/pkg/accesslog/collector/protocols/http1.go
@@ -45,16 +45,24 @@ type HTTP1Protocol struct {
}
type HTTP1Metrics struct {
+ connectionID uint64
+ randomID uint64
+
halfRequests *list.List
}
-func (p *HTTP1Protocol) GenerateConnection(connectionID uint64)
ProtocolMetrics {
+func (p *HTTP1Protocol) GenerateConnection(connectionID, randomID uint64)
ProtocolMetrics {
return &HTTP1Metrics{
+ connectionID: connectionID,
+ randomID: randomID,
halfRequests: list.New(),
}
}
func (p *HTTP1Protocol) Analyze(metrics ProtocolMetrics, buf *buffer.Buffer, _
*AnalyzeHelper) error {
+ http1Metrics := metrics.(*HTTP1Metrics)
+ http1Log.Debugf("ready to analyze HTTP/1 protocol data, connection ID:
%d, random ID: %d",
+ http1Metrics.connectionID, http1Metrics.randomID)
buf.ResetForLoopReading()
for {
if !buf.PrepareForReading() {
@@ -130,11 +138,11 @@ func (p *HTTP1Protocol) handleResponse(metrics
ProtocolMetrics, b *buffer.Buffer
}
// getting the request and response, then send to the forwarder
- p.handleHTTPData(request, response)
+ p.handleHTTPData(http1Metrics, request, response)
return enums.ParseResultSuccess, nil
}
-func (p *HTTP1Protocol) handleHTTPData(request *reader.Request, response
*reader.Response) {
+func (p *HTTP1Protocol) handleHTTPData(metrics *HTTP1Metrics, request
*reader.Request, response *reader.Response) {
detailEvents := make([]*events.SocketDetailEvent, 0)
detailEvents = appendSocketDetailsFromBuffer(detailEvents,
request.HeaderBuffer())
detailEvents = appendSocketDetailsFromBuffer(detailEvents,
request.BodyBuffer())
@@ -146,6 +154,8 @@ func (p *HTTP1Protocol) handleHTTPData(request
*reader.Request, response *reader
request.MinDataID(),
response.BodyBuffer().LastSocketBuffer().DataID())
return
}
+ http1Log.Debugf("found fully HTTP1 request and response, contains %d
detail events , connection ID: %d, random ID: %d",
+ len(detailEvents), metrics.connectionID, metrics.randomID)
originalRequest := request.Original()
originalResponse := response.Original()
diff --git a/pkg/accesslog/collector/protocols/http2.go
b/pkg/accesslog/collector/protocols/http2.go
index f9a2e3d..8ce8d26 100644
--- a/pkg/accesslog/collector/protocols/http2.go
+++ b/pkg/accesslog/collector/protocols/http2.go
@@ -54,6 +54,7 @@ type HTTP2Protocol struct {
type HTTP2Metrics struct {
connectionID uint64
+ randomID uint64
hpackDecoder *hpack.Decoder
streams map[uint32]*HTTP2Streaming
@@ -70,17 +71,19 @@ type HTTP2Streaming struct {
respBodyBuffer *buffer.Buffer
}
-func (r *HTTP2Protocol) GenerateConnection(connectionID uint64)
ProtocolMetrics {
+func (r *HTTP2Protocol) GenerateConnection(connectionID, randomID uint64)
ProtocolMetrics {
return &HTTP2Metrics{
connectionID: connectionID,
+ randomID: randomID,
hpackDecoder: hpack.NewDecoder(4096, nil),
streams: make(map[uint32]*HTTP2Streaming),
}
}
func (r *HTTP2Protocol) Analyze(metrics ProtocolMetrics, buf *buffer.Buffer,
helper *AnalyzeHelper) error {
- http2Log.Debugf("ready to analyze HTTP/2 protocol data, connection ID:
%d", metrics.(*HTTP2Metrics).connectionID)
http2Metrics := metrics.(*HTTP2Metrics)
+ http2Log.Debugf("ready to analyze HTTP/2 protocol data, connection ID:
%d, random ID: %d",
+ http2Metrics.connectionID, http2Metrics.randomID)
buf.ResetForLoopReading()
for {
if !buf.PrepareForReading() {
@@ -203,7 +206,11 @@ func (r *HTTP2Protocol)
validateIsStreamOpenTooLong(metrics *HTTP2Metrics, id ui
}
// is the body sending too long, then split the stream
- if
time.Since(host.Time(streaming.respBodyBuffer.FirstSocketBuffer().StartTime()))
> maxHTTP2StreamingTime {
+ socketBuffer := streaming.reqBodyBuffer.FirstSocketBuffer()
+ if socketBuffer == nil {
+ return
+ }
+ if time.Since(host.Time(socketBuffer.StartTime())) >
maxHTTP2StreamingTime {
http2Log.Infof("detect the HTTP/2 stream is too long, split the
stream, connection ID: %d, stream ID: %d, headers: %v",
metrics.connectionID, id, streaming.reqHeader)
diff --git a/pkg/accesslog/collector/protocols/protocol.go
b/pkg/accesslog/collector/protocols/protocol.go
index 4c415c2..44c42a4 100644
--- a/pkg/accesslog/collector/protocols/protocol.go
+++ b/pkg/accesslog/collector/protocols/protocol.go
@@ -54,7 +54,7 @@ type AnalyzeHelper struct {
}
type Protocol interface {
- GenerateConnection(connectionID uint64) ProtocolMetrics
+ GenerateConnection(connectionID, randomID uint64) ProtocolMetrics
Analyze(metrics ProtocolMetrics, buffer *buffer.Buffer, helper
*AnalyzeHelper) error
}
diff --git a/pkg/accesslog/collector/protocols/queue.go
b/pkg/accesslog/collector/protocols/queue.go
index 2c12c7a..9c38826 100644
--- a/pkg/accesslog/collector/protocols/queue.go
+++ b/pkg/accesslog/collector/protocols/queue.go
@@ -102,7 +102,7 @@ func newPartitionConnection(protocolMgr *ProtocolManager,
conID, randomID uint64
dataBuffer: buffer.NewBuffer(),
protocol: protocol,
protocolAnalyzer: analyzer,
- protocolMetrics: analyzer.GenerateConnection(conID),
+ protocolMetrics: analyzer.GenerateConnection(conID, randomID),
}
}
@@ -162,8 +162,11 @@ func (p *PartitionContext) Start(ctx context.Context) {
func (p *PartitionContext) Consume(data interface{}) {
switch event := data.(type) {
case *events.SocketDetailEvent:
- log.Debugf("receive the socket detail event, connection ID: %d,
random ID: %d, data id: %d, function name: %s",
- event.ConnectionID, event.RandomID, event.DataID0,
event.FunctionName)
+ pid, _ := events.ParseConnectionID(event.ConnectionID)
+ log.Debugf("receive the socket detail event, connection ID: %d,
random ID: %d, pid: %d, data id: %d, "+
+ "function name: %s, package count: %d, package size:
%d, l4 duration: %d",
+ event.ConnectionID, event.RandomID, pid, event.DataID0,
event.FunctionName,
+ event.L4PackageCount, event.L4TotalPackageSize,
event.L4Duration)
if event.Protocol == enums.ConnectionProtocolUnknown {
// if the connection protocol is unknown, we just needs
to add this into the kernel log
forwarder.SendTransferNoProtocolEvent(p.context, event)
@@ -172,8 +175,9 @@ func (p *PartitionContext) Consume(data interface{}) {
connection := p.getConnectionContext(event.GetConnectionID(),
event.GetRandomID(), event.Protocol)
connection.appendDetail(p.context, event)
case *events.SocketDataUploadEvent:
- log.Debugf("receive the socket data event, connection ID: %d,
random ID: %d, data id: %d, sequence: %d, protocol: %d",
- event.ConnectionID, event.RandomID, event.DataID0,
event.Sequence0, event.Protocol)
+ pid, _ := events.ParseConnectionID(event.ConnectionID)
+ log.Debugf("receive the socket data event, connection ID: %d,
random ID: %d, pid: %d, data id: %d, sequence: %d, protocol: %d",
+ event.ConnectionID, event.RandomID, pid, event.DataID0,
event.Sequence0, event.Protocol)
connection := p.getConnectionContext(event.ConnectionID,
event.RandomID, event.Protocol)
connection.appendData(event)
}
diff --git a/pkg/accesslog/collector/tls.go b/pkg/accesslog/collector/tls.go
index f6ce7d9..41c8811 100644
--- a/pkg/accesslog/collector/tls.go
+++ b/pkg/accesslog/collector/tls.go
@@ -67,7 +67,7 @@ func (c *TLSCollector) OnNewProcessMonitoring(pid int32) {
register.OpenSSL(c.context.BPF.OpensslSymaddrMap,
c.context.BPF.OpensslWrite, c.context.BPF.OpensslWriteRet,
c.context.BPF.OpensslRead, c.context.BPF.OpensslReadRet)
- register.OpenSSL(nil, c.context.BPF.OpensslWrite,
c.context.BPF.OpensslWriteRet,
+ register.Envoy(nil, c.context.BPF.OpensslWrite,
c.context.BPF.OpensslWriteRet,
c.context.BPF.OpensslRead, c.context.BPF.OpensslReadRet)
register.GoTLS(c.context.BPF.GoTlsArgsSymaddrMap,
c.context.BPF.GoTlsWrite, c.context.BPF.GoTlsWriteRet,
diff --git a/pkg/accesslog/common/config.go b/pkg/accesslog/common/config.go
index de1bcee..0e8af16 100644
--- a/pkg/accesslog/common/config.go
+++ b/pkg/accesslog/common/config.go
@@ -22,9 +22,10 @@ import "github.com/apache/skywalking-rover/pkg/module"
type Config struct {
module.Config
- Active bool `mapstructure:"active"`
- Flush FlushConfig `mapstructure:"flush"`
- ProtocolAnalyze ProtocolAnalyzeConfig `mapstructure:"protocol_analyze"`
+ Active bool `mapstructure:"active"`
+ ExcludeNamespaces string
`mapstructure:"exclude_namespaces"`
+ Flush FlushConfig `mapstructure:"flush"`
+ ProtocolAnalyze ProtocolAnalyzeConfig
`mapstructure:"protocol_analyze"`
}
type FlushConfig struct {
diff --git a/pkg/accesslog/common/connection.go
b/pkg/accesslog/common/connection.go
index 91987e0..bb64ff8 100644
--- a/pkg/accesslog/common/connection.go
+++ b/pkg/accesslog/common/connection.go
@@ -20,8 +20,12 @@ package common
import (
"errors"
"fmt"
+ "strings"
+ "sync"
"time"
+ "github.com/sirupsen/logrus"
+
"github.com/apache/skywalking-rover/pkg/accesslog/bpf"
"github.com/apache/skywalking-rover/pkg/accesslog/events"
"github.com/apache/skywalking-rover/pkg/module"
@@ -42,7 +46,8 @@ import (
v3 "skywalking.apache.org/repo/goapi/collect/ebpf/accesslog/v3"
)
-const localAddressPairCacheTime = time.Hour * 6
+// only using to match the remote IP address
+const localAddressPairCacheTime = time.Second * 15
type addressProcessType int
@@ -52,6 +57,11 @@ const (
addressProcessTypeKubernetes
)
+const (
+ strLocal = "local"
+ strRemote = "remote"
+)
+
type ConnectEventWithSocket struct {
*events.SocketConnectEvent
SocketPair *ip.SocketPair
@@ -79,16 +89,20 @@ type ConnectionManager struct {
connections cmap.ConcurrentMap
// addressWithPid cache all local ip+port and pid mapping for match the
process on the same host
// such as service mesh(process with envoy)
- addressWithPid *cache.Expiring
+ addressWithPid *cache.Expiring
+ localPortWithPid *cache.Expiring // in some case, we can only get the
127.0.0.1 from server side, so we only cache the port for this
// localIPWithPid cache all local monitoring process bind IP address
// for checking the remote address is local or not
localIPWithPid map[string]int32
// monitoringProcesses management all monitoring processes
- monitoringProcesses map[int32][]api.ProcessInterface
+ monitoringProcesses map[int32][]api.ProcessInterface
+ monitoringProcessLock sync.RWMutex
// monitoring process map in BPF
processMonitorMap *ebpf.Map
activeConnectionMap *ebpf.Map
+ excludeNamespaces map[string]bool
+
processors []ConnectionProcessor
processListeners []ProcessListener
@@ -105,27 +119,34 @@ func (c *ConnectionManager) AddProcessListener(listener
ProcessListener) {
}
type addressInfo struct {
- pid uint32
- processType addressProcessType
+ pid uint32
}
type ConnectionInfo struct {
+ ConnectionID uint64
+ RandomID uint64
RPCConnection *v3.AccessLogConnection
MarkDeletable bool
PID uint32
}
-func NewConnectionManager(moduleMgr *module.Manager, bpfLoader *bpf.Loader)
*ConnectionManager {
+func NewConnectionManager(config *Config, moduleMgr *module.Manager, bpfLoader
*bpf.Loader) *ConnectionManager {
+ excludeNamespaces := make(map[string]bool)
+ for _, ns := range strings.Split(config.ExcludeNamespaces, ",") {
+ excludeNamespaces[ns] = true
+ }
mgr := &ConnectionManager{
moduleMgr: moduleMgr,
processOP:
moduleMgr.FindModule(process.ModuleName).(process.Operator),
connections: cmap.New(),
addressWithPid: cache.NewExpiring(),
+ localPortWithPid: cache.NewExpiring(),
localIPWithPid: make(map[string]int32),
monitoringProcesses:
make(map[int32][]api.ProcessInterface),
processMonitorMap: bpfLoader.ProcessMonitorControl,
activeConnectionMap: bpfLoader.ActiveConnectionMap,
allUnfinishedConnections: make(map[string]*bool),
+ excludeNamespaces: excludeNamespaces,
}
return mgr
}
@@ -157,25 +178,60 @@ func (c *ConnectionManager) Find(event events.Event)
*ConnectionInfo {
if e, socket := getSocketPairFromConnectEvent(event); e != nil &&
socket != nil {
var localAddress, remoteAddress *v3.ConnectionAddress
localPID, _ := events.ParseConnectionID(event.GetConnectionID())
- localAddress =
c.buildAddressFromLocalKubernetesProcess(localPID, socket.SrcPort,
addressProcessTypeKubernetes)
- // trying to get the remote process if in the same host
- remoteAddressInfo, ok :=
c.addressWithPid.Get(fmt.Sprintf("%s_%d", socket.DestIP, socket.DestPort))
- if ok && remoteAddressInfo != nil {
- address := remoteAddressInfo.(*addressInfo)
- remoteAddress =
c.buildAddressFromLocalKubernetesProcess(address.pid, socket.DestPort,
address.processType)
- } else if c.isLocalTarget(socket) != addressProcessTypeLocal {
- remoteAddress = c.buildAddressFromRemote(socket.DestIP,
socket.DestPort)
- }
+ localAddress =
c.buildAddressFromLocalKubernetesProcess(localPID, socket.SrcPort)
+ remoteAddress = c.buildRemoteAddress(e, socket)
if localAddress == nil || remoteAddress == nil {
return nil
}
connection := c.buildConnection(e, socket, localAddress,
remoteAddress)
c.connections.Set(connectionKey, connection)
+ if log.Enable(logrus.DebugLevel) {
+ log.Debugf("building flushing connection, connection
ID: %d, randomID: %d, role: %s, local: %s:%d, remote: %s:%d, "+
+ "local address: %s, remote address: %s",
+ e.GetConnectionID(), e.GetRandomID(),
socket.Role, socket.SrcIP, socket.SrcPort, socket.DestIP, socket.DestPort,
+ localAddress.String(), remoteAddress.String())
+ }
return connection
}
return nil
}
+func (c *ConnectionManager) buildRemoteAddress(e *events.SocketConnectEvent,
socket *ip.SocketPair) *v3.ConnectionAddress {
+ tp := c.isLocalTarget(socket)
+ if tp == addressProcessTypeUnknown {
+ log.Debugf("building the remote address to unknown, connection:
%d-%d, role: %s, local: %s:%d, remote: %s:%d",
+ e.GetConnectionID(), e.GetRandomID(), socket.Role,
socket.SrcIP, socket.SrcPort, socket.DestIP, socket.DestPort)
+ return c.buildAddressFromRemote(socket.DestIP, socket.DestPort)
+ }
+
+ var addrInfo *addressInfo
+ var fromType string
+ switch socket.Role {
+ case enums.ConnectionRoleClient:
+ addrInfo = c.getAddressPid(socket.SrcIP, socket.SrcPort, false)
+ fromType = strLocal
+ case enums.ConnectionRoleServer:
+ addrInfo = c.getAddressPid(socket.DestIP, socket.DestPort, true)
+ fromType = strRemote
+ }
+
+ if addrInfo != nil {
+ log.Debugf("building the remote address from %s process, pid:
%d, connection: %d-%d, role: %s, local: %s:%d, remote: %s:%d",
+ fromType, addrInfo.pid, e.GetConnectionID(),
e.GetRandomID(), socket.Role, socket.SrcIP, socket.SrcPort, socket.DestIP,
socket.DestPort)
+ return c.buildAddressFromLocalKubernetesProcess(addrInfo.pid,
socket.DestPort)
+ } else if tp == addressProcessTypeKubernetes {
+ if p := c.localIPWithPid[socket.DestIP]; p != 0 {
+ log.Debugf("building the remote address from kubernetes
process, connection: %d-%d, role: %s, pid: %d, local: %s:%d, remote: %s:%d",
+ e.GetConnectionID(), e.GetRandomID(),
socket.Role, p, socket.SrcIP, socket.SrcPort, socket.DestIP, socket.DestPort)
+ return
c.buildAddressFromLocalKubernetesProcess(uint32(p), socket.DestPort)
+ }
+ }
+
+ log.Debugf("cannot found the peer pid for the connection: %d-%d, remote
type: %v, role: %s, local: %s:%d, remote: %s:%d",
+ e.GetConnectionID(), e.GetRandomID(), tp, socket.Role,
socket.SrcIP, socket.SrcPort, socket.DestIP, socket.DestPort)
+ return nil
+}
+
func (c *ConnectionManager) connectionPostHandle(connection *ConnectionInfo,
event events.Event) {
if connection == nil {
return
@@ -192,10 +248,20 @@ func (c *ConnectionManager)
connectionPostHandle(connection *ConnectionInfo, eve
if e.SSL == 1 && connection.RPCConnection.TlsMode ==
v3.AccessLogConnectionTLSMode_Plain {
connection.RPCConnection.TlsMode =
v3.AccessLogConnectionTLSMode_TLS
}
+ if e.Protocol != enums.ConnectionProtocolUnknown &&
connection.RPCConnection.Protocol == v3.AccessLogProtocolType_TCP {
+ switch e.Protocol {
+ case enums.ConnectionProtocolHTTP:
+ connection.RPCConnection.Protocol =
v3.AccessLogProtocolType_HTTP_1
+ case enums.ConnectionProtocolHTTP2:
+ connection.RPCConnection.Protocol =
v3.AccessLogProtocolType_HTTP_2
+ }
+ }
}
}
func (c *ConnectionManager) ProcessIsMonitor(pid uint32) bool {
+ c.monitoringProcessLock.RLock()
+ defer c.monitoringProcessLock.RUnlock()
return len(c.monitoringProcesses[int32(pid)]) > 0
}
@@ -209,18 +275,23 @@ func (c *ConnectionManager) buildConnection(event
*events.SocketConnectEvent, so
role = v32.DetectPoint_server
}
connection := &v3.AccessLogConnection{
- Local: local,
- Remote: remote,
- Role: role,
- TlsMode: v3.AccessLogConnectionTLSMode_Plain,
+ Local: local,
+ Remote: remote,
+ Role: role,
+ TlsMode: v3.AccessLogConnectionTLSMode_Plain,
+ Protocol: v3.AccessLogProtocolType_TCP,
}
return &ConnectionInfo{
+ ConnectionID: event.ConID,
+ RandomID: event.RandomID,
RPCConnection: connection,
PID: event.PID,
}
}
-func (c *ConnectionManager) buildAddressFromLocalKubernetesProcess(pid uint32,
port uint16, _ addressProcessType) *v3.ConnectionAddress {
+func (c *ConnectionManager) buildAddressFromLocalKubernetesProcess(pid uint32,
port uint16) *v3.ConnectionAddress {
+ c.monitoringProcessLock.RLock()
+ defer c.monitoringProcessLock.RUnlock()
for _, pi := range c.monitoringProcesses[int32(pid)] {
if pi.DetectType() == api.Kubernetes {
entity := pi.Entity()
@@ -270,13 +341,56 @@ func (c *ConnectionManager) OnConnectionClose(event
*events.SocketCloseEvent) *C
return result
}
+func (c *ConnectionManager) savingTheAddress(host string, port uint16,
localPid bool, pid uint32) {
+ localAddrInfo := &addressInfo{
+ pid: pid,
+ }
+ c.addressWithPid.Set(fmt.Sprintf("%s_%d_%t", host, port, localPid),
localAddrInfo, localAddressPairCacheTime)
+ localStr := strRemote
+ if localPid {
+ localStr = strLocal
+ }
+ log.Debugf("saving the %s address with pid cache, address: %s:%d, pid:
%d", localStr, host, port, pid)
+}
+
+func (c *ConnectionManager) getAddressPid(host string, port uint16, localPid
bool) *addressInfo {
+ addrInfo, ok := c.addressWithPid.Get(fmt.Sprintf("%s_%d_%t", host,
port, localPid))
+ if ok && addrInfo != nil {
+ return addrInfo.(*addressInfo)
+ }
+ return nil
+}
+
func (c *ConnectionManager) OnConnectEvent(event *events.SocketConnectEvent,
pair *ip.SocketPair) {
// only adding the local ip port when remote is local address
- if tp := c.isLocalTarget(pair); tp != addressProcessTypeUnknown {
- c.addressWithPid.Set(fmt.Sprintf("%s_%d", pair.SrcIP,
pair.SrcPort), &addressInfo{
- pid: event.PID,
- processType: tp,
- }, localAddressPairCacheTime)
+ switch c.isLocalTarget(pair) {
+ case addressProcessTypeUnknown:
+ log.Debugf("the target address is not local, so no needs to
save the cache. "+
+ "address: %s:%d, pid: %d", pair.DestIP, pair.DestPort,
event.PID)
+ case addressProcessTypeLocal:
+ switch pair.Role {
+ case enums.ConnectionRoleClient:
+ // if current is client, so the local port should be
unique
+ c.savingTheAddress(pair.SrcIP, pair.SrcPort, true,
event.PID)
+ case enums.ConnectionRoleServer:
+ // if current is server, so the remote port should be
unique
+ c.savingTheAddress(pair.DestIP, pair.DestPort, false,
event.PID)
+ case enums.ConnectionRoleUnknown:
+ log.Debugf("the target address local but unknown role,
so no needs to save the cache. socket: [%s], pid: %d",
+ pair, event.PID)
+ }
+ case addressProcessTypeKubernetes:
+ switch pair.Role {
+ case enums.ConnectionRoleClient:
+ // if current is client, so the local port should be
unique
+ c.savingTheAddress(pair.SrcIP, pair.SrcPort, true,
event.PID)
+ case enums.ConnectionRoleServer:
+ // if current is server, so the remote port should be
unique
+ c.savingTheAddress(pair.DestIP, pair.DestPort, false,
event.PID)
+ case enums.ConnectionRoleUnknown:
+ log.Debugf("the target address kubernetes but unknown
role, so no needs to save the cache. socket: [%s], pid: %d",
+ pair, event.PID)
+ }
}
}
@@ -292,6 +406,15 @@ func (c *ConnectionManager) isLocalTarget(pair
*ip.SocketPair) addressProcessTyp
}
func (c *ConnectionManager) AddNewProcess(pid int32, entities
[]api.ProcessInterface) {
+ // filtering the namespace
+ if c.shouldExcludeTheProcess(entities) {
+ c.RemoveProcess(pid, entities)
+ return
+ }
+
+ c.monitoringProcessLock.Lock()
+ defer c.monitoringProcessLock.Unlock()
+
// adding monitoring process and IP addresses
c.monitoringProcesses[pid] = entities
c.updateMonitorStatusForProcess(pid, true)
@@ -300,28 +423,72 @@ func (c *ConnectionManager) AddNewProcess(pid int32,
entities []api.ProcessInter
c.localIPWithPid[host] = pid
}
}
+ c.printTotalAddressesWithPid("adding monitoring process")
for _, l := range c.processListeners {
l.OnNewProcessMonitoring(pid)
}
}
+func (c *ConnectionManager) rebuildLocalIPWithPID() {
+ result := make(map[string]int32)
+ for pid, entities := range c.monitoringProcesses {
+ for _, entity := range entities {
+ for _, host := range entity.ExposeHosts() {
+ result[host] = pid
+ }
+ }
+ }
+ c.localIPWithPid = result
+}
+
+func (c *ConnectionManager) printTotalAddressesWithPid(prefix string) {
+ if !log.Enable(logrus.DebugLevel) {
+ return
+ }
+ log.Debugf("%s, print all local address with pid", prefix)
+ log.Debugf("----------------------------")
+ log.Debugf("total local address with pid: %d", len(c.localIPWithPid))
+ for k, v := range c.localIPWithPid {
+ log.Debugf("local address: %s, pid: %d", k, v)
+ }
+ log.Debugf("----------------------------")
+}
+
+func (c *ConnectionManager) shouldExcludeTheProcess(entities
[]api.ProcessInterface) bool {
+ for _, entity := range entities {
+ if entity.DetectType() == api.Kubernetes {
+ namespace :=
entity.DetectProcess().(*kubernetes.Process).PodContainer().Pod.Namespace
+ if c.excludeNamespaces[namespace] {
+ return true
+ }
+ }
+ }
+ return false
+}
+
func (c *ConnectionManager) RemoveProcess(pid int32, entities
[]api.ProcessInterface) {
+ c.monitoringProcessLock.Lock()
+ defer c.monitoringProcessLock.Unlock()
// delete monitoring process and IP addresses
delete(c.monitoringProcesses, pid)
c.updateMonitorStatusForProcess(pid, false)
- for _, entity := range entities {
- for _, host := range entity.ExposeHosts() {
- delete(c.localIPWithPid, host)
- }
- }
+ c.rebuildLocalIPWithPID()
+ c.printTotalAddressesWithPid("remove monitoring process")
for _, l := range c.processListeners {
l.OnProcessRemoved(pid)
}
}
func (c *ConnectionManager) RecheckAllProcesses(processes
map[int32][]api.ProcessInterface) {
+ shouldMonitoringProcesses := make(map[int32][]api.ProcessInterface)
+ for pid, p := range processes {
+ if c.shouldExcludeTheProcess(p) {
+ continue
+ }
+ shouldMonitoringProcesses[pid] = p
+ }
// checking the monitoring process
- c.monitoringProcesses = processes
+ c.monitoringProcesses = shouldMonitoringProcesses
// for-each the existing monitored map, it should not be monitored,
then remote it
iterate := c.processMonitorMap.Iterate()
processInBPF := make(map[int32]bool)
@@ -350,16 +517,7 @@ func (c *ConnectionManager) RecheckAllProcesses(processes
map[int32][]api.Proces
}
// update all IP addresses
- result := make(map[string]int32)
- for _, p := range processes {
- for _, entity := range p {
- for _, host := range entity.ExposeHosts() {
- result[host] = entity.Pid()
- }
- }
- }
-
- c.localIPWithPid = result
+ c.rebuildLocalIPWithPID()
}
func (c *ConnectionManager) updateMonitorStatusForProcess(pid int32, monitor
bool) {
@@ -374,6 +532,8 @@ func (c *ConnectionManager)
updateMonitorStatusForProcess(pid int32, monitor boo
return
}
log.Warnf("failed to update the process %d monitor status to
%t: %v", pid, monitor, err)
+ } else {
+ log.Debugf("update the process %d monitor status to %t", pid,
monitor)
}
}
diff --git a/pkg/accesslog/common/queue.go b/pkg/accesslog/common/queue.go
index 0cf15c8..6a0fc6f 100644
--- a/pkg/accesslog/common/queue.go
+++ b/pkg/accesslog/common/queue.go
@@ -23,6 +23,8 @@ import (
"sync/atomic"
"time"
+ "github.com/sirupsen/logrus"
+
"github.com/apache/skywalking-rover/pkg/accesslog/events"
"github.com/apache/skywalking-rover/pkg/logger"
@@ -134,8 +136,12 @@ func (q *Queue) Start(ctx context.Context) {
func (q *Queue) consume() {
if !q.consumeLock.TryLock() {
+ log.Debugf("consume lock is locked, skip this consume")
return
}
defer q.consumeLock.Unlock()
+ if log.Enable(logrus.DebugLevel) {
+ log.Debugf("start to consume kernel logs: %d, protocol logs:
%d", len(q.kernelLogs), len(q.protocolLogs))
+ }
q.consumer.Consume(q.kernelLogs, q.protocolLogs)
}
diff --git a/pkg/accesslog/events/connect.go b/pkg/accesslog/events/connect.go
index 3e2a72b..dec4143 100644
--- a/pkg/accesslog/events/connect.go
+++ b/pkg/accesslog/events/connect.go
@@ -36,14 +36,14 @@ type SocketConnectEvent struct {
ConnectSuccess uint8
Pad0 uint32
RemoteAddrV4 uint32
- RemoteAddrV6 [16]uint8
RemoteAddrPort uint32
+ RemoteAddrV6 [16]uint8
LocalAddrV4 uint32
- LocalAddrV6 [16]uint8
LocalAddrPort uint32
- ConnTrackUpstreamPort uint32
- ConnTrackUpstreamIPh uint64
+ LocalAddrV6 [16]uint8
ConnTrackUpstreamIPl uint64
+ ConnTrackUpstreamIPh uint64
+ ConnTrackUpstreamPort uint32
}
func (c *SocketConnectEvent) GetConnectionID() uint64 {
diff --git a/pkg/accesslog/runner.go b/pkg/accesslog/runner.go
index 0571b4a..2cab4f7 100644
--- a/pkg/accesslog/runner.go
+++ b/pkg/accesslog/runner.go
@@ -22,6 +22,8 @@ import (
"fmt"
"time"
+ "github.com/sirupsen/logrus"
+
"github.com/apache/skywalking-rover/pkg/accesslog/bpf"
"github.com/apache/skywalking-rover/pkg/accesslog/collector"
"github.com/apache/skywalking-rover/pkg/accesslog/common"
@@ -38,7 +40,7 @@ import (
v3 "skywalking.apache.org/repo/goapi/collect/ebpf/accesslog/v3"
)
-const kernelAccessLogCacheTime = time.Minute * 5
+const kernelAccessLogCacheTime = time.Second * 10
var log = logger.GetLogger("access_log", "runner")
@@ -47,6 +49,7 @@ type Runner struct {
collectors []collector.Collector
mgr *module.Manager
backendOp backend.Operator
+ cluster string
alsClient v3.EBPFAccessLogServiceClient
ctx context.Context
}
@@ -60,16 +63,19 @@ func NewRunner(mgr *module.Manager, config *common.Config)
(*Runner, error) {
if err != nil {
return nil, fmt.Errorf("parse flush period error: %v", err)
}
- backendOP :=
mgr.FindModule(core.ModuleName).(core.Operator).BackendOperator()
+ coreModule := mgr.FindModule(core.ModuleName).(core.Operator)
+ backendOP := coreModule.BackendOperator()
+ clusterName := coreModule.ClusterName()
runner := &Runner{
context: &common.AccessLogContext{
BPF: bpfLoader,
Config: config,
- ConnectionMgr: common.NewConnectionManager(mgr,
bpfLoader),
+ ConnectionMgr: common.NewConnectionManager(config, mgr,
bpfLoader),
},
collectors: collector.Collectors(),
mgr: mgr,
backendOp: backendOP,
+ cluster: clusterName,
alsClient:
v3.NewEBPFAccessLogServiceClient(backendOP.GetConnection()),
}
runner.context.Queue = common.NewQueue(config.Flush.MaxCountOneStream,
flushDuration, runner)
@@ -126,6 +132,8 @@ func (r *Runner) buildKernelLogs(kernels chan
*common.KernelLog, result map[*com
select {
case kernelLog := <-kernels:
connection, curLog, delay := r.buildKernelLog(kernelLog)
+ log.Debugf("building kernel log result, connetaion ID:
%d, random ID: %d, exist connection: %t, delay: %t",
+ kernelLog.Event.GetConnectionID(),
kernelLog.Event.GetRandomID(), connection != nil, delay)
if connection != nil && curLog != nil {
logs, exist := result[connection]
if !exist {
@@ -139,7 +147,11 @@ func (r *Runner) buildKernelLogs(kernels chan
*common.KernelLog, result map[*com
}
default:
for _, delayAppend := range delayAppends {
- kernels <- delayAppend
+ select {
+ case kernels <- delayAppend:
+ default:
+ return
+ }
}
return
}
@@ -152,6 +164,15 @@ func (r *Runner) buildProtocolLogs(protocols chan
*common.ProtocolLog, result ma
select {
case protocolLog := <-protocols:
connection, kernelLogs, protocolLogs, delay :=
r.buildProtocolLog(protocolLog)
+ if log.Enable(logrus.DebugLevel) {
+ kernelLogCount := len(protocolLog.KernelLogs)
+ var conID, randomID uint64
+ if kernelLogCount > 0 {
+ conID, randomID =
protocolLog.KernelLogs[0].GetConnectionID(),
protocolLog.KernelLogs[0].GetRandomID()
+ }
+ log.Debugf("building protocol log result,
connetaion ID: %d, random ID: %d, connection exist: %t, delay: %t",
+ conID, randomID, connection != nil,
delay)
+ }
if connection != nil && len(kernelLogs) > 0 &&
protocolLogs != nil {
logs, exist := result[connection]
if !exist {
@@ -167,7 +188,11 @@ func (r *Runner) buildProtocolLogs(protocols chan
*common.ProtocolLog, result ma
}
default:
for _, delayAppend := range delayAppends {
- protocols <- delayAppend
+ select {
+ case protocols <- delayAppend:
+ default:
+ return
+ }
}
return
}
@@ -175,7 +200,9 @@ func (r *Runner) buildProtocolLogs(protocols chan
*common.ProtocolLog, result ma
}
func (r *Runner) sendLogs(allLogs map[*common.ConnectionInfo]*connectionLogs)
error {
- streaming, err := r.alsClient.Collect(r.ctx)
+ timeout, cancelFunc := context.WithTimeout(r.ctx, time.Second*20)
+ defer cancelFunc()
+ streaming, err := r.alsClient.Collect(timeout)
if err != nil {
return err
}
@@ -212,6 +239,11 @@ func (r *Runner) buildAccessLogMessage(firstLog,
firstConnection bool, conn *com
var rpcCon *v3.AccessLogConnection
if firstConnection {
rpcCon = conn.RPCConnection
+ if log.Enable(logrus.DebugLevel) {
+ log.Debugf("ready to sending access log with
connection, connection ID: %d, random ID: %d, "+
+ "local: %s, remote: %s, role: %s",
+ conn.ConnectionID, conn.RandomID, rpcCon.Local,
rpcCon.Remote, rpcCon.Role)
+ }
}
return &v3.EBPFAccessLogMessage{
Node: r.BuildNodeInfo(firstLog),
@@ -237,6 +269,7 @@ func (r *Runner) BuildNodeInfo(needs bool)
*v3.EBPFAccessLogNodeInfo {
Name:
r.mgr.FindModule(process.ModuleName).(process.K8sOperator).NodeName(),
NetInterfaces: netInterfaces,
BootTime: r.convertTimeToInstant(host.BootTime),
+ ClusterName: r.cluster,
}
}
diff --git a/pkg/core/api.go b/pkg/core/api.go
index a05a33f..6ea2497 100644
--- a/pkg/core/api.go
+++ b/pkg/core/api.go
@@ -23,6 +23,8 @@ import "github.com/apache/skywalking-rover/pkg/core/backend"
type Operator interface {
// InstanceId of Rover
InstanceID() string
+ // ClusterName of Rover
+ ClusterName() string
// BackendOperator for operate with backend client
BackendOperator() backend.Operator
}
diff --git a/pkg/core/config.go b/pkg/core/config.go
index 5d7a4f8..f7ee4a8 100644
--- a/pkg/core/config.go
+++ b/pkg/core/config.go
@@ -26,6 +26,7 @@ type Config struct {
// module common config
module.Config `mapstructure:",squash"`
+ ClusterName string `mapstructure:"cluster_name"`
// backend connection
BackendConfig *backend.Config `mapstructure:"backend"`
}
diff --git a/pkg/core/module.go b/pkg/core/module.go
index 7670b1a..3d57839 100644
--- a/pkg/core/module.go
+++ b/pkg/core/module.go
@@ -34,6 +34,7 @@ type Module struct {
config *Config
instanceID string
+ clusterName string
backendClient *backend.Client
}
@@ -53,9 +54,14 @@ func (m *Module) Config() module.ConfigInterface {
return m.config
}
+func (m *Module) ClusterName() string {
+ return m.clusterName
+}
+
func (m *Module) Start(ctx context.Context, mgr *module.Manager) error {
// generate instance id
m.instanceID = uuid.New().String()
+ m.clusterName = m.config.ClusterName
// backend client
if m.config.BackendConfig != nil {
m.backendClient = backend.NewClient(m.config.BackendConfig)
diff --git a/pkg/process/finders/kubernetes/finder.go
b/pkg/process/finders/kubernetes/finder.go
index 14522d6..3444cc7 100644
--- a/pkg/process/finders/kubernetes/finder.go
+++ b/pkg/process/finders/kubernetes/finder.go
@@ -41,6 +41,7 @@ import (
v3 "skywalking.apache.org/repo/goapi/collect/ebpf/profiling/process/v3"
+ "github.com/apache/skywalking-rover/pkg/core"
"github.com/apache/skywalking-rover/pkg/logger"
"github.com/apache/skywalking-rover/pkg/process/api"
"github.com/apache/skywalking-rover/pkg/process/finders/base"
@@ -55,6 +56,7 @@ type ProcessFinder struct {
conf *Config
// runtime
+ clusterName string
manager base.ProcessManager
ctx context.Context
cancelCtx context.CancelFunc
@@ -71,6 +73,7 @@ type ProcessFinder struct {
}
func (f *ProcessFinder) Init(ctx context.Context, conf base.FinderBaseConfig,
manager base.ProcessManager) error {
+ f.clusterName =
manager.GetModuleManager().FindModule(core.ModuleName).(core.Operator).ClusterName()
k8sConf, cli, err := f.validateConfig(ctx, conf.(*Config))
if err != nil {
return err
@@ -178,7 +181,7 @@ func (f *ProcessFinder) buildProcess(p *process.Process,
detectedProcesses []api
for _, pro := range cachedProcesses.([]*Process) {
detectedProcesses = append(detectedProcesses, pro)
}
- return detectedProcesses, false
+ return detectedProcesses, true
}
cgroups, err := f.getProcessCGroup(p.Pid)
@@ -246,6 +249,10 @@ func (f *ProcessFinder) buildProcesses(p *process.Process,
pc *PodContainer) ([]
if err != nil {
return nil, err
}
+ // adding the cluster name into the service name
+ if f.clusterName != "" {
+ entity.ServiceName = fmt.Sprintf("%s::%s",
f.clusterName, entity.ServiceName)
+ }
processes = append(processes, NewProcess(p, cmdline, pc,
entity))
}
@@ -375,6 +382,21 @@ func (f *ProcessFinder) ParseProcessID(ps
api.DetectedProcess, downstream *v3.EB
}
func (f *ProcessFinder) ShouldMonitor(pid int32) bool {
+ pidList, err := process.Pids()
+ if err != nil {
+ return false
+ }
+ pidExist := false
+ for _, p := range pidList {
+ if p == pid {
+ pidExist = true
+ break
+ }
+ }
+ if !pidExist {
+ return false
+ }
+
newProcess, err := process.NewProcess(pid)
if err != nil {
return false
diff --git a/pkg/process/finders/manager.go b/pkg/process/finders/manager.go
index 03ecf69..0d6aee7 100644
--- a/pkg/process/finders/manager.go
+++ b/pkg/process/finders/manager.go
@@ -121,6 +121,7 @@ func (p *ProcessManagerWithFinder) GetModuleManager()
*module.Manager {
func (p *ProcessManagerWithFinder) SyncAllProcessInFinder(processes
[]api.DetectedProcess) {
p.storage.SyncAllProcessInFinder(p.finderType, processes)
+ p.lastSync = processes
}
func (p *ProcessManagerWithFinder) AddDetectedProcess(processes
[]api.DetectedProcess) {
@@ -130,7 +131,7 @@ func (p *ProcessManagerWithFinder)
AddDetectedProcess(processes []api.DetectedPr
return
}
// fetch existing process, add the new processes, finally, re-sync
- detectedProcesses := make([]api.DetectedProcess,
len(processes)+len(p.lastSync))
+ detectedProcesses := make([]api.DetectedProcess, 0,
len(processes)+len(p.lastSync))
detectedProcesses = append(detectedProcesses, p.lastSync...)
detectedProcesses = append(detectedProcesses, processes...)
p.SyncAllProcessInFinder(detectedProcesses)
diff --git a/pkg/tools/buffer/buffer.go b/pkg/tools/buffer/buffer.go
index 45e518d..69542b5 100644
--- a/pkg/tools/buffer/buffer.go
+++ b/pkg/tools/buffer/buffer.go
@@ -240,7 +240,7 @@ func (r *Buffer) DataSize() int64 {
}
func (r *Buffer) FirstSocketBuffer() SocketDataBuffer {
- if r.dataEvents.Len() == 0 {
+ if r.dataEvents == nil || r.dataEvents.Len() == 0 {
return nil
}
return r.dataEvents.Front().Value.(SocketDataBuffer)
@@ -654,10 +654,16 @@ func (r *Buffer) DeleteExpireEvents(expireDuration
time.Duration) int {
}
func (r *Buffer) DataLength() int {
+ if r.dataEvents == nil {
+ return 0
+ }
return r.dataEvents.Len()
}
func (r *Buffer) DetailLength() int {
+ if r.detailEvents == nil {
+ return 0
+ }
return r.detailEvents.Len()
}
diff --git a/pkg/tools/ip.go b/pkg/tools/ip.go
index fe4d89c..24305b9 100644
--- a/pkg/tools/ip.go
+++ b/pkg/tools/ip.go
@@ -61,7 +61,7 @@ func IsLocalHostAddress(address string) bool {
return true
}
}
- return false
+ return address == "0.0.0.0"
}
// Hostname of machine
diff --git a/pkg/tools/ip/conntrack.go b/pkg/tools/ip/conntrack.go
new file mode 100644
index 0000000..4d58d28
--- /dev/null
+++ b/pkg/tools/ip/conntrack.go
@@ -0,0 +1,116 @@
+// 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 ip
+
+import (
+ "net"
+ "syscall"
+
+ "github.com/apache/skywalking-rover/pkg/logger"
+
+ "github.com/florianl/go-conntrack"
+
+ "golang.org/x/sys/unix"
+)
+
+var log = logger.GetLogger("tools", "ip")
+
+var numberStrategies = map[string]uint8{"tcp": syscall.IPPROTO_TCP, "udp":
syscall.IPPROTO_UDP}
+
+type ConnTrack struct {
+ tracker *conntrack.Nfct
+}
+
+func NewConnTrack() (*ConnTrack, error) {
+ nfct, err := conntrack.Open(&conntrack.Config{})
+ if err != nil {
+ return nil, err
+ }
+ return &ConnTrack{tracker: nfct}, nil
+}
+
+func (c *ConnTrack) UpdateRealPeerAddress(addr *SocketPair) bool {
+ family := conntrack.IPv4
+ if addr.Family == unix.AF_INET6 {
+ family = conntrack.IPv6
+ }
+
+ tuple := c.parseSocketToTuple(addr)
+ for name, strategy := range numberStrategies {
+ tuple.Proto.Number = &strategy
+
+ session, e := c.tracker.Get(conntrack.Conntrack, family,
conntrack.Con{Origin: tuple})
+ if e != nil {
+ // try to get the reply session, if the strategy not
exists or from accept events, have error is normal
+ log.Debugf("cannot get the conntrack session, strategy:
%s, error: %v", name, e)
+ continue
+ }
+
+ if res := c.filterValidateReply(session, tuple); res != nil {
+ addr.DestIP = res.Src.String()
+ return true
+ }
+ }
+
+ return false
+}
+
+func (c *ConnTrack) parseSocketToTuple(addr *SocketPair) *conntrack.IPTuple {
+ tcp := uint8(syscall.IPPROTO_TCP)
+ srcIP := net.ParseIP(addr.SrcIP)
+ dstIP := net.ParseIP(addr.DestIP)
+ var srcPort, dstPort = addr.SrcPort, addr.DestPort
+ return &conntrack.IPTuple{
+ Src: &srcIP,
+ Dst: &dstIP,
+ Proto: &conntrack.ProtoTuple{
+ Number: &tcp,
+ SrcPort: &srcPort,
+ DstPort: &dstPort,
+ },
+ }
+}
+
+func (c *ConnTrack) ipTupleValid(t *conntrack.IPTuple) bool {
+ if t == nil {
+ return false
+ }
+ if t.Src == nil || t.Dst == nil || t.Proto == nil {
+ return false
+ }
+ if t.Proto.SrcPort == nil || t.Proto.DstPort == nil {
+ return false
+ }
+ return true
+}
+
+func (c *ConnTrack) ipTuplesEqual(a, b *conntrack.IPTuple) bool {
+ return a.Src.Equal(*b.Src) && a.Dst.Equal(*b.Dst) && *a.Proto.SrcPort
== *b.Proto.SrcPort && *a.Proto.DstPort == *b.Proto.DstPort
+}
+
+func (c *ConnTrack) filterValidateReply(sessions []conntrack.Con, origin
*conntrack.IPTuple) (reply *conntrack.IPTuple) {
+ for inx := range sessions {
+ if !c.ipTupleValid(sessions[inx].Origin) ||
!c.ipTupleValid(sessions[inx].Reply) {
+ continue
+ }
+ if c.ipTuplesEqual(origin, sessions[inx].Origin) {
+ return sessions[inx].Reply
+ }
+ }
+ return nil
+}
diff --git a/pkg/tools/ip/tcpresolver.go b/pkg/tools/ip/tcpresolver.go
index 9c261f1..a07c216 100644
--- a/pkg/tools/ip/tcpresolver.go
+++ b/pkg/tools/ip/tcpresolver.go
@@ -20,6 +20,8 @@ package ip
import (
"fmt"
+ "github.com/sirupsen/logrus"
+
"github.com/apache/skywalking-rover/pkg/tools/enums"
processNet "github.com/shirou/gopsutil/net"
@@ -56,5 +58,17 @@ func ParseSocket(pid, sockfd uint32) (*SocketPair, error) {
}, nil
}
}
+ if log.Enable(logrus.DebugLevel) {
+ existConnections := make([]uint32, 0)
+ for _, conn := range connections {
+ existConnections = append(existConnections, conn.Fd)
+ }
+ log.Debugf("total connection in the pid: %d, exist connections:
%v", pid, existConnections)
+ }
return nil, fmt.Errorf("cannot found the connection, pid: %d, socket
FD: %d", pid, sockfd)
}
+
+func (s *SocketPair) String() string {
+ return fmt.Sprintf("family: %d, role: %s, srcIP: %s, srcPort: %d,
destIP: %s, destPort: %d",
+ s.Family, s.Role.String(), s.SrcIP, s.SrcPort, s.DestIP,
s.DestPort)
+}
diff --git a/pkg/tools/ssl/openssl.go b/pkg/tools/ssl/openssl.go
index dcd7d35..7d217da 100644
--- a/pkg/tools/ssl/openssl.go
+++ b/pkg/tools/ssl/openssl.go
@@ -64,6 +64,9 @@ func (r *Register) OpenSSL(symbolAddrMap *ebpf.Map, sslWrite,
sslWriteRet, sslRe
if err != nil {
return false, err
}
+ if addresses == nil {
+ return false, fmt.Errorf("could not found the symbol
address config")
+ }
if err := symbolAddrMap.Put(uint32(r.pid), addresses); err !=
nil {
return false, err
diff --git a/scripts/build/docker.mk b/scripts/build/docker.mk
index 6e6940c..6493796 100644
--- a/scripts/build/docker.mk
+++ b/scripts/build/docker.mk
@@ -20,12 +20,19 @@ docker: PLATFORMS =
docker: LOAD_OR_PUSH = --load
docker: build-base-container
docker: BASE_IMAGE_NAME = ${CONTAINER_COMMAND_IMAGE}
+docker: DOCKERFILE_NAME = Dockerfile.build
docker.push: PLATFORMS = ${CONTAINER_PLATFORMS}
docker.push: LOAD_OR_PUSH = --push
docker.push: build-base-container-with-multi-args
docker.push: BASE_IMAGE_NAME = localhost:5000/skywalking-rover-base
+docker.push: DOCKERFILE_NAME = Dockerfile.build
+docker.debug: PLATFORMS =
+docker.debug: LOAD_OR_PUSH = --load
+docker.debug: build-base-container
+docker.debug: BASE_IMAGE_NAME = ${CONTAINER_COMMAND_IMAGE}
+docker.debug: DOCKERFILE_NAME = Dockerfile.debug
-docker docker.push:
+docker docker.push docker.debug:
$(DOCKER_RULE)
define DOCKER_RULE
@@ -33,6 +40,6 @@ define DOCKER_RULE
--build-arg VERSION=$(VERSION) \
--build-arg
BASE_IMAGE=${BASE_IMAGE_NAME}:${CONTAINER_COMMAND_TAG} \
-t $(HUB)/skywalking-rover:latest \
- -t $(HUB)/skywalking-rover:$(VERSION) --no-cache . -f
docker/Dockerfile.build
+ -t $(HUB)/skywalking-rover:$(VERSION) --no-cache . -f
docker/$(DOCKERFILE_NAME)
@$(MAKE) build-base-container-with-multi-args-cleanup
endef
diff --git a/scripts/build/lint.mk b/scripts/build/lint.mk
index 0f65588..8dc0c6f 100644
--- a/scripts/build/lint.mk
+++ b/scripts/build/lint.mk
@@ -19,7 +19,7 @@
GO_LINT = $(GO_PATH)/bin/golangci-lint
linter:
- $(GO_LINT) version || curl -sfL
https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh
-s -- -b $(GO_PATH)/bin v1.50.0
+ $(GO_LINT) version || curl -sfL
https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh
-s -- -b $(GO_PATH)/bin v1.52.0
.PHONY: lint
lint: linter generate
diff --git a/test/e2e/cases/process/istio/e2e.yaml
b/test/e2e/cases/process/istio/e2e.yaml
index ece64c9..dae4cc2 100644
--- a/test/e2e/cases/process/istio/e2e.yaml
+++ b/test/e2e/cases/process/istio/e2e.yaml
@@ -87,11 +87,11 @@ verify:
- query: swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
service ls
expected: expected/service.yml
# service instance list
- - query: swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
instance list --service-name=default::productpage
+ - query: swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
instance list --service-name=e2e::productpage.default
expected: expected/service-instance.yml
# process list
- query: |
- swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
process list --service-name=default::productpage --instance-name=$( \
- swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
instance list --service-name=default::productpage |yq e '.[0].name' - \
+ swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
process list --service-name=e2e::productpage.default --instance-name=$( \
+ swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
instance list --service-name=e2e::productpage.default |yq e '.[0].name' - \
)
expected: expected/process.yml
diff --git a/test/e2e/cases/process/istio/expected/process.yml
b/test/e2e/cases/process/istio/expected/process.yml
index 72292c5..ce7aabd 100644
--- a/test/e2e/cases/process/istio/expected/process.yml
+++ b/test/e2e/cases/process/istio/expected/process.yml
@@ -16,8 +16,8 @@
{{- contains . }}
- id: {{ notEmpty .id }}
name: python
- serviceid: {{ b64enc "default::productpage" }}.1
- servicename: default::productpage
+ serviceid: {{ b64enc "e2e::productpage.default" }}.1
+ servicename: e2e::productpage.default
instanceid: {{ notEmpty .instanceid }}
instancename: {{ notEmpty .instancename }}
agentid: {{ notEmpty .agentid }}
@@ -39,8 +39,8 @@
- mesh-application
- id: {{ notEmpty .id }}
name: envoy
- serviceid: {{ b64enc "default::productpage" }}.1
- servicename: default::productpage
+ serviceid: {{ b64enc "e2e::productpage.default" }}.1
+ servicename: e2e::productpage.default
instanceid: {{ notEmpty .instanceid }}
instancename: {{ notEmpty .instancename }}
agentid: {{ notEmpty .agentid }}
@@ -62,8 +62,8 @@
- mesh-envoy
- id: {{ notEmpty .id }}
name: pilot-agent
- serviceid: {{ b64enc "default::productpage" }}.1
- servicename: default::productpage
+ serviceid: {{ b64enc "e2e::productpage.default" }}.1
+ servicename: e2e::productpage.default
instanceid: {{ notEmpty .instanceid }}
instancename: {{ notEmpty .instancename }}
agentid: {{ notEmpty .agentid }}
diff --git a/test/e2e/cases/process/istio/expected/service.yml
b/test/e2e/cases/process/istio/expected/service.yml
index 40bbced..92b71a5 100644
--- a/test/e2e/cases/process/istio/expected/service.yml
+++ b/test/e2e/cases/process/istio/expected/service.yml
@@ -14,57 +14,57 @@
# limitations under the License.
{{- contains . }}
-- id: {{ b64enc "default::details" }}.1
- name: default::details
- group: default
- shortname: details
+- id: {{ b64enc "e2e::details.default" }}.1
+ name: e2e::details.default
+ group: e2e
+ shortname: details.default
layers:
{{- contains .layers }}
- MESH_DP
- MESH
{{- end }}
normal: true
-- id: {{ b64enc "istio-system::istio-ingressgateway" }}.1
- name: istio-system::istio-ingressgateway
- group: istio-system
- shortname: istio-ingressgateway
+- id: {{ b64enc "e2e::istio-ingressgateway.istio-system" }}.1
+ name: e2e::istio-ingressgateway.istio-system
+ group: e2e
+ shortname: istio-ingressgateway.istio-system
layers:
- MESH_DP
normal: true
-- id: {{ b64enc "default::productpage" }}.1
- name: default::productpage
- group: default
- shortname: productpage
+- id: {{ b64enc "e2e::productpage.default" }}.1
+ name: e2e::productpage.default
+ group: e2e
+ shortname: productpage.default
layers:
{{- contains .layers }}
- MESH_DP
- MESH
{{- end }}
normal: true
-- id: {{ b64enc "default::ratings" }}.1
- name: default::ratings
- group: default
- shortname: ratings
+- id: {{ b64enc "e2e::ratings.default" }}.1
+ name: e2e::ratings.default
+ group: e2e
+ shortname: ratings.default
layers:
{{- contains .layers }}
- MESH_DP
- MESH
{{- end }}
normal: true
-- id: {{ b64enc "default::reviews" }}.1
- name: default::reviews
- group: default
- shortname: reviews
+- id: {{ b64enc "e2e::reviews.default" }}.1
+ name: e2e::reviews.default
+ group: e2e
+ shortname: reviews.default
layers:
{{- contains .layers }}
- MESH_DP
- MESH
{{- end }}
normal: true
-- id: {{ b64enc "istio-system::istio-egressgateway" }}.1
- name: istio-system::istio-egressgateway
- group: istio-system
- shortname: istio-egressgateway
+- id: {{ b64enc "e2e::istio-egressgateway.istio-system" }}.1
+ name: e2e::istio-egressgateway.istio-system
+ group: e2e
+ shortname: istio-egressgateway.istio-system
layers:
- MESH_DP
normal: true
diff --git a/test/e2e/cases/process/istio/rover.yaml
b/test/e2e/cases/process/istio/rover.yaml
index 6380c89..7c8e0c2 100644
--- a/test/e2e/cases/process/istio/rover.yaml
+++ b/test/e2e/cases/process/istio/rover.yaml
@@ -91,6 +91,8 @@ spec:
value: "false"
- name: ROVER_HOST_MAPPING
value: /host
+ - name: ROVER_CORE_CLUSTER_NAME
+ value: e2e
hostPID: true
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
diff --git a/test/e2e/cases/profiling/task/network/envoy/e2e.yaml
b/test/e2e/cases/profiling/task/network/envoy/e2e.yaml
index f273344..e3114db 100644
--- a/test/e2e/cases/profiling/task/network/envoy/e2e.yaml
+++ b/test/e2e/cases/profiling/task/network/envoy/e2e.yaml
@@ -99,121 +99,121 @@ verify:
- query: swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
service ls
expected: expected/service.yml
# service instance list
- - query: swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
instance list --service-name=default::productpage
+ - query: swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
instance list --service-name=productpage.default
expected: expected/service-instance.yml
- - query: swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
process list --service-name=default::productpage --instance-name=productpage
+ - query: swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
process list --service-name=productpage.default --instance-name=productpage
expected: expected/process.yml
# create network profiling task
- - query: swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
profiling ebpf create network --service-name=default::productpage
--instance-name=productpage
+ - query: swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
profiling ebpf create network --service-name=productpage.default
--instance-name=productpage
expected: expected/profiling-create.yml
- - query: swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
dep process --service-name default::productpage --instance-name=productpage
+ - query: swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
dep process --service-name productpage.default --instance-name=productpage
expected: expected/dependency-processs.yml
# single value of process relation, client/server side read/write
- query: |
swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics linear \
- --service-name default::productpage --instance-name productpage
--process-name envoy \
- --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --service-name productpage.default --instance-name productpage
--process-name envoy \
+ --dest-service-name productpage.default --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
--name process_relation_client_write_cpm|yq e 'to_entries' -
expected: expected/metrics-has-value.yml
- query: |
swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics linear \
- --service-name default::productpage --instance-name productpage
--process-name envoy \
- --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --service-name productpage.default --instance-name productpage
--process-name envoy \
+ --dest-service-name productpage.default --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
--name process_relation_client_write_total_bytes|yq e 'to_entries' -
expected: expected/metrics-has-value.yml
- query: |
swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics linear \
- --service-name default::productpage --instance-name productpage
--process-name envoy \
- --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --service-name productpage.default --instance-name productpage
--process-name envoy \
+ --dest-service-name productpage.default --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
--name process_relation_client_write_avg_exe_time|yq e 'to_entries' -
expected: expected/metrics-has-value.yml
- query: |
swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics linear \
- --service-name default::productpage --instance-name productpage
--process-name envoy \
- --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --service-name productpage.default --instance-name productpage
--process-name envoy \
+ --dest-service-name productpage.default --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
--name process_relation_client_read_cpm|yq e 'to_entries' -
expected: expected/metrics-has-value.yml
- query: |
swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics linear \
- --service-name default::productpage --instance-name productpage
--process-name envoy \
- --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --service-name productpage.default --instance-name productpage
--process-name envoy \
+ --dest-service-name productpage.default --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
--name process_relation_server_write_cpm|yq e 'to_entries' -
expected: expected/metrics-has-value.yml
# histogram value of process relation, client side
write_rtt/write_exe/read time
- query: |
swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics multiple-linear \
- --service-name default::productpage --instance-name productpage
--process-name envoy \
- --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --service-name productpage.default --instance-name productpage
--process-name envoy \
+ --dest-service-name productpage.default --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
--name=process_relation_client_write_rtt_time_percentile|yq e
'to_entries | with(.[] ; .value=(.value | to_entries))' -
expected: expected/metrics-has-value-label.yml
- query: |
swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics multiple-linear \
- --service-name default::productpage --instance-name productpage
--process-name envoy \
- --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --service-name productpage.default --instance-name productpage
--process-name envoy \
+ --dest-service-name productpage.default --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
--name=process_relation_client_write_exe_time_percentile|yq e
'to_entries | with(.[] ; .value=(.value | to_entries))' -
expected: expected/metrics-has-value-label.yml
- query: |
swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics multiple-linear \
- --service-name default::productpage --instance-name productpage
--process-name envoy \
- --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --service-name productpage.default --instance-name productpage
--process-name envoy \
+ --dest-service-name productpage.default --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
--name=process_relation_client_read_exe_time_percentile|yq e
'to_entries | with(.[] ; .value=(.value | to_entries))' -
expected: expected/metrics-has-value-label.yml
- query: |
swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics multiple-linear \
- --service-name default::productpage --instance-name productpage
--process-name envoy \
- --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --service-name productpage.default --instance-name productpage
--process-name envoy \
+ --dest-service-name productpage.default --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
--name=process_relation_server_write_rtt_time_percentile|yq e
'to_entries | with(.[] ; .value=(.value | to_entries))' -
expected: expected/metrics-has-value-label.yml
- query: |
swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics multiple-linear \
- --service-name default::productpage --instance-name productpage
--process-name envoy \
- --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --service-name productpage.default --instance-name productpage
--process-name envoy \
+ --dest-service-name productpage.default --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
--name=process_relation_server_write_exe_time_percentile|yq e
'to_entries | with(.[] ; .value=(.value | to_entries))' -
expected: expected/metrics-has-value-label.yml
- query: |
swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics multiple-linear \
- --service-name default::productpage --instance-name productpage
--process-name envoy \
- --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --service-name productpage.default --instance-name productpage
--process-name envoy \
+ --dest-service-name productpage.default --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
--name=process_relation_server_write_exe_time_percentile|yq e
'to_entries | with(.[] ; .value=(.value | to_entries))' -
expected: expected/metrics-has-value-label.yml
# HTTP1 analyzer
- query: |
swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics linear \
- --service-name default::productpage --instance-name productpage
--process-name envoy \
- --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --service-name productpage.default --instance-name productpage
--process-name envoy \
+ --dest-service-name productpage.default --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
--name process_relation_http1_request_cpm|yq e 'to_entries' -
expected: expected/metrics-has-value.yml
- query: |
swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics linear \
- --service-name default::productpage --instance-name productpage
--process-name envoy \
- --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --service-name productpage.default --instance-name productpage
--process-name envoy \
+ --dest-service-name productpage.default --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
--name process_relation_http1_request_package_size|yq e 'to_entries' -
expected: expected/metrics-has-value.yml
- query: |
swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics linear \
- --service-name default::productpage --instance-name productpage
--process-name envoy \
- --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --service-name productpage.default --instance-name productpage
--process-name envoy \
+ --dest-service-name productpage.default --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
--name process_relation_http1_response_package_size|yq e 'to_entries' -
expected: expected/metrics-has-value.yml
- query: |
swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics multiple-linear \
- --service-name default::productpage --instance-name productpage
--process-name envoy \
- --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --service-name productpage.default --instance-name productpage
--process-name envoy \
+ --dest-service-name productpage.default --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
--name process_relation_http1_request_package_size_percentile|yq e
'to_entries | with(.[] ; .value=(.value | to_entries))' -
expected: expected/metrics-has-value-label.yml
- query: |
swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics linear \
- --service-name default::productpage --instance-name productpage
--process-name envoy \
- --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --service-name productpage.default --instance-name productpage
--process-name envoy \
+ --dest-service-name productpage.default --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
--name process_relation_http1_server_duration|yq e 'to_entries' -
expected: expected/metrics-has-value.yml
- query: |
swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics linear \
- --service-name default::productpage --instance-name productpage
--process-name envoy \
- --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --service-name productpage.default --instance-name productpage
--process-name envoy \
+ --dest-service-name productpage.default --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
--name process_relation_http1_client_duration|yq e 'to_entries' -
expected: expected/metrics-has-value.yml
\ No newline at end of file
diff --git
a/test/e2e/cases/profiling/task/network/envoy/expected/dependency-processs.yml
b/test/e2e/cases/profiling/task/network/envoy/expected/dependency-processs.yml
index 3ec39ae..b527e3d 100644
---
a/test/e2e/cases/profiling/task/network/envoy/expected/dependency-processs.yml
+++
b/test/e2e/cases/profiling/task/network/envoy/expected/dependency-processs.yml
@@ -15,7 +15,7 @@
{{- define "genProcessId" }}
{{- with $processName := . }}
-{{- with $serviceId := "default::productpage" | b64enc | printf "%s.1" }}
+{{- with $serviceId := "productpage.default" | b64enc | printf "%s.1" }}
{{- with $instanceId := "productpage" | b64enc | printf "%s_%s" $serviceId }}
{{- printf "%s" (sha256enc (printf "%s_%s" $processName $instanceId)) }}
{{- end }}
@@ -35,30 +35,30 @@ nodes:
{{- contains .nodes }}
- id: {{template "genProcessId" "/usr/local/bin/python"}}
name: /usr/local/bin/python
- serviceid: {{ b64enc "default::productpage" }}.1
- servicename: default::productpage
- serviceinstanceid: {{ b64enc "default::productpage" }}.1_{{ b64enc
"productpage" }}
+ serviceid: {{ b64enc "productpage.default" }}.1
+ servicename: productpage.default
+ serviceinstanceid: {{ b64enc "productpage.default" }}.1_{{ b64enc
"productpage" }}
serviceinstancename: productpage
isreal: true
- id: {{template "genProcessId" "envoy"}}
name: envoy
- serviceid: {{ b64enc "default::productpage" }}.1
- servicename: default::productpage
- serviceinstanceid: {{ b64enc "default::productpage" }}.1_{{ b64enc
"productpage" }}
+ serviceid: {{ b64enc "productpage.default" }}.1
+ servicename: productpage.default
+ serviceinstanceid: {{ b64enc "productpage.default" }}.1_{{ b64enc
"productpage" }}
serviceinstancename: productpage
isreal: true
- id: {{template "genProcessId" $ingressProcessName }}
name: {{$ingressProcessName}}
- serviceid: {{ b64enc "default::productpage" }}.1
- servicename: default::productpage
- serviceinstanceid: {{ b64enc "default::productpage" }}.1_{{ b64enc
"productpage" }}
+ serviceid: {{ b64enc "productpage.default" }}.1
+ servicename: productpage.default
+ serviceinstanceid: {{ b64enc "productpage.default" }}.1_{{ b64enc
"productpage" }}
serviceinstancename: productpage
isreal: false
- id: {{template "genProcessId" "kube-dns.kube-system" }}
name: kube-dns.kube-system
- serviceid: {{ b64enc "default::productpage" }}.1
- servicename: default::productpage
- serviceinstanceid: {{ b64enc "default::productpage" }}.1_{{ b64enc
"productpage" }}
+ serviceid: {{ b64enc "productpage.default" }}.1
+ servicename: productpage.default
+ serviceinstanceid: {{ b64enc "productpage.default" }}.1_{{ b64enc
"productpage" }}
serviceinstancename: productpage
isreal: false
{{- end }}
diff --git a/test/e2e/cases/profiling/task/network/envoy/expected/process.yml
b/test/e2e/cases/profiling/task/network/envoy/expected/process.yml
index 498938b..87b58c0 100644
--- a/test/e2e/cases/profiling/task/network/envoy/expected/process.yml
+++ b/test/e2e/cases/profiling/task/network/envoy/expected/process.yml
@@ -16,9 +16,9 @@
{{- contains . }}
- id: {{ notEmpty .id }}
name: /usr/local/bin/python
- serviceid: {{ b64enc "default::productpage" }}.1
- servicename: default::productpage
- instanceid: {{ b64enc "default::productpage" }}.1_{{ b64enc "productpage" }}
+ serviceid: {{ b64enc "productpage.default" }}.1
+ servicename: productpage.default
+ instanceid: {{ b64enc "productpage.default" }}.1_{{ b64enc "productpage" }}
instancename: productpage
agentid: {{ notEmpty .agentid }}
detecttype: KUBERNETES
@@ -39,9 +39,9 @@
- mesh-application
- id: {{ notEmpty .id }}
name: envoy
- serviceid: {{ b64enc "default::productpage" }}.1
- servicename: default::productpage
- instanceid: {{ b64enc "default::productpage" }}.1_{{ b64enc "productpage" }}
+ serviceid: {{ b64enc "productpage.default" }}.1
+ servicename: productpage.default
+ instanceid: {{ b64enc "productpage.default" }}.1_{{ b64enc "productpage" }}
instancename: productpage
agentid: {{ notEmpty .agentid }}
detecttype: KUBERNETES
@@ -62,9 +62,9 @@
- mesh-envoy
- id: {{ notEmpty .id }}
name: pilot-agent
- serviceid: {{ b64enc "default::productpage" }}.1
- servicename: default::productpage
- instanceid: {{ b64enc "default::productpage" }}.1_{{ b64enc "productpage" }}
+ serviceid: {{ b64enc "productpage.default" }}.1
+ servicename: productpage.default
+ instanceid: {{ b64enc "productpage.default" }}.1_{{ b64enc "productpage" }}
instancename: productpage
agentid: {{ notEmpty .agentid }}
detecttype: KUBERNETES
diff --git
a/test/e2e/cases/profiling/task/network/envoy/expected/service-instance.yml
b/test/e2e/cases/profiling/task/network/envoy/expected/service-instance.yml
index 45640d7..bd7a0fb 100644
--- a/test/e2e/cases/profiling/task/network/envoy/expected/service-instance.yml
+++ b/test/e2e/cases/profiling/task/network/envoy/expected/service-instance.yml
@@ -14,9 +14,9 @@
# limitations under the License.
{{- contains . }}
-- id: {{ b64enc "default::productpage" }}.1_{{ b64enc "productpage" }}
+- id: {{ b64enc "productpage.default" }}.1_{{ b64enc "productpage" }}
name: productpage
attributes: []
language: UNKNOWN
- instanceuuid: {{ b64enc "default::productpage" }}.1_{{ b64enc "productpage"
}}
+ instanceuuid: {{ b64enc "productpage.default" }}.1_{{ b64enc "productpage" }}
{{- end }}
diff --git a/test/e2e/cases/profiling/task/network/envoy/expected/service.yml
b/test/e2e/cases/profiling/task/network/envoy/expected/service.yml
index 40bbced..95f9aa7 100644
--- a/test/e2e/cases/profiling/task/network/envoy/expected/service.yml
+++ b/test/e2e/cases/profiling/task/network/envoy/expected/service.yml
@@ -14,57 +14,57 @@
# limitations under the License.
{{- contains . }}
-- id: {{ b64enc "default::details" }}.1
- name: default::details
- group: default
- shortname: details
+- id: {{ b64enc "details.default" }}.1
+ name: details.default
+ group: ""
+ shortname: details.default
layers:
{{- contains .layers }}
- MESH_DP
- MESH
{{- end }}
normal: true
-- id: {{ b64enc "istio-system::istio-ingressgateway" }}.1
- name: istio-system::istio-ingressgateway
- group: istio-system
- shortname: istio-ingressgateway
+- id: {{ b64enc "istio-ingressgateway.istio-system" }}.1
+ name: istio-ingressgateway.istio-system
+ group: ""
+ shortname: istio-ingressgateway.istio-system
layers:
- MESH_DP
normal: true
-- id: {{ b64enc "default::productpage" }}.1
- name: default::productpage
- group: default
- shortname: productpage
+- id: {{ b64enc "productpage.default" }}.1
+ name: productpage.default
+ group: ""
+ shortname: productpage.default
layers:
{{- contains .layers }}
- MESH_DP
- MESH
{{- end }}
normal: true
-- id: {{ b64enc "default::ratings" }}.1
- name: default::ratings
- group: default
- shortname: ratings
+- id: {{ b64enc "ratings.default" }}.1
+ name: ratings.default
+ group: ""
+ shortname: ratings.default
layers:
{{- contains .layers }}
- MESH_DP
- MESH
{{- end }}
normal: true
-- id: {{ b64enc "default::reviews" }}.1
- name: default::reviews
- group: default
- shortname: reviews
+- id: {{ b64enc "reviews.default" }}.1
+ name: reviews.default
+ group: ""
+ shortname: reviews.default
layers:
{{- contains .layers }}
- MESH_DP
- MESH
{{- end }}
normal: true
-- id: {{ b64enc "istio-system::istio-egressgateway" }}.1
- name: istio-system::istio-egressgateway
- group: istio-system
- shortname: istio-egressgateway
+- id: {{ b64enc "istio-egressgateway.istio-system" }}.1
+ name: istio-egressgateway.istio-system
+ group: ""
+ shortname: istio-egressgateway.istio-system
layers:
- MESH_DP
normal: true