Observability

The Observability adapter offers Automatic Logging, Distributed Tracing in the OpenTemetry standard, and Metrics. In the settings it is possible to disable, configure Log settings in the local development environment.

The ‘saveinfile’ parameter activates the option to save the log locally on the developer’s machine. The “HideDetails” item hides information in the Log and the “ShowHttpErrors” control the display of http errors in the Log.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 "DevPrime_Observability": {
    "Enable": "true",
    "Log": {
      "Enable": "true",
      "Save": "false",
      "Type": "text",
      "FileSize": "5242880",
      "HideDetails": "false",
      "HideDateTime": "false",
      "ShowAppName": "false",
      "Path": "",
      "ShowHttpErrors": "400",
      "Export": {
        "Enable": "false",
        "Type": "seq",
        "Host": "http://localhost:5341",
        "ApiKey": "your api key",
        "ControlLevelSwitch": "Information"
      }
    },
    "Metrics": {
      "Enable": "false"
    },
    "Trace": {
      "Enable": "false",
      "Type": "zipkin",
      "Endpoint": "http://localhost:9411/api/v2/spans"
    }
  },
Observability
Enable Enable the Stream adapter (True/False)
Log
Enable Enable logs (True/False)
Save Enable saving on a local path
Type Configure the format (Text/Json)
FileSize The maximum size of each save file
HideDetails Hide payload details in the log (True/False)
HideDateTime Hide the date and time in the log (True/False)
ShowAppName Show application name in log (True/False)
Path The path of a local folder to save logs
ShowHttpErrors Display in the log HTTP errors (404, 500)
Export
Enable Enables export log (True/False)
Type Export the logs to the services (SEQ/Elastic)
Host Destination URL
ApiKey Auth URL Access Key
ControlLevelSwitch
Metrics
Enable Enable Metrics Export (True/False)
Trace
Enable Enable Distributed Trace Export
Type OpenTelemetry Export Format (Zipkin/Jaeger)
Endpoint Destination URL

Enabling local export for Jarger

In this example, you can follow a distributed trace export configuration (OpenTelemetry) to Jaeger.

1
2
3
4
5
6
7
8
  "Trace": {
      "enable": "true",
      "Type": "Jaeger",
      "Host": "localhost",
      "Port": "6831",
      "Endpoint": "http://localhost:14268",
      "Protocol": "UdpCompactThrift"
    }

Enabling local export for Zipkin

In this example, you can follow a distributed trace export configuration (OpenTelemetry) to Zipkin.

1
2
3
4
5
   "Trace": {
      "Enable": "true",
      "Type": "zipkin",
      "Endpoint": "http://localhost:9411/api/v2/spans"
    }

Important information:

  • In the production environment, especially in a Kubernetes cluster, it is highly recommended to deploy a collector such as Fluentbit or similar solutions to monitor the default output (stdout) of containers and obtain Logs for targeting to a destination.
  • Cloud platforms offer collectors with OpenTelemetry support

Explore implementation examples:

Last modified January 10, 2024 (967dcac3)