Observability

The Observability adapter offers automatic logging, distributed Trace in the OpenTemetry pattern, and Metrics. In the settings it is possible to disable, configure Log settings in the local development environment.

The ‘saveinfile’ parameter enables the option to save the log locally on the developer’s machine. The “HideDetails” item hides information in the Log, and the “ShowHttpErrors” controls 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 logging (True/False)
Save Enable saving on a local path
Type Configure the format (Text/Json)
FileSize The maximum size of each saved 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 log HTTP errors (404, 500)
Export
Enable Enable log export (True/False)
Type Export logs to services (SEQ/Elastic)
Host Destination URL
ApiKey Auth Key to access url
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 track a distributed trace export configuration (OpenTelemetry) for 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 track 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 August 20, 2024 (2f9802da)