--disable-telemetry


#1

Hi, I am trying to set up hydra step by step. When running hydra in docker, I tried to disable telemetry, but I could not find a way to do so (at least the log always says “Setting up telemetry”). I tried passing --disable-telemetry as a cmd line option and also -e DISABLE_TELEMETRY=“1” as per manual to no avail.

Looking in the source code I see that in newHealthHandler() (which is called from RunHost() -> registerRoutes()) the function GetMetrics() gets always called, no command line switches are processed for this calling sequence. Wouldn’t that mean that telemetry is always enabled?

Or maybe I haven’t set the cmd line switches correctly, I start hydra like this:

docker run -d --name ory-hydra-prueba --network hydranet -p 9000:4444 -e SYSTEM_SECRET=$SYSTEM_SECRET -e DATABASE_URL=$DATABASE_URL -e ISSUER=https://localhost:9000/ -e CONSENT_URL=http://localhost:9020/consent -e FORCE_ROOT_CLIENT_CREDENTIALS=admin:demo-password oryd/hydra host --disable-telemetry

Kind regards!


#2

https://github.com/ory/hydra/blob/master/cmd/server/handler.go#L107 :slight_smile:


#3

Yes, but what about



?


#4

If you inspect the code, you will see that that method is not responsible for reporting to segment. health.go doesn’t use .Metrics (it’s a relic from an older version), and GetMetrics() only instantiates the struct without side effects. What does happen though is that the log message (which I guess is a side effect… :smiley: ) is being printed wrongly there. Please note that analytics.NewWithConfig() doesn’t send any data, it only sets up a channel receiver and instantiates the struct as well.

Only metrics.RegisterSegment() and metrics.CommitMemoryStatistics() do actually trigger events which in turn get send to segment.io. We could however clean this up a bit so it’s more obvious that there isn’t a bug / we’re misleading people on purpose (just to make it clear, it’s neither).


#5

I understand. The log message definitively took me on a wrong track as it made me think metrics is enabled, given that it indicates that a metric manager was constructed. It was not clear to me why this is necessary if no metrics are desired. Also Config.metrics is initialized on this first call sequence, which kinda indicates the code will use it at some point. A little bit of cleanup could make this more transparent.

Thanx for your fast answer!


#6

No problem, any time


#7

Tracked as https://github.com/ory/hydra/issues/833