-
Notifications
You must be signed in to change notification settings - Fork 10
[docs] Prepare minimal viable docs #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bcb89f0
initial draft
colleenmcginnis 5973733
address feedback
colleenmcginnis baee8a7
address more feedback
colleenmcginnis 79b1ed8
Update docs/configure.md
xrmx 19a88fa
Update docs/get-started.md
xrmx 03d2c98
Merge branch 'main' into prep-docs
xrmx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<!-- | ||
Goal of this doc: | ||
Provide a complete reference of all available configuration options and where/how they can be set. | ||
Any Elastic-specific configuration options are listed directly. | ||
General OpenTelemetry configuration options are linked. | ||
--> | ||
|
||
# Configuration | ||
|
||
Configure the Elastic Distribution of OpenTelemetry Python (EDOT Python) to send data to Elastic. | ||
|
||
<!-- How users set configuration options --> | ||
## Configuration method | ||
|
||
<!-- Is this the right link to OpenTelemetry docs? --> | ||
Configuration of the OpenTelemetry SDK should be performed through the mechanisms [documented on the OpenTelemetry website](https://opentelemetry.io/docs/zero-code/python/configuration/). EDOT Python is typically configured with `OTEL_*` environment variables defined by the OpenTelemetry spec. For example: | ||
|
||
<!-- Would this example work? --> | ||
xrmx marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
```sh | ||
export OTEL_RESOURCE_ATTRIBUTES=service.name=<app-name> | ||
export OTEL_EXPORTER_OTLP_ENDPOINT=https://my-deployment.apm.us-west1.gcp.cloud.es.io | ||
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer P....l" | ||
opentelemetry-instrument <command to start your service> | ||
``` | ||
|
||
<!-- List all available configuration options --> | ||
## Configuration options | ||
|
||
<!-- Is the distro an extension of the OTel Python SDK? The agent? Or neither? --> | ||
Because the Elastic Distribution of OpenTelemetry Python is an extension of the OpenTelemetry Python SDK, it supports: | ||
colleenmcginnis marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
* [OpenTelemetry configuration options](#opentelemetry-configuration-options) | ||
* [Configuration options that are _only_ available in EDOT Python](#configuration-options-that-are-only-available-in-edot-python) | ||
|
||
### OpenTelemetry configuration options | ||
|
||
EDOT Python supports all configuration options listed in the [OpenTelemetry General SDK Configuration documentation](https://opentelemetry.io/docs/languages/sdk-configuration/general/) and [OpenTelemetry Python SDK](https://opentelemetry.io/docs/languages/python). | ||
|
||
<!-- Is this true? Or did you list these in the README for some other reason? --> | ||
EDOT Python uses different defaults than the OpenTelemetry Python SDK for the following configuration options: | ||
|
||
| Option | EDOT Python default | OpenTelemetry Python agent default | | ||
|---|---|---| | ||
| `OTEL_TRACES_EXPORTER` | `otlp` | ?? ([docs](#)) | | ||
| `OTEL_METRICS_EXPORTER` | `otlp` | ?? ([docs](#)) | | ||
| `OTEL_EXPORTER_OTLP_PROTOCOL` | `grpc` | ?? ([docs](#)) | | ||
colleenmcginnis marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| `OTEL_EXPERIMENTAL_RESOURCE_DETECTORS` | `process_runtime,otel,telemetry_distro` | ?? ([docs](#)) | | ||
colleenmcginnis marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
|
||
### Configuration options that are _only_ available in EDOT Python | ||
|
||
In addition to general OpenTelemetry configuration options, there are two kinds of configuration options that are _only_ available in EDOT Python. | ||
|
||
<!-- This is true for the Java distro, is it also true of the Python distro? --> | ||
**Elastic-authored options that are not yet available upstream** | ||
|
||
Additional `OTEL_` options that Elastic plans to contribute upstream to the OpenTelemetry Python SDK, but are not yet available in the OpenTelemetry Python SDK. | ||
|
||
_Currently there are no additional `OTEL_` options waiting to be contributed upstream._ | ||
colleenmcginnis marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
**Elastic-specific options** | ||
|
||
`ELASTIC_OTEL_` options that are specific to Elastic and will always live in EDOT Python (in other words, they will _not_ be added upstream): | ||
|
||
| Option(s) | Default | Description | | ||
|---|---|---| | ||
| `ELASTIC_OTEL_SYSTEM_METRICS_ENABLED` | `false` | When sets to `true`, sends *system namespace* metrics. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
<!-- | ||
Goal of this doc: | ||
The user is able to successfully see data from their Python application | ||
make it to the Elastic UI via EDOT Python | ||
--> | ||
|
||
# Get started | ||
|
||
This guide shows you how to use the Elastic Distribution of OpenTelemetry Python (EDOT Python) to instrument your Python application and send OpenTelemetry data to an Elastic Observability deployment. | ||
|
||
**Already familiar with OpenTelemetry?** It's an explicit goal of this distribution to introduce _no new concepts_ outside those defined by the wider OpenTelemetry community. | ||
|
||
**New to OpenTelemetry?** This section will guide you through the _minimal_ configuration options to get EDOT Python set up in your application. You do _not_ need any existing experience with OpenTelemetry to set up EDOT Python initially. If you need more control over your configuration after getting set up, you can learn more in the [OpenTelemetry documentation](https://opentelemetry.io/docs/zero-code/python/agent/). | ||
|
||
<!-- What the user needs to know and/or do before they install EDOT Python --> | ||
<!-- Is this missing anything? --> | ||
colleenmcginnis marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
## Prerequisites | ||
|
||
Before getting started, you'll need somewhere to send the gathered OpenTelemetry data, so it can be viewed and analyzed. EDOT Python supports sending data to any OpenTelemetry protocol (OTLP) endpoint, but this guide assumes you are sending data to an [Elastic Observability](https://www.elastic.co/observability) cloud deployment. You can use an existing one or set up a new one. | ||
|
||
<details> | ||
<summary><strong>Expand for setup instructions</strong></summary> | ||
|
||
To create your first Elastic Observability deployment: | ||
|
||
1. Sign up for a [free Elastic Cloud trial](https://cloud.elastic.co/registration) or sign into an existing account. | ||
1. Go to <https://cloud.elastic.co/home>. | ||
1. Click **Create deployment**. | ||
1. When the deployment is ready, click **Open** to visit your Kibana home page (for example, `https://{DEPLOYMENT_NAME}.kb.{REGION}.cloud.es.io/app/home#/getting_started`). | ||
</details> | ||
|
||
<!-- ✅ How to install EDOT Python --> | ||
## Install | ||
|
||
### Install the distribution | ||
|
||
Install EDOT Python: | ||
|
||
```bash | ||
pip install elastic-opentelemetry | ||
``` | ||
|
||
### Install the available instrumentation | ||
|
||
EDOT Python does not install any instrumentation package by default, instead it relies on the | ||
`opentelemetry-bootstrap` command to scan the installed packages and install the available instrumentation. | ||
The following command will install all the instrumentations available for libraries found installed | ||
in your environment: | ||
|
||
```bash | ||
opentelemetry-bootstrap --action=install | ||
``` | ||
|
||
> [!NOTE] | ||
> Add this command every time you deploy an updated version of your application (in other words, add it to your container image build process). | ||
<!-- ✅ Start-to-finish operation --> | ||
## Send data to Elastic | ||
|
||
After installing EDOT Python, configure and initialize it to start sending data to Elastic. | ||
|
||
<!-- ✅ Provide _minimal_ configuration/setup --> | ||
### Configure EDOT Python | ||
|
||
To configure EDOT Python, at a minimum you'll need your Elastic Observability cloud deployment's OTLP endpoint and | ||
authorization data to set a few `OTLP_*` environment variables that will be available when running EDOT Python: | ||
|
||
* `OTEL_RESOURCE_ATTRIBUTES`: Use this to add a service name that will make it easier to recognize your application when reviewing data sent to Elastic. | ||
* `OTEL_EXPORTER_OTLP_ENDPOINT`: The full URL of the endpoint where data will be sent. | ||
* `OTEL_EXPORTER_OTLP_HEADERS`: A comma-separated list of `key=value` pairs that will | ||
be added to the headers of every request. This is typically used for authentication information. | ||
|
||
<!-- | ||
These are the instructions used in other distro docs, but in the README in this repo | ||
it looks like you might be recommending using an API key rather than using the secret | ||
token method used in the setup guides in Kibana. | ||
xrmx marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
--> | ||
xrmx marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
You can find the values of the endpoint and header variables in Kibana's APM tutorial. In Kibana: | ||
|
||
1. Go to **Setup guides**. | ||
1. Select **Observability**. | ||
1. Select **Monitor my application performance**. | ||
1. Scroll down and select the **OpenTelemetry** option. | ||
1. The appropriate values for `OTEL_EXPORTER_OTLP_ENDPOINT` and `OTEL_EXPORTER_OTLP_HEADERS` are shown there. | ||
|
||
Here's an example: | ||
|
||
```sh | ||
export OTEL_RESOURCE_ATTRIBUTES=service.name=<app-name> | ||
export OTEL_EXPORTER_OTLP_ENDPOINT=https://my-deployment.apm.us-west1.gcp.cloud.es.io | ||
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer P....l" | ||
``` | ||
|
||
### Run EDOT Python | ||
|
||
Then wrap your service invocation with `opentelemetry-instrument`, which is the wrapper that provides _automatic instrumentation_: | ||
|
||
```bash | ||
opentelemetry-instrument <command to start your service> | ||
``` | ||
|
||
For example, a web service running with gunicorn may look like this: | ||
|
||
```bash | ||
opentelemetry-instrument gunicorn main:app | ||
``` | ||
|
||
<!-- ✅ What success looks like --> | ||
## Confirm that EDOT Python is working | ||
|
||
To confirm that EDOT Python has successfully connected to Elastic: | ||
|
||
1. Go to **APM** → **Traces**. | ||
1. You should see the name of the service to which you just added EDOT Python. It can take several minutes after initializing EDOT Python for the service to show up in this list. | ||
1. Click on the name in the list to see trace data. | ||
|
||
<!-- Is this true for the Python distro? --> | ||
colleenmcginnis marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
> [!NOTE] | ||
> There may be no trace data to visualize unless you have _used_ your application since initializing EDOT Python. | ||
<!-- ✅ What they should do next --> | ||
## Next steps | ||
|
||
* Reference all available [configuration options](./configure.md). | ||
* Learn more about viewing and interpreting data in the [Observability guide](https://www.elastic.co/guide/en/observability/current/apm.html). |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.