Deploy on Hosts¶
Install DataKit Agent¶
Before performing system and application link analysis, you need to deploy the TrueWatch DataKit collector on each target host to collect the necessary link data.
Enable DDTrace Collector¶
DDTrace is used to receive, process, and analyze Tracing protocol data. Execute the following command to enable the DDTrace collector. For other third-party Tracing collection configurations, please refer to Integrations.
cp /usr/local/datakit/conf.d/samples/ddtrace/ddtrace.conf.sample /usr/local/datakit/conf.d/samples/ddtrace/ddtrace.conf
After configuration, restart DataKit:
Select Language¶
Java¶
Install dependencies:
Run the application:
You can run your Java Code through various means, such as IDE, Maven, Gradle, or directly via the java -jar command. The following example starts the application using the java command:
java \
-javaagent:/path/to/dd-java-agent.jar \
-Ddd.logs.injection=true \
-Ddd.agent.host=<YOUR-DATAKIT-HOST> \
-Ddd.trace.agent.port=9529 \
-jar path/to/your/app.jar
Parameter configuration:
service.name: Service name.env: Environment information for the application service.version: Version number.- Set sampling rate: Enabling this can reduce the actual amount of data generated. The numeric range is from 0.0 (0%) to 1.0 (100%).
- Collect Profiling data: Enabling this allows you to see more information about the application runtime.
- Enable JVM metrics collection: Requires simultaneous enabling of the statsd collector.
For more parameter configurations, refer to here.
Python¶
Install dependencies:
Run the application:
DD_LOGS_INJECTION=true \
DD_AGENT_HOST=localhost \
DD_AGENT_PORT=9529 \
ddtrace-run python my_app.py
Parameter configuration:
service.name: Service name.env: Environment information for the application service.version: Version number.- Set sampling rate: Enabling this can reduce the actual amount of data generated. The numeric range is from 0.0 (0%) to 1.0 (100%).
- Collect Profiling data: Enabling this allows you to see more information about the application runtime.
- Enable Python metrics collection: Requires simultaneous enabling of the statsd collector.
For more parameter configurations, refer to here.
Golang¶
Install dependencies:
Run the application:
package main
import (
"io/ioutil"
"os"
"time"
httptrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/net/http"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
)
func main() {
tracer.Start(
)
defer tracer.Stop()
// Create a traced mux router
mux := httptrace.NewServeMux()
// Continue using the router as you normally would.
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
time.Sleep(time.Second)
w.Write([]byte("Hello World!"))
})
if err := http.ListenAndServe(":18080", mux); err != nil {
log.Fatal(err)
}
}
Parameter configuration:
service.name: Service name.env: Environment information for the application service.version: Version number.- Set sampling rate: Enabling this can reduce the actual amount of data generated. The numeric range is from 0.0 (0%) to 1.0 (100%).
- Collect Profiling data: Enabling this allows you to see more information about the application runtime.
For more parameter configurations, refer to here.