Skip to content

Commit

Permalink
Merge branch 'main' into feature-add-request-resource-domain-index
Browse files Browse the repository at this point in the history
  • Loading branch information
sharang committed Jan 16, 2024
2 parents 66fcd0c + 57ab3ca commit b5a9f78
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docker-compose-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
if: "startsWith(github.ref, 'refs/tags/')"
run: |
cd manifests
sed -i "s|latest|${{ env.IMAGE_TAG_PREFIX }}|g" deepflow-docker-compose/docker-compose.yaml
tar -czvf deepflow-docker-compose.tar deepflow-docker-compose
ossutil cp -rf deepflow-docker-compose.tar oss://deepflow-ce/pkg/docker-compose/stable/linux/deepflow-docker-compose.tar
Expand Down
29 changes: 26 additions & 3 deletions agent/src/ebpf/kernel/include/protocol_inference.h
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,9 @@ static __inline bool is_include_crlf(const char *buf)
return true;
}

// http://redisdoc.com/topic/protocol.html
// ref:
// http://redisdoc.com/topic/protocol.html
// https://redis.io/docs/reference/protocol-spec/
static __inline enum message_type infer_redis_message(const char *buf,
size_t count,
struct conn_info_t
Expand All @@ -1208,9 +1210,30 @@ static __inline enum message_type infer_redis_message(const char *buf,

const char first_byte = buf[0];

// 第一个字节仅可能是 '+' '-' ':' '$' '*'
/*
* The following table summarizes the RESP data types that Redis supports:
*
* RESP data type Minimal protocol version Category First byte
* Simple strings RESP2 Simple +
* Simple Errors RESP2 Simple -
* Integers RESP2 Simple :
* Bulk strings RESP2 Aggregate $
* Arrays RESP2 Aggregate *
* Nulls RESP3 Simple _
* Booleans RESP3 Simple #
* Doubles RESP3 Simple ,
* Big numbers RESP3 Simple (
* Bulk errors RESP3 Aggregate !
* Verbatim strings RESP3 Aggregate =
* Maps RESP3 Aggregate %
* Sets RESP3 Aggregate ~
* Pushes RESP3 Aggregate >
*/
if (first_byte != '+' && first_byte != '-' && first_byte != ':' &&
first_byte != '$' && first_byte != '*')
first_byte != '$' && first_byte != '*' && first_byte != '_' &&
first_byte != '#' && first_byte != ',' && first_byte != '(' &&
first_byte != '!' && first_byte != '=' && first_byte != '%' &&
first_byte != '~' && first_byte != '>')
return MSG_UNKNOWN;

// The redis message must contain /r/n.
Expand Down
5 changes: 4 additions & 1 deletion agent/src/trident.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ use crate::{
environment::{
check, controller_ip_check, free_memory_check, free_space_checker, get_ctrl_ip_and_mac,
get_env, kernel_check, running_in_container, tap_interface_check,
trident_process_check,
trident_process_check, K8S_MEM_LIMIT_FOR_DEEPFLOW,
},
guard::Guard,
logger::{LogLevelWriter, LogWriterAdapter, RemoteLogWriter},
Expand Down Expand Up @@ -412,6 +412,9 @@ impl Trident {
"use K8S_NODE_IP_FOR_DEEPFLOW env ip as destination_ip({})",
ctrl_ip
);
if env::var(K8S_MEM_LIMIT_FOR_DEEPFLOW).is_err() {
warn!("the environment variable K8S_MEM_LIMIT_FOR_DEEPFLOW is not set in the container , use the limit value from server instead");
}
}

#[cfg(target_os = "linux")]
Expand Down
2 changes: 1 addition & 1 deletion agent/src/utils/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const K8S_NODE_IP_FOR_DEEPFLOW: &str = "K8S_NODE_IP_FOR_DEEPFLOW";
const ENV_INTERFACE_NAME: &str = "CTRL_NETWORK_INTERFACE";
const K8S_POD_IP_FOR_DEEPFLOW: &str = "K8S_POD_IP_FOR_DEEPFLOW";
const IN_CONTAINER: &str = "IN_CONTAINER";
const K8S_MEM_LIMIT_FOR_DEEPFLOW: &str = "K8S_MEM_LIMIT_FOR_DEEPFLOW";
pub const K8S_MEM_LIMIT_FOR_DEEPFLOW: &str = "K8S_MEM_LIMIT_FOR_DEEPFLOW";
const ONLY_WATCH_K8S_RESOURCE: &str = "ONLY_WATCH_K8S_RESOURCE";

const BYTES_PER_MEGABYTE: u64 = 1024 * 1024;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[analytics]
check_for_updates = true
[database]
host = deepflow-mysql:30130
name = grafana
password = deepflow
type = mysql
user = root
[grafana_net]
url = https://grafana.net
[log]
mode = console
[paths]
data = /var/lib/grafana/
logs = /var/log/grafana
plugins = /var/lib/grafana/plugins
provisioning = /etc/grafana/provisioning
[plugins]
allow_loading_unsigned_plugins = deepflow-querier-datasource,deepflow-apptracing-panel,deepflow-topo-panel,deepflowio-tracing-panel,deepflowio-deepflow-datasource,deepflowio-topo-panel
64 changes: 64 additions & 0 deletions manifests/deepflow-docker-compose/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,70 @@ services:
- deepflow
ports:
- 20418:20418
deepflow-grafana-init-worksdir:
image: registry.cn-hongkong.aliyuncs.com/deepflow-ce/deepflowio-init-grafana-ds-dh:latest
container_name: deepflow-grafana-init-worksdir
command: /bin/sh -c "rm -rf /tmp/dashboards/*; rm -rf /var/lib/grafana/plugins/*"
volumes:
- /opt/deepflow/grafana/dashboards:/tmp/dashboards:z
- /opt/deepflow/grafana/plugins:/var/lib/grafana/plugins:z
- /opt/deepflow/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards:z
networks:
- deepflow
deepflow-grafana-init-grafana-ds-dh:
image: registry.cn-hongkong.aliyuncs.com/deepflow-ce/deepflowio-init-grafana-ds-dh:latest
container_name: deepflow-grafana-init-grafana-ds-dh
volumes:
- /opt/deepflow/grafana/dashboards:/tmp/dashboards:z
- /opt/deepflow/grafana/plugins:/var/lib/grafana/plugins:z
- /opt/deepflow/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards:z
- /opt/deepflow/grafana/provisioning/datasources:/etc/grafana/provisioning/datasources:z
networks:
- deepflow
depends_on:
- deepflow-grafana-init-worksdir
deepflow-grafana-init-custom-plugins:
image: registry.cn-hongkong.aliyuncs.com/deepflow-ce/deepflowio-init-grafana:latest
container_name: deepflow-grafana-init-custom-plugins
volumes:
- /opt/deepflow/grafana/dashboards:/tmp/dashboards:z
- /opt/deepflow/grafana/plugins:/var/lib/grafana/plugins:z
networks:
- deepflow
depends_on:
- deepflow-grafana-init-worksdir
deepflow-grafana:
image: registry.cn-hongkong.aliyuncs.com/deepflow-ce/grafana:10.1.5
container_name: deepflow-grafana
environment:
TZ: "Asia/Shanghai"
GF_SECURITY_ADMIN_USER: "admin"
GF_SECURITY_ADMIN_PASSWORD: "deepflow"
DEEPFLOW_REQUEST_URL: 'http://deepflow-server:20416'
DEEPFLOW_TRACEURL: 'http://deepflow-app:20418'
MYSQL_URL: "deepflow-mysql:30130"
MYSQL_USER: "root"
MYSQL_PASSWORD: "deepflow"
CLICKHOUSE_SERVER: "deepflow-clickhouse"
CLICKHOUSE_USER: "default"
CLICKHOUSE_PASSWORD: ""
restart: always
volumes:
- type: bind
source: ./common/config/grafana/grafana.ini
target: /etc/grafana/grafana.ini
- /opt/deepflow/grafana/dashboards:/tmp/dashboards:z
- /opt/deepflow/grafana/plugins:/var/lib/grafana/plugins:z
- /opt/deepflow/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards:z
- /opt/deepflow/grafana/provisioning/datasources:/etc/grafana/provisioning/datasources:z
networks:
- deepflow
ports:
- 3000:3000
depends_on:
- deepflow-grafana-init-grafana-ds-dh
- deepflow-grafana-init-custom-plugins

networks:
deepflow:
external: false

0 comments on commit b5a9f78

Please sign in to comment.