Package: opentelemetry-launcher
Launcher, a Lightstep Distro for OpenTelemetry 🚀 [Deprecated]In August 2023,Lightstep became ServiceNow
Cloud Observability. To ease the
transition, all code artifacts will continue to use the Lightstep name. You
don't need to do anything to keep using this repository.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 startedpipinstallopentelemetry-launcherConfigureMinimal setupfromopentelemetry.launcherimportconfigure_opentelemetryfromopentelemetryimporttraceconfigure_opentelemetry(service_name="service-123",access_token="my-token",# optional)tracer=trace.get_tracer(__name__)withtracer.start_as_current_span("foo")asspan:span.set_attribute("attr1","valu1")withtracer.start_as_current_span("bar"):withtracer.start_as_current_span("baz"):print("Hello world from OpenTelemetry Python!")Additional tracer optionsconfigure_opentelemetry(service_name="service-123",service_version="1.2.3",access_token="my-token",span_exporter_endpoint="https://ingest.lightstep.com:443",log_level=debug,span_exporter_insecure=False,)Usage with Auto InstrumentationOpenTelemetry 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~
mkdirauto_instrumentation
virtualenvauto_instrumentationsourceauto_instrumentation/bin/activate
pipinstallopentelemetry-launcher
pipinstallrequests
pipinstallflask
opentelemetry-bootstrap-ainstallOnce that is done, clone theopentelemetry-pythonrepo to get the example code:gitclonegit@github.com:open-telemetry/opentelemetry-python.gitcdopentelemetry-python
gitcheckoutv1.1.0Set the environment variables:exportOTEL_SERVICE_NAME=auto-instrumentation-testingexportLS_ACCESS_TOKEN=<my-token>Run the server:cddocs/examples/auto-instrumentation
opentelemetry-instrumentpythonserver_uninstrumented.pyRun the client in a separate console:cddocs/examples/auto-instrumentation
pythonclient.pytestingThis should produce spans that can be captured in the Lightstep Explorer.Configuration OptionsConfigEnv VariableRequiredDefaultservice_nameOTEL_SERVICE_NAMEy-service_versionLS_SERVICE_VERSIONnNoneaccess_tokenLS_ACCESS_TOKENnNonemetrics_enabledLS_METRICS_ENABLEDnFalsespan_exporter_endpointOTEL_EXPORTER_OTLP_TRACES_ENDPOINTnhttps://ingest.lightstep.com:443span_exporter_insecureOTEL_EXPORTER_OTLP_TRACES_INSECUREnFalsepropagatorsOTEL_PROPAGATORSnb3resource_attributesOTEL_RESOURCE_ATTRIBUTESntelemetry.sdk.language=python,telemetry.sdk.version=0.12b0log_levelOTEL_LOG_LEVELnERRORmetrics_exporter_endpointOTLP_EXPORTER_METRICS_ENDPOINTnhttps://ingest.lightstep.com:443metrics_exporter_temporality_preferenceOTLP_EXPORTER_METRICS_TEMPORALITY_PREFERENCEncumulativeThe configuration option forpropagatorsaccepts a comma-separated string that will be interpreted as a list. For example,a,b,c,dwill be interpreted as["a", "b", "c", "d"].
The configuration option forresource_attributesaccepts a comma-separated string ofkey=valuepairs that will be interpreted as a dictionary. For example,a=1,b=2,c=3,d=4will be interpreted as{"a": 1, "b": 2, "c": 3, "d": 4}.Note about metricsMetrics support is stillexperimental.Principles behind Launcher100% interoperability with OpenTelemetryOne of the key principles behind putting together Launcher is to make lives of OpenTelemetry users easier, this means that there is no special configuration thatrequiresusers 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.ValidationAnother 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 inGo,Java,JavascriptandPythonand let us know what you think!Made with@Lightstep