forked from getporter/porter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use structured logs and export traces
Log to a file in ~/.porter/logs/CORRELLATION_ID.json and in colored human readable output to stderr. When stderr is not a TTY, color is omitted (which is what we need for piping to a file or running on headless CI servers). Tracing has been enabled using open-telemetry and can be configured with the standard OTEL environment variables. https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#specify-protocol This is just a stub of the final tracing and log switch over, that lays down a framework for converting the rest and instrumenting more commands. For now we start a trace for the command executed. Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
- Loading branch information
Showing
79 changed files
with
1,773 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
title: Collect Diagnostics from Porter | ||
description: How to configure Porter to generate logs and telemetry data for diagnostic purposes | ||
--- | ||
|
||
When the [structured-logs experimental feature][structured-logs] is enabled, Porter generates two types of data to assist with diagnostics and troubleshooting: | ||
|
||
* [Logs](#logs) | ||
* [Telemetry](#telemetry) | ||
|
||
## Logs | ||
|
||
Porter can be configured to write logs to the PORTER_HOME/logs directory, for example ~/.porter/logs. | ||
Each time a Porter command is executed, a new log file is created, formatted in json, containing all the logs output by the command. | ||
The log lines are filtered by the current log level. | ||
|
||
The name of each log file is the command's _correlationId_ which can be used to find the trace for the command executed in the configured [telemetry](#telemetry) backend. | ||
See [Log Settings] for details on how to configure logging. | ||
|
||
## Telemetry | ||
|
||
Porter is compatible with the [OpenTelemetry] specification and generates trace data that can be sent to a [compatible services][compat]. | ||
When the [structured-logs experimental feature][structured-logs] and [telemetry] is enabled, Porter automatically uses the standard [OpenTelemetry environment variables] to configure the trace exporter. | ||
|
||
Below is an example trace from running the porter upgrade command. You can see timings for each part of the command, and relevant variables used. | ||
|
||
![Screen shot of the Jaeger UI showing that porter upgrade was run](/administrators/jaeger-trace-example.png) | ||
|
||
If you are running a local grpc OpenTelemetry collector, for example with the [otel-jaeger bundle], you can set the following environment variables to have Porter send telemetry data to it. This turns on the [structured-logs experimental feature][structured-logs], enables telemetry, and uses standard OpenTelemetry environment variables to point to an unsecured grpc OpenTelemetry collector. | ||
|
||
* PORTER_EXPERIMENTAL: structured-logs | ||
* PORTER_TELEMETRY_ENABLED: true | ||
* OTEL_EXPORTER_OTLP_PROTOCOL: grpc | ||
* OTEL_EXPORTER_OTLP_ENDPOINT: 127.0.0.1:4317 | ||
* OTEL_EXPORTER_OTLP_INSECURE: true | ||
|
||
See [Telemetry Settings][telemetry] for all the supported configuration settings. | ||
|
||
[compat]: https://opentelemetry.io/vendors/ | ||
[OpenTelemetry environment variables]: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.8.0/specification/protocol/exporter.md | ||
[telemetry]: /configuration/#telemetry | ||
[Log Settings]: /configuration/#logs | ||
[structured-logs]: /configuration/#structured-logs | ||
[OpenTelemetry]: https://opentelemetry.io | ||
[otel-jaeger bundle]: https://github.com/getporter/example-bundles/tree/main/otel-jaeger |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.