Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenTelemetry API vs SDK

I'm confused as why OpenTelemetry documentaion has OpenTelemetry Python API and OpenTelemetry Python SDK.
Like when using the specification in python when we should consider pip install opentelemetry-api over pip install opentelemetry-sdk

like image 854
user5319825 Avatar asked May 23 '26 07:05

user5319825


1 Answers

There's no need to specify both the API and SDK dependencies in Python as the SDK has a dependency on the API:

https://github.com/open-telemetry/opentelemetry-python/blob/main/opentelemetry-sdk/pyproject.toml#L29

The short answer for when to use each is that the API should be specified as a dependency for packages/libraries and the SDK for applications.

The reason for this is that API contains the interface for instrumenting code with traces, metrics and logs. The SDK contains the additional functionality to collect, process and export that data.

For example, if I wanted to include instrumentation in a PyPI package that I've created, I would add the API as a dependency and use that to instrument my code. Then if someone were to use my PyPI package in their application, they could include the instrumentation data that my package generates. However, they would have to install the SDK in order to configure their application to do anything with that telemetry data other than simply generate it, e.g. sending it to an OpenTelemetry collector or third party.

like image 162
Sernst Avatar answered May 24 '26 19:05

Sernst



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!