ory / k8s

Kubernetes Helm Charts for the ORY ecosystem.
https://k8s.ory.sh/helm
Apache License 2.0
336 stars 258 forks source link

Automigrate job does not accept `elastic-apm` as a tracer option with helm chart v0.26.0 #538

Closed zagr0 closed 1 year ago

zagr0 commented 2 years ago

Preflight checklist

Describe the bug

When upgrade hydra helm chart deployment from 0.25.6 -> 0.26.0 and using elastic-apm as tracing config the auto migration job fails with error:

level=error msg=Unable to initialize Tracer. audience=application error=map[message:expected one of [jaeger, zipkin, otel, ] but got elastic-apm] service_name=Ory Hydra service_version=v2.0.1

Reproducing the bug

  1. use tracer as `elastic-apm'
    deployment:
      extraEnv:
        - name: TRACING_PROVIDER
          value: elastic-apm
  2. do helm upgrade ory/hydra from 0.25.6 to 0.26.0

Relevant log output

time=2022-11-02T13:13:10Z level=error msg=Unable to initialize Tracer. audience=application error=map[message:expected one of [jaeger, zipkin, otel, ] but got elastic-apm] service_name=Ory Hydra service_version=v2.0.1
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x11cf810]

goroutine 1 [running]:
github.com/ory/x/otelx.(*Tracer).Tracer(...)
    /go/pkg/mod/github.com/ory/x@v0.0.486/otelx/otel.go:83
github.com/ory/hydra/driver.(*RegistryBase).Tracer(0xc00021f800, {0xc0001fcb00?, 0xc0009d37c0?})
    /project/driver/registry_base.go:484 +0x150
github.com/ory/hydra/driver.(*RegistrySQL).Init(0xc0009e86f0, {0x19d23f8, 0xc0001ac000}, 0x1, 0x0, {0x19cac50?, 0x23f3328?})
    /project/driver/registry_sql.go:99 +0xb1
github.com/ory/hydra/driver.NewRegistryFromDSN({0x19d23f8, 0xc0001ac000}, 0xc00057f5c0?, 0xc000173fd0?, 0x2?, 0x0?, {0x19cac50, 0x23f3328})
    /project/driver/registry.go:80 +0x86
github.com/ory/hydra/driver.New({0x19d23f8, 0xc0001ac000}, 0xc00057f4a0, {0xc000b1fcc8, 0x4, 0x0?})
    /project/driver/factory.go:98 +0x1d0
github.com/ory/hydra/cmd/cli.(*MigrateHandler).MigrateSQL(0x0?, 0xc000a5a780, {0xc000a1e640, 0x0, 0x0?})
    /project/cmd/cli/handler_migrate.go:263 +0x2f0
github.com/spf13/cobra.(*Command).execute(0xc000a5a780, {0xc000a1e600, 0x4, 0x4})
    /go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:872 +0x694
github.com/spf13/cobra.(*Command).ExecuteC(0xc000a24000)
    /go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:990 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
    /go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:918
github.com/ory/hydra/cmd.Execute()
    /project/cmd/root.go:118 +0x3a
main.main()
    /project/main.go:31 +0x69


### Relevant configuration

_No response_

### Version

0.26.0

### On which operating system are you observing this issue?

Linux

### In which environment are you deploying?

Kubernetes with Helm

### Additional Context

_No response_
Demonsthere commented 2 years ago

Hi there! It seems that hydra does not support elastic-apm as a tracing provider. Lately we have moved towards using otel as an interface, which should allows you using other, otel compatible tracer options :)

zagr0 commented 2 years ago

We have it working with v1 for years and it seems like present in documentation for v2 also. I'm confused about that. https://github.com/ory/hydra/blob/v2.0.1/quickstart-tracing.yml#L26

aeneasr commented 2 years ago

We switched from OpenTracing, which is deprecated, to OpenTelemetry. Unfortunately aws-apm does not yet support it (or at least did not support it when we implemented it)

zagr0 commented 2 years ago

Ok, got it. Seems like apm server supports otel protocol, will try to use otel instead https://www.elastic.co/guide/en/apm/guide/current/open-telemetry.html

Demonsthere commented 2 years ago

Hey @zagr0 if it works for you, i'd be happy to add a section in the documentation on how to add it, to make it easier for others :)