Skip to content

krzko/opentelemetry-shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

opentelemetry-shell

Logs, metrics, and traces are often known as the three pillars of observability. We take great care to ensure we cover these pillars in our services.

But, underpinning these services is usually a script. Bash has been around for many decades now and other shells for even longer. This is usually the glue that ensures we can manage, deploy and perform many tasks around the services that we develop.

Why not ensure that these scripts are observable and send back telemery data as well? This is the aim of opentelemetry.sh, a set of OpenTelemetry functions for shells.

The functions utilise the OpenTelemetry Protocol Specification (OTLP) to send telemtry data back to any service that supports OTLP (HTTP). This is traditionally via an OpenTelemetry Collector or a vendor that supports this API specification.

Requirements

These functions have been tested on several bash versions, the list is as follows:

  • 3.x
  • 4.x
  • 5.x

Other versions and shells, your mileage may vary.

Whilst all effort has been made to limit the use of external binaries from the standard bash built-in commands, this is the list of binaries required or this library:

  • date: display or set date and time
  • hostname: set or print name of current host system
  • jq: Command-line JSON processor
  • uname: Print operating system name

As a future enhancement all effort will be made to remove the need for as many external binaries as possible and just utilise the built-in functions.

Howto

...

Examples

...

Environment Variables

The project aims to follow the standards of the the OpenTelemetry Environment Variable Specification

The following environment variables will be currentl used:

General SDK Configuration

  • OTEL_SERVICE_NAME: Sets the value of the service.name resource attribute
  • OTEL_LOG_LEVEL: Log level used by the logger, debug. Unset variable to disable verbose logging

Exporter Selection

  • OTEL_EXPORTER_OTEL_ENDPOINT: Exporter endpoint