Openresty
Configuration¶
Configure Openresty¶
Download Tracing Module¶
Visit https://github.com/DataDog/nginx-datadog/releases, and in the Assets section, find and download the module openresty-ngx_http_datadog_module-<processor architecture>-<version>.so.tgz
that matches your current processor architecture and version.
Install Tracing¶
- Create Module Path
- Extract
root@root:/usr/local/openresty/nginx/modules$ tar xzvf openresty-ngx_http_datadog_module-<processor architecture>-<version>.so.tgz
Configure Nginx¶
Add the following content to /usr/local/openresty/nginx/conf/nginx.conf
:
# Load Module
load_module modules/ngx_http_datadog_module.so;
worker_processes 1;
events {
worker_connections 1024;
}
http {
# Configure Datakit URL
datadog_agent_url http://localhost:9529;
# Configure Service Name
datadog_service_name openresty-demo;
# Configure Environment Name
datadog_environment test;
# Configure Version Name
datadog_version 1.0.0;
# Configure Sampling Rate 0-1.0
datadog_sample_rate 1.0;
# Configure Tags
datadog_tag foo bar;
include mime.types;
default_type application/octet-stream;
# Add trace_id and span_id to logs via $datadog_trace_id and $datadog_span_id, both in hexadecimal
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'
'"$datadog_trace_id" "$datadog_span_id"';
access_log logs/access.log main;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
Restart Openresty¶
Skipped
Enable DataKit Collection¶
- Enable
ddtrace
- Restart DataKit