Skip to main content

Launcher, Configuration Layer for OpenTelemetry

Project description

build status PyPI version Downloads

Launcher, an OpenTelemetry Configuration Layer 🚀

NOTE: the code in this repo is currently in alpha and will likely change

What is Launcher?

Launcher is a configuration layer that chooses default values for configuration options that many OpenTelemetry users want. It provides a single function in each language to simplify discovery of the options and components available to users. The goal of Launcher is to help users that aren't familiar with OpenTelemetry quickly ramp up on what they need to get going and instrument.

Getting started

pip install opentelemetry-launcher

Configure

Minimal setup

from opentelemetry.launcher import configure_opentelemetry

configure_opentelemetry(
    service_name="service-123",
    access_token="my-token",  # optional
)

tracer = trace.get_tracer(__name__)

with tracer.start_as_current_span("foo") as span:
    span.set_attribute("attr1", "valu1")
    with tracer.start_as_current_span("bar"):
        with tracer.start_as_current_span("baz"):
            print("Hello world from OpenTelemetry Python!")

Additional tracer options

configure_opentelemetry(
    service_name="service-123",
    service_version="1.2.3",
    access_token="my-token",
    span_exporter_endpoint="ingest.lightstep.com:443",
    metric_exporter_endpoint="ingest.lightstep.com:443/metrics",
    log_level=debug,
    span_exporter_insecure=False,
    metric_exporter_insecure=False,
)

Usage with Auto Instrumentation

OpenTelemetry Python includes a command that allows the user to automatically instrument certain third party libraries. Here is an example that shows how to use this launcher with auto instrumentation.

First, create a new virtual environment:

cd ~
mkdir auto_instrumentation
virtualenv auto_instrumentation
source auto_instrumentation/bin/activate
pip install opentelemetry-launcher
pip install requests
pip install flask
opentelemetry-bootstrap -a install

Once that is done, clone the opentelemetry-python repo to get the example code:

git clone git@github.com:open-telemetry/opentelemetry-python.git
cd opentelemetry-python

Set the environment variables:

export LS_SERVICE_NAME=auto-instrumentation-testing
export LS_ACCESS_TOKEN=<the access token>

Run the server:

cd ~
cd open-telemetry/opentelemetry-python/docs/examples/auto-instrumentation
opentelemetry-instrument python server_uninstrumented.py

Run the client in a separate console:

cd ~
cd open-telemetry/opentelemetry-python/docs/examples/auto-instrumentation
python client.py testing

This should produce spans that can be captured in the Lightstep Explorer Web UI.

Configuration Options

Config Env Variable Required Default
service_name LS_SERVICE_NAME y -
service_version LS_SERVICE_VERSION n unknown
access_token LS_ACCESS_TOKEN n -
span_exporter_endpoint OTEL_EXPORTER_OTLP_SPAN_ENDPOINT n ingest.lightstep.com:443
span_exporter_insecure OTEL_EXPORTER_OTLP_SPAN_INSECURE n False
metric_exporter_endpoint OTEL_EXPORTER_OTLP_METRIC_ENDPOINT n ingest.lightstep.com:443/metrics
metric_exporter_insecure OTEL_EXPORTER_OTLP_METRIC_INSECURE n False
propagator OTEL_PROPAGATORS n b3
resource_attributes OTEL_RESOURCE_ATTRIBUTES n -
log_level OTEL_LOG_LEVEL n error

Principles behind Launcher

100% interoperability with OpenTelemetry

One of the key principles behind putting together Launcher is to make lives of OpenTelemetry users easier, this means that there is no special configuration that requires users to install Launcher in order to use OpenTelemetry. It also means that any users of Launcher can leverage the flexibility of configuring OpenTelemetry as they need.

Opinionated configuration

Although we understand that not all languages use the same format for configuration, we find this annoying. We decided that Launcher would allow users to use the same configuration file across all languages. In this case, we settled for YAML as the format, which was inspired by the OpenTelemetry Collector.

Validation

Another decision we made with launcher is to provide end users with a layer of validation of their configuration. This provides us the ability to give feedback to our users faster, so they can start collecting telemetry sooner.

Start using it today in Go, Java, Javascript and Python and let us know what you think!


Made with :heart: @ Lightstep

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opentelemetry-launcher-0.12b0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

opentelemetry_launcher-0.12b0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file opentelemetry-launcher-0.12b0.tar.gz.

File metadata

  • Download URL: opentelemetry-launcher-0.12b0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for opentelemetry-launcher-0.12b0.tar.gz
Algorithm Hash digest
SHA256 3511d57a27ba7d1c37af94b82b4ba18122adaf3bb43015c4b008450891b23bfc
MD5 f0fd11d9edb6fc1c572a4acdc0decc84
BLAKE2b-256 cf9ba64af79e6683093c4894aacfbf5ec31dc8075854fc933628f2ef520cfa79

See more details on using hashes here.

File details

Details for the file opentelemetry_launcher-0.12b0-py3-none-any.whl.

File metadata

  • Download URL: opentelemetry_launcher-0.12b0-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for opentelemetry_launcher-0.12b0-py3-none-any.whl
Algorithm Hash digest
SHA256 9833d10794cbd1998322dc3af256d94c49d57e65f12084addb59035421bab8db
MD5 23f2d32057715b443370bc64769a669e
BLAKE2b-256 349c6ca363eb3e939442887ab5c797e5766c1639bdf578576acb3f23cf3b11e4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page