Having observability and telemetry is at the core of any production ready service. GraphJin has built-in support for OpenCensus for tracing requests all the way from HTTP to the database and providing all kinds of metrics.
OpenCensus has a concept called exporters these are external services that can consume this data and make to give you graphs, charts, alerting etc. GraphJin again has built-in support for Zipkin, Prometheus, Google Stackdriver and the AWS X-Ray exporters.
telemetry section of the standard config files is where you set values to configure this feature to your needs.
debug: Enabling debug enables an embedded web ui to test and debug tracing and metrics. This UI called
zPages is provided by OpenCensus and will be made available on the
/telemetry path. For more information on using
zPages https://opencensus.io/zpages/. Remeber to disable this in production.
interval: This controls the interval setting for OpenCensus metrics collection. This deafaults to
5 seconds if not set.
metric.exporters Setting this enables metrics collection. The supported values for this field are
stackdriver. The Prometheus exporter requires
metric.namespace to be set. The Sackdriver exporter requires the
metric.key to be set to the Google Cloud Project ID.
metric.endpoint Is not currently used by any of the exporters.
tracing.exporter Setting this enables request tracing. The supported values for this field are
xray. Zipkin requires
tracing.endpoint to be set. AWS and Xray are the same and do not require any addiitonal settings.
tracing.sample This controls what percentage of the requests should be traced. By default
0.5 or 50% of the requests are traced,
always is also a valid value for this field and it means all requests will be traced.
include_query Include the GraphJin SQL query to the trace. Be careful with this setting in production it will add the entire SQL query to the trace. This can be veru useful to debug slow requests.
include_params Include the GraphJin SQL query parameters to the trace. Be careful with this setting in production it will it can potentially leak sensitive user information into tracing logs.
Zipkin is a really great open source request tracing project. It's easy to add to your current GraphJin app as a way to test tracing in development. Add the following to the GraphJin generated
docker-compose.yml file. Also add
zipkin in your current apps
depends_on list. Once setup the Zipkin UI is available at http://localhost:9411