Skip to content

rnburn/nginx-opentracing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The repo has moved.

https://github.com/opentracing-contrib/nginx-opentracing

nginx-opentracing

Enable requests served by nginx for distributed tracing via The OpenTracing Project.

Dependencies

Docker

A docker image rnburn/nginx-opentracing is provided to support using nginx with OpenTracing in a manner analogous to the nginx Docker image. See here for examples of how to use it.

Building

$ tar zxvf nginx-1.9.x.tar.gz
$ cd nginx-1.9.x
$ export NGINX_OPENTRACING_VENDOR="ZIPKIN" # or export NGINX_OPENTRACING_VENDOR="LIGHTSTEP"
$ ./configure --add-dynamic-module=/absolute/path/to/nginx-opentracing/opentracing \
              # To enable tracing with Zipkin
              --add-dynamic-module=/absolute/path/to/nginx-opentracing/zipkin \  
              # To enable tracing with LightStep
              --add-dynamic-module=/absolute/path/to/nginx-opentracing/lightstep
$ make && sudo make install

Getting Started

# Load the OpenTracing dynamic module.
load_module modules/ngx_http_opentracing_module.so;

# Load a vendor OpenTracing dynamic module.
# For example,
#   load_module modules/ngx_http_lightstep_module.so;
# or
#   load_module modules/ngx_http_zipkin_module.so;

http {
  # Configure your vendor's tracer.
  # For example,
  #     lightstep_access_token ACCESSTOKEN;
  #     ....
  # or
  #     zipkin_collector_host localhost;
  #     ...

  # Enable tracing for all requests.
  opentracing on;

  # Optionally, set additional tags.
  opentracing_tag http_user_agent $http_user_agent;

  location ~ \.php$ {
    # The operation name used for spans defaults to the name of the location
    # block, but you can use this directive to customize it.
    opentracing_operation_name $uri;

    fastcgi_pass 127.0.0.1:1025;
  }
}

See Tutorial for a more complete example, Reference for a list of available OpenTracing-related directives, and LightStep and Zipkin for a list of vendor tracing directives.