Open Telemetry Support

Open Telemetry is a feature available in Genio projects that allows the developer to have control over their application's logs, metrics and traces. This is still in an experimental phase with only logs and traces available.

Configuration

Setup Open Telemetry Collector

Open Telemetry using a service to collect and group all the data (metrics, logs and traces), and send it to the configured destinations. https://opentelemetry.io/docs/collector/installation/

Docker

With docker, the following docker-compose configuration can be used:

services:
    otel-collector: # Open Telemetry Collector
        image: otel/opentelemetry-collector-contrib:latest
        container_name: collector
        command: ["--config=/etc/otel-collector-config.yml"]
        volumes:
            - <config-path>:/etc/otel-collector-config.yml
        ports:
            - "13133:13133"
            - "9411"
            - "4317:4317"
            - "4318:4318"

On the volumes section, remember to replace the <config-path> with the actual path for the config (preferably a relative path).

Windows Executable

On a windows machine, an executable can be used to get the collector running (this can also be configured as a Windows Service). After downloading the .exe file, the command should be the following:

otelcol-contrib.exe --config <config-path>

Again, don't forget to replace the <config-path> with the actual path

Open Telemetry Collector Config File

Open Telemetry Collector has a config file where its endpoints are configured, what exporters the data will be sent to, and some other miscelaneous config.

https://opentelemetry.io/docs/collector/configuration/

Here is a sample config used for testing in Quidgest:

receivers:
  otlp:
    protocols:
      grpc: 
        endpoint: "0.0.0.0:4317"
      http:
        endpoint: "0.0.0.0:4318"

exporters:
  zipkin:
    endpoint: "http://zipkin:9411/api/v2/spans"
  otlp/jaeger:
    endpoint: "http://jaeger:4317"
    tls:
      insecure: true
  otlphttp:
    endpoint: "http://loki:3100/otlp"
    tls:
      insecure: true
  prometheus:
    endpoint: "0.0.0.0:8889"
  debug:
    verbosity: detailed

service:
  extensions: [health_check]
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [zipkin, otlp/jaeger, debug]

    logs:
      receivers: [otlp]
      exporters: [otlphttp, debug]

    metrics:
      receivers: [otlp]
      exporters: [prometheus, debug]

Feel free to do all the necessary changes to fit your needs.

Genio Project Configuration

To configure Genio projects to use Open Telemetry with the configured Collector, a piece of config has to be added to the appsettings.json config file.

Here is an example:

{
    "TelemetryConfig": {
        "LoggerType": "OTLP",
        "CollectorAddress": "http://localhost:4317",
        "EnableTracing": true
    }
}
  • LoggerType: Either "OTLP" for OpenTelemtry or "LOG4NET" to use the default Log4Net
  • CollectorAddress: The endpoint of the Open Telemtry Collector configured earlier
  • EnableTracing: Enable or disable the tracing feature