Skip to main content

Cisco Distribution for OpenTelemetry

Project description

otel-py

PIP Published Version Apache License Coverage

Trace

This package provides OpenTelemetry-compliant tracing to Python applications for the collection of distributed tracing and performance metrics in Cisco Telescope.

Contents

Installation

Install packages

To install Cisco OpenTelemetry Distribution simply run:

pip install cisco-telescope

Install dependencies

To install all supported instrumentation frameworks run:

telescope-bootstrap

Library initialization

Cisco OpenTelemetry Distribution is activated and instruments the supported libraries once the tracing.init() has returned.

from cisco_telescope import tracing

tracing.init(
  service_name="<your-service-name>",
  cisco_token="<your-telescope-token>"
)

OpenTelemetry Collector Configuration

By default, Cisco OpenTelemetry Distribution exports data directly to Cisco Telescope's infrastructure backend. Existing OpenTelemetery Collector is supported, the following configuration can be applied

Configure custom trace exporter

Cisco OpenTelemetry Distribution supports configure multiple custom exporters. Example for create OtlpGrpc Span exporter to local OpenTelemetry collector:

from cisco_telescope import tracing, options

tracing.init(
  service_name="<your-service-name>",
  cisco_token="<your-telescope-token>",
  exporters=[
    options.ExporterOptions(
      exporter_type="otlp-grpc",
      collector_endpoint="grpc://localhost:4317"
    ),
  ]
)

Configure custom OpenTelemetry collector to export trace data to Cisco Telescope's external collector.

collector.yaml ...

exporters:
  otlphttp:
    traces_endpoint: https://production.cisco-udp.com/trace-collector:80
    headers:
      authorization: <Your Telescope Token>
    compression: gzip


service:
  pipelines:
    traces:
      exporters: [otlphttp]

Existing OpenTelemetry Instrumentation

Notice: Only relevant if interested in streaming existing OpenTelemetry workloads. Cisco Telescope. supports native OpenTelemetery traces.

from opentelemetry import trace
from opentelemetry.sdk.resources import Resource
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor

from opentelemetry.exporter.otlp.proto.http.trace_exporter import (
    OTLPSpanExporter as OTLPHTTPExporter,
)

provider = TracerProvider(resource=Resource.create())
trace.set_tracer_provider(provider)

http_exporter = OTLPHTTPExporter(
  endpoint="https://production.cisco-udp.com/trace-collector:80",
  headers= {
    "authorization": "<Your Telescope Token>",
  },
)

processor = BatchSpanProcessor(http_exporter)
provider.add_span_processor(processor)

Supported Runtimes

Cisco OpenTelemetry Distribution supports Python 3.6+

Frameworks

Cisco OpenTelemetry Python Distribution is extending Native OpenTelemetry, supported frameworks available here.

Supported Libraries

Cisco OpenTelemetry Python Distribution is extending Native OpenTelemetry, supported libraries available here.

Cisco OpenTelemetry Python Distribution provides out-of-the-box instrumentation (tracing) and advanced payload collections for many popular frameworks and libraries.

Library Extended Support Version
requests Fully supported
aiohttp Fully supported
grpc Client/Server Unary support

Configuration

Advanced options can be configured as a parameter to the init() method:

Parameter Env Type Default Description
cisco_token CISCO_TOKEN string - Cisco account token
service_name OTEL_SERVICE_NAME string application Application name that will be set for traces
debug CISCO_DEBUG string False Debug logs
payloads_enabled CISCO_PAYLOADS_ENABLED string False Debug logs

Exporter options

Parameter Env Type Default Description
collector_endpoint OTEL_COLLECTOR_ENDPOINT string https://production.cisco-udp.com/trace-collector:80 The address of the trace collector to send traces to
type OTEL_EXPORTER_TYPE string otlp-http The exporter type to use (Currently only otlp-http are supported). Multiple exporter option available via init function see example below

License

Provided under the Apache 2.0. See LICENSE for details.

Copyright 2022, Cisco

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

cisco-telescope-0.3.3.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

cisco_telescope-0.3.3-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

Details for the file cisco-telescope-0.3.3.tar.gz.

File metadata

  • Download URL: cisco-telescope-0.3.3.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.9.10 Darwin/21.4.0

File hashes

Hashes for cisco-telescope-0.3.3.tar.gz
Algorithm Hash digest
SHA256 a131dd802add1d8d121753d29dbbb0f5178eb8ccd756ace4e5157c7c311e582e
MD5 f8c263d32b777c97a535296860904c68
BLAKE2b-256 98077145ce9bf53e40a500e84352bb64a665ea6d89cbf46370edfa844cc80d6f

See more details on using hashes here.

File details

Details for the file cisco_telescope-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: cisco_telescope-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 24.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.9.10 Darwin/21.4.0

File hashes

Hashes for cisco_telescope-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 63f57c8846fdba4719a683821e8ca05ae5be82e80a2f976d734fcbbfb725e8d0
MD5 4686670b43c78d06b3af6379a1953615
BLAKE2b-256 743f255d07ce18c9e31266737f0dca88e0f322bc67ac396699a1c0143a8d1a6b

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