Observability with OpenTelemetry

Official Content
This documentation is valid for:

GeneXus collects telemetry data (traces, logs, and metrics) of its applications with OpenTelemetry.

ObservabilityOpenTelemetry 20230129

The steps you must follow to use it are:

  1. Set the Observability Provider property.
  2. Execute the OpenTelemetry collector.
  3. Configure the Environment Variables of the application’s Docker image. 
  4. Configure the Collector with an Observability Backend.
  5. Execute Docker image.

Set the Observability Provider Property

Select the value Opentelemetry in the  Observability Provider property.

Execute the OpenTelemetry collector

Follow the document Getting Started to execute the collector. 

Configure Environment Variables

Configure the following environment variables in the application’s Docker Image. 

For more information, refer to: SDK Configuration.

Sample

OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
OTEL_METRICS_EXPORTER=otlp 
OTEL_RESOURCE_ATTRIBUTES=service.namespace=GeneXus,service.name=sample-app,service.version=1.0.1

Configure the Collector with a Backend

Refer to the Configure document.

Execute Docker image

And to end, execute the application’s Docker image.

Sample

It is possible to execute OpenTelemetry through Docker Compose.

You may execute the following compose.yaml that has the configured collector connected to the GeneXus application to be deployed. 

otel-collector-confing.yaml sample can be seen here: https://opentelemetry.io/docs/collector/configuration/

compose.yaml:

version: "2"
services:
   # Collector
  otel-collector:
    image: otel/opentelemetry-collector-dev:latest
    command: ["--config=/etc/otel-collector-config.yaml", ""]
    volumes:
      - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml          

    ports:
      - "4317:4317"   # OTLP gRPC receiver
      - "4318:4318"   # OTLP Http receiver
         
  smaplegenexusapp:
    build:
      context: .    
    environment:
      - OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
      - OTEL_RESOURCE_ATTRIBUTES=service.namespace=GeneXus,service.name=sample-app,service.version=1.0.1
      - OTEL_METRICS_EXPORTER=otlp    
      - GX_LOG_LEVEL=info
      - GX_LOG_LEVEL_USER=debug
      - GX_LOG_OUTPUT=ConsoleAppender

    ports:
      - "80:80"

Scope

Generator: Java, .NET

Availability

This functionality is available since GeneXus 18 Upgrade 4.

See Also

Log settings with environment variables