News New Look, Same Vision: KrakenD’s Website Redesign

Document updated on Oct 24, 2022

Exporting to the logger with OpenCensus

Use standard logging instead
Unless you have a compelling reason to use this logger based on OpenCensus, you should use the standard KrakenD Logging and not this component. This component will be deprecated in the future.

Opencensus can also export data to the system logger as other exporters. If you use this component, do not not enable standard logging.

To enable OpenCensus logging, it only requires you to add the logger exporter in the opencensus module.

The following configuration snippet enables the logger:

{
  "extra_config":{
    "telemetry/opencensus": {
        "sample_rate": 100,
        "reporting_period": 0,
        "exporters": {
          "logger": {
              "stats": true,
              "spans": true
          }
        }
    }
}

As with all OpenCensus exporters, you can add optional settings in the telemetry/opencensus level:

Fields of "telemetry/opencensus"
* required fields

enabled_layers
Lets you specify what data you want to export. All layers are enabled by default unless you declare this section.
backend boolean
Reports the activity between KrakenD and your services
Defaults to false
pipe boolean
Reports the activity at the beginning of the proxy layer. It gives a more detailed view of the internals of the pipe between end-users and KrakenD, having into account merging of different backends.
Defaults to false
router boolean
Reports the activity between end-users and KrakenD
Defaults to false
reporting_period integer
The number of seconds passing between reports. If duration is less than or equal to zero, it enables the default behavior of each exporter.
Defaults to 0
sample_rate integer
A number between 0 (no requests at all) and 100 (all requests) representing the percentage of sampled requests you want to send to the exporter. Sampling the 100% of the requests is generally discouraged when the relationship between traffic and dedicated resources is sparse.
Defaults to 0

Then, the exporters key must contain an logger entry with the following properties:

Fields of "telemetry/opencensus": { "exporters":{} }
* required fields

logger object
Opencensus can export data to the system logger as another exporter. Recommended to use telemetry/logging instead.
spans boolean
Whether to log the spans or not
Defaults to false
stats boolean
Whether to log the statistics or not
Defaults to false
Scarf

Unresolved issues?

The documentation is only a piece of the help you can get! Whether you are looking for Open Source or Enterprise support, see more support channels that can help you.

See all support channels