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.
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 timehostname
: set or print name of current host systemjq
: Command-line JSON processoruname
: 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.
...
...
The project aims to follow the standards of the the OpenTelemetry Environment Variable Specification
The following environment variables will be currentl used:
OTEL_SERVICE_NAME
: Sets the value of theservice.name
resource attributeOTEL_LOG_LEVEL
: Log level used by the logger,debug
. Unset variable to disable verbose logging
OTEL_EXPORTER_OTEL_ENDPOINT
: Exporter endpoint