Add support for opentracing
This commit is contained in:
parent
1a68536e29
commit
d38106f9c3
3 changed files with 26 additions and 1 deletions
|
@ -35,7 +35,7 @@ IMAGE = $(REGISTRY)/$(IMGNAME)
|
||||||
MULTI_ARCH_IMG = $(IMAGE)-$(ARCH)
|
MULTI_ARCH_IMG = $(IMAGE)-$(ARCH)
|
||||||
|
|
||||||
# Set default base image dynamically for each arch
|
# Set default base image dynamically for each arch
|
||||||
BASEIMAGE?=gcr.io/google_containers/nginx-slim-$(ARCH):0.24
|
BASEIMAGE?=gcr.io/google_containers/nginx-slim-$(ARCH):0.25
|
||||||
|
|
||||||
ifeq ($(ARCH),arm)
|
ifeq ($(ARCH),arm)
|
||||||
QEMUARCH=arm
|
QEMUARCH=arm
|
||||||
|
|
|
@ -369,6 +369,21 @@ type Configuration struct {
|
||||||
// Sets the header field for identifying the originating IP address of a client
|
// Sets the header field for identifying the originating IP address of a client
|
||||||
// Default is X-Forwarded-For
|
// Default is X-Forwarded-For
|
||||||
ForwardedForHeader string `json:"forwarded-for-header,omitempty"`
|
ForwardedForHeader string `json:"forwarded-for-header,omitempty"`
|
||||||
|
|
||||||
|
// EnableOpentracing enables the nginx Opentracing extension
|
||||||
|
// https://github.com/rnburn/nginx-opentracing
|
||||||
|
// By default this is disabled
|
||||||
|
EnableOpentracing bool `json:"enable-opentracing"`
|
||||||
|
|
||||||
|
// ZipkinCollectorHost specifies the host to use when uploading traces
|
||||||
|
ZipkinCollectorHost string `json:"zipkin-collector-host"`
|
||||||
|
|
||||||
|
// ZipkinCollectorPort specifies the port to use when uploading traces
|
||||||
|
ZipkinCollectorPort int `json:"zipkin-collector-port"`
|
||||||
|
|
||||||
|
// ZipkinServiceName specifies the service name to use for any traces created
|
||||||
|
// Default: nginx
|
||||||
|
ZipkinServiceName string `json:"zipkin-service-name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewDefault returns the default nginx configuration
|
// NewDefault returns the default nginx configuration
|
||||||
|
@ -448,6 +463,8 @@ func NewDefault() Configuration {
|
||||||
LimitConnZoneVariable: defaultLimitConnZoneVariable,
|
LimitConnZoneVariable: defaultLimitConnZoneVariable,
|
||||||
BindAddressIpv4: defBindAddress,
|
BindAddressIpv4: defBindAddress,
|
||||||
BindAddressIpv6: defBindAddress,
|
BindAddressIpv6: defBindAddress,
|
||||||
|
ZipkinCollectorPort: 9411,
|
||||||
|
ZipkinServiceName: "nginx",
|
||||||
}
|
}
|
||||||
|
|
||||||
if glog.V(5) {
|
if glog.V(5) {
|
||||||
|
|
|
@ -87,6 +87,14 @@ http {
|
||||||
underscores_in_headers {{ if $cfg.EnableUnderscoresInHeaders }}on{{ else }}off{{ end }};
|
underscores_in_headers {{ if $cfg.EnableUnderscoresInHeaders }}on{{ else }}off{{ end }};
|
||||||
ignore_invalid_headers {{ if $cfg.IgnoreInvalidHeaders }}on{{ else }}off{{ end }};
|
ignore_invalid_headers {{ if $cfg.IgnoreInvalidHeaders }}on{{ else }}off{{ end }};
|
||||||
|
|
||||||
|
{{ if (and $cfg.EnableOpentracing (ne $cfg.ZipkinCollectorHost "")) }}
|
||||||
|
opentracing on;
|
||||||
|
|
||||||
|
zipkin_collector_host {{ $cfg.ZipkinCollectorHost }};
|
||||||
|
zipkin_collector_port {{ $cfg.ZipkinCollectorPort }};
|
||||||
|
zipkin_service_name {{ $cfg.ZipkinServiceName }};
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
include /etc/nginx/mime.types;
|
include /etc/nginx/mime.types;
|
||||||
default_type text/html;
|
default_type text/html;
|
||||||
{{ if $cfg.UseGzip }}
|
{{ if $cfg.UseGzip }}
|
||||||
|
|
Loading…
Reference in a new issue