diff --git a/.docker/Dockerfile-build b/.docker/Dockerfile-build index addd0f7c335..9f419981611 100644 --- a/.docker/Dockerfile-build +++ b/.docker/Dockerfile-build @@ -6,7 +6,7 @@ WORKDIR /go/src/github.com/ory/hydra RUN mkdir -p ./internal/httpclient COPY go.mod go.sum ./ -COPY internal/httpclient/go.* ./internal/httpclient +COPY internal/httpclient/go.* ./internal/httpclient/ ENV GO111MODULE on ENV CGO_ENABLED 1 @@ -42,5 +42,3 @@ USER ory ENTRYPOINT ["hydra"] CMD ["serve"] - - diff --git a/driver/config/provider_test.go b/driver/config/provider_test.go index f500b9476ef..575f4f813f7 100644 --- a/driver/config/provider_test.go +++ b/driver/config/provider_test.go @@ -337,6 +337,13 @@ func TestViperProviderValidates(t *testing.T) { Zipkin: otelx.ZipkinConfig{ ServerURL: "http://zipkin/api/v2/spans", }, + OTLP: otelx.OTLPConfig{ + ServerURL: "localhost:4318", + Insecure: true, + Sampling: otelx.OTLPSampling{ + SamplingRatio: 1.0, + }, + }, }, }, c.Tracing()) } diff --git a/go.sum b/go.sum index fa537378578..c3dcd188324 100644 --- a/go.sum +++ b/go.sum @@ -1283,6 +1283,7 @@ golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210323180902-22b0adad7558/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= diff --git a/internal/.hydra.yaml b/internal/.hydra.yaml index 37c38723d63..bb02d986ad6 100644 --- a/internal/.hydra.yaml +++ b/internal/.hydra.yaml @@ -136,11 +136,13 @@ tracing: providers: jaeger: local_agent_address: 127.0.0.1:6831 - propagation: jaeger - max_tag_value_length: 1024 sampling: - type: const - value: 1 + trace_id_ratio: 1 server_url: http://sampling zipkin: server_url: http://zipkin/api/v2/spans + otlp: + insecure: true + server_url: localhost:4318 + sampling: + sampling_ratio: 1.0 diff --git a/internal/config/config.yaml b/internal/config/config.yaml index 7ff8bbc37fc..6af4cfe9657 100644 --- a/internal/config/config.yaml +++ b/internal/config/config.yaml @@ -443,21 +443,12 @@ tracing: jaeger: # The address of the jaeger-agent where spans should be sent to local_agent_address: 127.0.0.1:6831 - # The tracing header format - propagation: jaeger - # The maximum length of jaeger tag value - max_tag_value_length: 1024 sampling: - # The type of the sampler you want to use. Supports: - # - const - # - probabilistic - # - ratelimiting - type: const # The value passed to the sampler type that has been configured. # Supported values: This is dependant on the sampling strategy used: # - const: 0 or 1 (all or nothing) # - rateLimiting: a constant rate (e.g. setting this to 3 will sample requests with the rate of 3 traces per second) # - probabilistic: a value between 0..1 - value: 1.0 + trace_id_ratio: 1.0 # The address of jaeger-agent's HTTP sampling server server_url: http://localhost:5778/sampling diff --git a/quickstart-tracing.yml b/quickstart-tracing.yml index 19bb8657c06..68d403f5708 100644 --- a/quickstart-tracing.yml +++ b/quickstart-tracing.yml @@ -22,18 +22,19 @@ services: # - TRACING_SERVICE_NAME="Ory Hydra" - TRACING_PROVIDER=jaeger # - TRACING_PROVIDER=zipkin - # - TRACING_PROVIDER=datadog + # - TRACING_PROVIDER=otel # datadog # - TRACING_PROVIDER=elastic-apm ### Jaeger ### - TRACING_PROVIDERS_JAEGER_SAMPLING_SERVER_URL=http://jaeger:5778/sampling - TRACING_PROVIDERS_JAEGER_LOCAL_AGENT_ADDRESS=jaeger:6831 - - TRACING_PROVIDERS_JAEGER_SAMPLING_TYPE=const - - TRACING_PROVIDERS_JAEGER_SAMPLING_VALUE=1 + - TRACING_PROVIDERS_JAEGER_SAMPLING_TRACE_ID_RATIO=1 ### Zipkin ### # - TRACING_PROVIDERS_ZIPKIN_SERVER_URL=http://zipkin:9411/api/v2/spans ### DataDog ### ### See env vars here: https://docs.datadoghq.com/tracing/setup/go/#configuration) ### - # - DD_SERVICE=Hydra + # - TRACING_PROVIDERS_OTLP_INSECURE=true + # - TRACING_PROVIDERS_OTLP_SAMPLING_SAMPLING_RATIO=1.0 + # - TRACING_PROVIDERS_OTLP_SERVER_URL=localhost:4318 ### Elastic APM ### ### See env vars here: https://www.elastic.co/guide/en/apm/agent/go/1.x/configuration.html) ### # - ELASTIC_APM_SERVER_URL="http://apm-server:8200" @@ -61,3 +62,4 @@ services: # - DD_API_KEY= # Replace it with your DataDog API key # - DD_APM_ENABLED=true # - DD_APM_NON_LOCAL_TRAFFIC=true +# - DD_OTLP_CONFIG_RECEIVER_PROTOCOLS_HTTP_ENDPOINT=0.0.0.0:4318 diff --git a/spec/config.json b/spec/config.json index d0a02bbc6cd..c0d9b3083cc 100644 --- a/spec/config.json +++ b/spec/config.json @@ -1022,154 +1022,7 @@ "examples": ["cpu"] }, "tracing": { - "type": "object", - "additionalProperties": false, - "description": "Ory Hydra supports distributed tracing.", - "properties": { - "provider": { - "type": "string", - "description": "Set this to the tracing backend you wish to use. Supports Jaeger, Zipkin DataDog, Elastic APM and Instana. If omitted or empty, tracing will be disabled. Use environment variables to configure DataDog (see https://docs.datadoghq.com/tracing/setup/go/#configuration).", - "enum": [ - "jaeger", - "zipkin", - "datadog", - "elastic-apm", - "instana", - "otel" - ], - "examples": ["jaeger"] - }, - "service_name": { - "type": "string", - "description": "Specifies the service name to use on the tracer.", - "examples": ["Ory Hydra"] - }, - "providers": { - "type": "object", - "additionalProperties": false, - "properties": { - "jaeger": { - "type": "object", - "additionalProperties": false, - "description": "Configures the jaeger tracing backend.", - "properties": { - "local_agent_address": { - "type": "string", - "description": "The address of the jaeger-agent where spans should be sent to.", - "oneOf": [ - { - "pattern": "^\\[(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))]:([0-9]*)$" - }, - { - "pattern": "^([0-9]{1,3}\\.){3}[0-9]{1,3}:([0-9]*)$" - }, - { - "format": "uri" - } - ], - "examples": ["127.0.0.1:6831"] - }, - "propagation": { - "type": "string", - "description": "The tracing header format", - "examples": ["jaeger"] - }, - "max_tag_value_length": { - "type": "integer", - "description": "The value passed to the max tag value length that has been configured.", - "minimum": 0 - }, - "sampling": { - "type": "object", - "propertyNames": { - "enum": ["type", "value", "server_url"] - }, - "allOf": [ - { - "oneOf": [ - { - "properties": { - "type": { - "description": "The type of the sampler you want to use.", - "const": "const" - }, - "value": { - "type": "integer", - "description": "The value passed to the sampler type that has been configured.", - "minimum": 0, - "maximum": 1 - } - } - }, - { - "properties": { - "type": { - "description": "The type of the sampler you want to use.", - "const": "rateLimiting" - }, - "value": { - "type": "integer", - "description": "The value passed to the sampler type that has been configured.", - "minimum": 0 - } - } - }, - { - "properties": { - "type": { - "description": "The type of the sampler you want to use.", - "const": "probabilistic" - }, - "value": { - "type": "number", - "description": "The value passed to the sampler type that has been configured.", - "minimum": 0, - "maximum": 1 - } - } - } - ] - }, - { - "properties": { - "server_url": { - "type": "string", - "description": "The address of jaeger-agent's HTTP sampling server", - "format": "uri" - } - } - } - ], - "examples": [ - { - "type": "const", - "value": 1, - "server_url": "http://localhost:5778/sampling" - } - ] - } - } - }, - "zipkin": { - "type": "object", - "additionalProperties": false, - "description": "Configures the zipkin tracing backend.", - "properties": { - "server_url": { - "type": "string", - "description": "The address of Zipkin server where spans should be sent to.", - "format": "uri" - } - }, - "examples": [ - { - "server_url": "http://localhost:9411/api/v2/spans" - } - ] - } - } - } - } + "$ref": "ory://tracing-config" }, "sqa": { "type": "object",