feat: OpenTelemetry module integration (#9062)

* OpenTelemetry module integration

* e2e test

* e2e test fix

* default OpentelemetryConfig

* e2e values

* mount otel module for otel test only

* propagate IS_CHROOT

* propagate IS_CHROOT e2e test

* code doc

* comments

* golint

* opentelemetry doc

* zipkin

* zipkin

* typo

* update e2e test OpenTelemetry value

* use opentelemetry value

* revert merge conflict

* fix

* format

* review comments

* clean
This commit is contained in:
Ehsan Saei 2023-03-22 19:58:22 +01:00 committed by GitHub
parent c075793ae5
commit c8cb9167d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 1131 additions and 2 deletions

View file

@ -568,6 +568,54 @@ type Configuration struct {
// Default: true
OpentracingTrustIncomingSpan bool `json:"opentracing-trust-incoming-span"`
// EnableOpentelemetry enables the nginx Opentelemetry extension
// By default this is disabled
EnableOpentelemetry bool `json:"enable-opentelemetry"`
// OpentelemetryConfig sets the opentelemetry config file
// Default: /etc/nginx/opentelemetry.toml
OpentelemetryConfig string `json:"opentelemetry-config"`
// OpentelemetryOperationName specifies a custom name for the server span
OpentelemetryOperationName string `json:"opentelemetry-operation-name"`
// OpentelemetryTrustIncomingSpan sets whether or not to trust incoming trace spans
// If false, incoming span headers will be rejected
// Default: true
OpentelemetryTrustIncomingSpan bool `json:"opentelemetry-trust-incoming-span"`
// OtlpCollectorHost specifies the host to use when uploading traces
OtlpCollectorHost string `json:"otlp-collector-host"`
// OtlpCollectorPort specifies the port to use when uploading traces
// Default: 4317
OtlpCollectorPort string `json:"otlp-collector-port"`
// OtelServiceName specifies the service name to use for any traces created
// Default: nginx
OtelServiceName string `json:"otel-service-name"`
// OtelSampler specifies the sampler to use for any traces created
// Default: AlwaysOff
OtelSampler string `json:"otel-sampler"`
// OtelSamplerRatio specifies the sampler ratio to use for any traces created
// Default: 0.01
OtelSamplerRatio float32 `json:"otel-sampler-ratio"`
//OtelSamplerParentBased specifies the parent based sampler to be use for any traces created
// Default: false
OtelSamplerParentBased bool `json:"otel-sampler-parent-based"`
// MaxQueueSize specifies the max queue size for uploading traces
OtelMaxQueueSize int32 `json:"otel-max-queuesize"`
// ScheduleDelayMillis specifies the max delay between uploading traces
OtelScheduleDelayMillis int32 `json:"otel-schedule-delay-millis"`
// MaxExportBatchSize specifies the max export batch size to used when uploading traces
OtelMaxExportBatchSize int32 `json:"otel-max-export-batch-size"`
// ZipkinCollectorHost specifies the host to use when uploading traces
ZipkinCollectorHost string `json:"zipkin-collector-host"`
@ -917,6 +965,13 @@ func NewDefault() Configuration {
BindAddressIpv4: defBindAddress,
BindAddressIpv6: defBindAddress,
OpentracingTrustIncomingSpan: true,
OpentelemetryTrustIncomingSpan: true,
OpentelemetryConfig: "/etc/nginx/opentelemetry.toml",
OtlpCollectorPort: "4317",
OtelServiceName: "nginx",
OtelSampler: "AlwaysOff",
OtelSamplerRatio: 0.01,
OtelSamplerParentBased: false,
ZipkinCollectorPort: 9411,
ZipkinServiceName: "nginx",
ZipkinSampleRate: 1.0,