Observability
Output directory: shardingsphere-agent/shardingsphere-agent-distribution/target/apache-shardingsphere-${latest.release.version}-shardingsphere-agent-bin.tar.gz
-
Create agent directory, and unzip agent distribution package to the directory.
tar -zxvf apache-shardingsphere-${latest.release.version}-shardingsphere-agent-bin.tar.gz -C agent
cd agent
tree
.
└── apache-shardingsphere-${latest.release.version}-shardingsphere-agent-bin
├── LICENSE
├── NOTICE
├── conf
│ └── logback.xml
├── plugins
│ ├── shardingsphere-agent-logging-base-${latest.release.version}.jar
│ ├── shardingsphere-agent-metrics-prometheus-${latest.release.version}.jar
│ ├── shardingsphere-agent-tracing-opentelemetry-${latest.release.version}.jar
│ ├── shardingsphere-agent-tracing-opentracing-${latest.release.version}.jar
│ └── shardingsphere-agent-tracing-zipkin-${latest.release.version}.jar
└── shardingsphere-agent.jar
- Configuration file
- Parameter description:
- Edit the startup script
Configure the absolute path of shardingsphere-agent.jar to the start.sh startup script of shardingsphere proxy.
nohup java ${JAVA_OPTS} ${JAVA_MEM_OPTS} \
-javaagent:/xxxxx/agent/shardingsphere-agent.jar \
-classpath ${CLASS_PATH} ${MAIN_CLASS} >> ${STDOUT_FILE} 2>&1 &
- Start ShardingSphere-Proxy
Use via container environment
- At this point, the use of ShardingSphere-Agent can be configured through the environment variable . Taking starting in the Docker Compose environment as an example, a reasonable
docker-compose.yml
example is as follows.
version: "3.8"
services:
apache-shardingsphere-proxy:
image: apache/shardingsphere-proxy:latest
environment:
JVM_OPTS: "-javaagent:/agent/shardingsphere-agent.jar"
PORT: 3308
volumes:
- ./custom/agent:/agent/
- ./custom/conf:/opt/shardingsphere-proxy/conf/
ports:
name | type | description |
---|---|---|
proxy_request_total | COUNTER | proxy request total |
proxy_connection_total | GAUGE | proxy connection total |
proxy_execute_latency_millis | HISTOGRAM | proxy executor latency millis |
proxy_execute_error_total | COUNTER | proxy executor error total |
route_sql_select_total | COUNTER | proxy executor route select sql total |
route_sql_insert_total | COUNTER | proxy executor route insert sql total |
route_sql_update_total | COUNTER | proxy executor route update sql total |
route_sql_delete_total | COUNTER | proxy executor route delete sql total |
route_datasource_total | COUNTER | number of datasource routed |
route_table_total | COUNTER | number of table routed |
proxy_transaction_commit_total | COUNTER | transaction commit count total |
proxy_transaction_rollback_total | COUNTER | transaction rollback count total |
parse_sql_dml_insert_total | COUNTER | proxy executor parse insert sql total |
parse_sql_dml_delete_total | COUNTER | proxy executor parse delete sql total |
parse_sql_dml_update_total | COUNTER | proxy executor parse update sql total |
parse_sql_dml_select_total | COUNTER | proxy executor parse select sql total |
parse_sql_ddl_total | COUNTER | proxy executor parse ddl sql total |
parse_sql_dcl_total | COUNTER | proxy executor parse dcl sql total |
parse_sql_dal_total | COUNTER | proxy executor parse dal sql total |
parse_sql_tcl_total | COUNTER | proxy executor parse tcl sql total |
parse_dist_sql_rql_total | COUNTER | proxy executor parse rql sql total |
parse_dist_sql_rdl_total | COUNTER | proxy executor parse rdl sql total |
parse_dist_sql_ral_total | COUNTER | proxy executor parse ral sql total |
build_info | GAUGE | build information |
proxy_info | GAUGE | proxy information, state:1 OK, state:2 CIRCUIT BREAK |
meta_data_info | GAUGE | meta data information, schema_count:logic number of databases, database_count:actual number of databases |