Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: enable datadog tracer #3431

Merged
merged 4 commits into from
Feb 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .docker/Dockerfile-build
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without a trailing slash, it will fail.

Step 6/21 : COPY internal/httpclient/go.* ./internal/httpclient
When using COPY with more than one source file, the destination must be a directory and end with a /
make: *** [docker] Error 1


ENV GO111MODULE on
ENV CGO_ENABLED 1
Expand Down Expand Up @@ -42,5 +42,3 @@ USER ory

ENTRYPOINT ["hydra"]
CMD ["serve"]


7 changes: 7 additions & 0 deletions driver/config/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
10 changes: 6 additions & 4 deletions internal/.hydra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 1 addition & 10 deletions internal/config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 6 additions & 4 deletions quickstart-tracing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -61,3 +62,4 @@ services:
# - DD_API_KEY=<YOUR_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
149 changes: 1 addition & 148 deletions spec/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
alnr marked this conversation as resolved.
Show resolved Hide resolved
},
"sqa": {
"type": "object",
Expand Down