Package: cisco-telescope
otel-pyThis package provides OpenTelemetry-compliant tracing to Python
applications for the collection of distributed tracing and performance metrics inCisco Telescope.ContentsInstallationInstall PackagesInstall DependenciesLibrary initializationOpenTelemetry Collector ConfigurationExisting OpenTelemetry InstrumentationSupported RuntimesSupported LibrariesConfigurationGetting HelpOpening IssuesLicenseInstallationRequirementsPython >=3.8, <4.0pip3 >= 22.0Install packagesTo install Cisco OpenTelemetry Distribution simply run:pipinstallcisco-telescopeFull instrumentation supportTo install the required dependencies for all relevant supported instrumentation frameworks run:telescope-bootstrapLibrary initializationCisco OpenTelemetry Distribution is activated and instruments the supported libraries once thetracing.init()has returned.To initialize the library, you'll need a cisco-token, which is taken from yourAccount tab on the Telescope console Settings page.fromcisco_telescopeimporttracingtracing.init(service_name="<your-service-name>",cisco_token="<your-cisco-token>")OpenTelemetry Collector ConfigurationBy default, Cisco OpenTelemetry Distribution exports data directly toCisco Telescope'sinfrastructure backend.ExistingOpenTelemetery Collector is supported, the following configuration can be appliedConfigure custom trace exporterCisco OpenTelemetry Distribution supports the configuration of multiple custom exporters. Note that you will need to handle your exporter authorization.
Example for creating OtlpGrpc Span exporter to local OpenTelemetry collector:fromcisco_telescopeimporttracing,optionstracing.init(service_name="<your-service-name>",exporters=[options.ExporterOptions(exporter_type="otlp-grpc",collector_endpoint="grpc://localhost:4317"),])Configure custom OpenTelemetry collector to export trace data toCisco Telescope'sexternal collector.collector.yaml ...exporters:otlphttp:traces_endpoint:https://production.cisco-udp.com/trace-collectorheaders:authorization:Bearer <Your Telescope Token>compression:gzipservice:pipelines:traces:exporters:[otlphttp]Existing OpenTelemetry InstrumentationNotice: Only relevant if interested in streaming existing OpenTelemetry workloads.Cisco Telescope. supports native OpenTelemetery traces.fromopentelemetryimporttracefromopentelemetry.sdk.resourcesimportResourcefromopentelemetry.sdk.traceimportTracerProviderfromopentelemetry.sdk.trace.exportimportBatchSpanProcessorfromopentelemetry.exporter.otlp.proto.http.trace_exporterimport(OTLPSpanExporterasOTLPHTTPExporter,)provider=TracerProvider(resource=Resource.create())trace.set_tracer_provider(provider)http_exporter=OTLPHTTPExporter(endpoint="https://production.cisco-udp.com/trace-collector",headers={"authorization":"Bearer <Your Telescope Token>",},)processor=BatchSpanProcessor(http_exporter)provider.add_span_processor(processor)Supported RuntimesCisco OpenTelemetry Distribution supports Python 3.6+Supported LibrariesCisco OpenTelemetry Python Distribution is extending Native OpenTelemetry, supported librariesavailable here.Cisco OpenTelemetry Python Distribution provides out-of-the-box instrumentation (tracing) and advancedpayload collectionsfor many popular frameworks and libraries.LibraryExtended Support VersionrequestsFully supportedaiohttpFully supportedgrpcClient/Server Unary supportConfigurationAdvanced options can be configured as a parameter to the init() method:ParameterEnvTypeDefaultDescriptioncisco_tokenCISCO_TOKENstring-Cisco account tokenservice_nameOTEL_SERVICE_NAMEstringapplicationApplication name that will be set for tracesdebugCISCO_DEBUGstringFalseDebug logspayloads_enabledCISCO_PAYLOADS_ENABLEDstringTrueDebug logsExporter optionsParameterEnvTypeDefaultDescriptioncollector_endpointOTEL_COLLECTOR_ENDPOINTstringhttps://production.cisco-udp.com/trace-collectorThe address of the trace collector to send traces totypeOTEL_EXPORTER_TYPEstringotlp-httpThe exporter type to use (Currently onlyotlp-httpis supported). Multiple exporter option available via init function see example belowGetting HelpIf you have any issue around using the library or the product, please don't hesitate to:Use thedocumentation.Use the help widget inside the product.Open an issue in GitHub.LicenseProvided under the Apache 2.0. See LICENSE for details.Copyright 2022, Cisco