7.1 KiB
7.1 KiB
Setup java agent
- Find
agentfolder in SkyWalking release package - Set
agent.service_nameinconfig/agent.config. Could be any String in English. - Set
collector.backend_serviceinconfig/agent.config. Default point to127.0.0.1:11800, only works for local backend. - Add
-javaagent:/path/to/skywalking-package/agent/skywalking-agent.jarto JVM argument. And make sure to add it before the-jarargument.
The agent release dist is included in Apache official release. New agent package looks like this.
+-- agent
+-- activations
apm-toolkit-log4j-1.x-activation.jar
apm-toolkit-log4j-2.x-activation.jar
apm-toolkit-logback-1.x-activation.jar
...
+-- config
agent.config
+-- plugins
apm-dubbo-plugin.jar
apm-feign-default-http-9.x.jar
apm-httpClient-4.x-plugin.jar
.....
skywalking-agent.jar
- Start your application.
Advanced features
- All plugins are in
/pluginsfolder. The plugin jar is active when it is in there. Remove the plugin jar, it disabled. - The default logging output folder is
/logs.
Install javaagent FAQs
- Linux Tomcat 7, Tomcat 8
Change the first line oftomcat/bin/catalina.sh.
CATALINA_OPTS="$CATALINA_OPTS -javaagent:/path/to/skywalking-agent/skywalking-agent.jar"; export CATALINA_OPTS
- Windows Tomcat 7, Tomcat 8
Change the first line oftomcat/bin/catalina.bat.
set "CATALINA_OPTS=-javaagent:/path/to/skywalking-agent/skywalking-agent.jar"
- JAR file
Add-javaagentargument to command line in which you start your app. eg:
java -javaagent:/path/to/skywalking-agent/skywalking-agent.jar -jar yourApp.jar
Table of Agent Configuration Properties
This is the properties list supported in agent/config/agent.config.
| property key | Description | Default |
|---|---|---|
agent.namespace |
Namespace isolates headers in cross process propagation. The HEADER name will be HeaderName:Namespace. |
Not set |
agent.service_name |
Application(5.x)/Service(6.x) code is showed in sky-walking-ui. Suggestion: set a unique name for each service, service instance nodes share the same code | Your_ApplicationName |
agent.sample_n_per_3_secs |
Negative or zero means off, by default.SAMPLE_N_PER_3_SECS means sampling N TraceSegment in 3 seconds tops. | Not set |
agent.authentication |
Authentication active is based on backend setting, see application.yml for more details.For most scenarios, this needs backend extensions, only basic match auth provided in default implementation. | Not set |
agent.span_limit_per_segment |
The max number of spans in a single segment. Through this config item, skywalking keep your application memory cost estimated. | Not set |
agent.ignore_suffix |
If the operation name of the first span is included in this set, this segment should be ignored. | Not set |
agent.is_open_debugging_class |
If true, skywalking agent will save all instrumented classes files in /debugging folder.Skywalking team may ask for these files in order to resolve compatible problem. |
Not set |
agent.active_v2_header |
Active V2 header in default. | true |
agent.active_v1_header |
Deactive V1 header in default. | false |
collector.grpc_channel_check_interval |
grpc channel status check interval. | 30 |
collector.app_and_service_register_check_interval |
application and service registry check interval. | 3 |
collector.backend_service |
Collector skywalking trace receiver service addresses. | 127.0.0.1:11800 |
logging.level |
The log level. Default is debug. | DEBUG |
logging.file_name |
Log file name. | skywalking-api.log |
logging.dir |
Log files directory. Default is blank string, means, use "system.out" to output logs. | "" |
logging.max_file_size |
The max size of log file. If the size is bigger than this, archive the current file, and write into a new file. | 300 * 1024 * 1024 |
jvm.buffer_size |
The buffer size of collected JVM info. | 60 * 10 |
buffer.channel_size |
The buffer channel size. | 5 |
buffer.buffer_size |
The buffer size. | 300 |
dictionary.service_code_buffer_size |
The buffer size of application codes and peer | 10 * 10000 |
dictionary.endpoint_name_buffer_size |
The buffer size of endpoint names and peer | 1000 * 10000 |
plugin.mongodb.trace_param |
If true, trace all the parameters in MongoDB access, default is false. Only trace the operation, not include parameters. | false |
plugin.elasticsearch.trace_dsl |
If true, trace all the DSL(Domain Specific Language) in ElasticSearch access, default is false. | false |
Supported middlewares, frameworks and libraries
See supported list.
Optional Plugins
Java agent plugins are all pluggable. Optional plugins could be provided in optional-plugins folder under agent or 3rd party repositores.
For using these plugins, you need to put the target plugin jar file into /plugins.
Now, we have the following known optional plugins.
- Trace Spring beans
- Trace Oracle and Resin
- Filter traces through specified endpoint name patterns
- Gson serialization lib in optional plugin folder
- Lettuce 5.x(JRE1.8+) in optional plugin folder
Advanced Features
- Set the settings through system properties for config file override. Read setting override.
- Use gRPC TLS to link backend. See open TLS
- Monitor a big cluster by different SkyWalking services. Use Namespace to isolate the context propagation.
- Set client token if backend open token authentication.
- Application Toolkit, are a collection of libraries, provided by skywalking APM. Using them, you have a bridge between your application and skywalking APM agent.
- If you want to use OpenTracing Java APIs, try SkyWalking OpenTracing compatible tracer. More details you could find at http://opentracing.io
- If you want to print trace context(e.g. traceId) in your logs, choose the log frameworks, log4j, log4j2, logback
- If you want to use annotations or SkyWalking native APIs to read context, try SkyWalking manual APIs
- If you want to continue traces across thread manually, use across thread solution APIs.
- If you want to specify the path of your agent.config file. Read set config file through system properties
Plugin Development Guide
SkyWalking java agent supports plugin to extend the supported list. Please follow our Plugin Development Guide.
Test
If you are interested in plugin compatible tests or agent performance, see the following reports.