Observability
Artifact is distribution/agent/target/apache-shardingsphere-${latest.release.version}-shardingsphere-agent-bin.tar.gz
Directory structure
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
├── LICENSE
├── NOTICE
│ └── agent.yaml
├── plugins
│ ├── lib
│ │ ├── shardingsphere-agent-metrics-core-${latest.release.version}.jar
│ │ └── shardingsphere-agent-plugin-core-${latest.release.version}.jar
│ ├── logging
│ │ └── shardingsphere-agent-logging-file-${latest.release.version}.jar
│ ├── metrics
│ └── tracing
│ ├── shardingsphere-agent-tracing-opentelemetry-${latest.release.version}.jar
│ └── shardingsphere-agent-tracing-opentracing-${latest.release.version}.jar
└── shardingsphere-agent-${latest.release.version}.jar
Agent log output location is agent/logs/stdout.log
.
Plugin description
File
Currently, the File plugin only outputs the time-consuming log output of building metadata, and has no other log output for the time being.
Prometheus
Used for exposure monitoring metrics.
- Parameter description
OpenTelemetry
OpenTelemetry can export tracing data to Jaeger, Zipkin.
- Parameter description
- Edit the startup script
Configure the absolute path of shardingsphere-agent-${latest.release.version}.jar to the start.sh startup script of shardingsphere proxy.
nohup java ${JAVA_OPTS} ${JAVA_MEM_OPTS} \
-javaagent:/xxxxx/agent/shardingsphere-agent-${latest.release.version}.jar \
- Start ShardingSphere-Proxy
After startup, you can find the plugin info in the log of ShardingSphere-Proxy, Metric
and Tracing
data can be viewed through the configured monitoring address.
Use via container environment
Assume that the following corresponding configurations have been completed locally.
- Folder
./custom/agent/
that contains all files after unpacking ShardingSphere-Agent binary package - The folder containing the configuration files of ShardingSphere-Proxy such as
server.yaml
is./custom/conf/
- Folder
- 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-${latest.release.version}.jar"
PORT: 3308
volumes:
- ./custom/agent:/agent/
- ./custom/conf:/opt/shardingsphere-proxy/conf/
ports:
- "13308:3308"