9
9
10
10
| Step | Windows (PowerShell) | Linux / MacOS (bash) |
11
11
| ------| ---------------------------------------| ----------------------------------------|
12
- | 1 | ` pip install virtualenv ` |
12
+ | 1 | ` pip install virtualenv ` | ` pip3 install virtualenv ` |
13
13
| 2 | ` python -m venv venv ` | ` python3 -m venv venv ` |
14
14
| 3 | ` .\venv\Scripts\Activate.ps1 ` | ` source venv/bin/activate ` |
15
15
| 4 | ` python -m pip install --upgrade pip ` | ` python3 -m pip install --upgrade pip ` |
16
- | 5 | ` pip install -r requirements.txt ` |
16
+ | 5 | ` pip install -r requirements.txt ` | ` pip install -r requirements.txt ` |
17
17
18
18
19
19
# Running the Application
@@ -23,11 +23,11 @@ import newrelic.agent
23
23
newrelic.agent.initialize()
24
24
```
25
25
26
- | Windows (PowerShell) | Linux / MacOS (bash) |
26
+ | Windows (PowerShell) | Linux / macOS (bash) |
27
27
| ------------------------------------------------| ------------------------------------------------|
28
28
| ` $Env:NEW_RELIC_APP_NAME = "Local Python App" ` | ` export NEW_RELIC_APP_NAME="Local Python App" ` |
29
29
| ` $Env:NEW_RELIC_LICENSE_KEY = "XXXX...NRAL" ` | ` export NEW_RELIC_LICENSE_KEY="XXXX...NRAL" ` |
30
- | ` python datacrunch-consulting\ webserver.py ` | ` python3 datacrunch-consulting/ webserver.py ` |
30
+ | ` python webserver.py ` | ` python3 webserver.py ` |
31
31
32
32
33
33
# Endpoints to Test
@@ -45,10 +45,19 @@ newrelic.agent.initialize()
45
45
46
46
# OpenTelemetry
47
47
1 . To send telemetry data to New Relic, set the following environment variables
48
+
49
+ Windows (PowerShell)
50
+ ```
51
+ $Env:OTEL_EXPORTER_OTLP_ENDPOINT="https://otlp.nr-data.net:4317"
52
+ $Env:OTEL_EXPORTER_OTLP_HEADERS=api-key="XXXX...NRAL"
53
+ (optional) $Env:OTEL_RESOURCE_ATTRIBUTES=service.name="python-flask.otel,service.instance.id=localhost-pc"
54
+ ```
55
+
56
+ Linux / macOS
48
57
```
49
- OTEL_EXPORTER_OTLP_ENDPOINT=https://otlp.nr-data.net:4317
50
- OTEL_EXPORTER_OTLP_HEADERS=api-key=XXXX...NRAL
51
- OTEL_RESOURCE_ATTRIBUTES=service.name=python-flask.otel,service.instance.id=localhost-pc
58
+ export OTEL_EXPORTER_OTLP_ENDPOINT=" https://otlp.nr-data.net:4317"
59
+ export OTEL_EXPORTER_OTLP_HEADERS=api-key=" XXXX...NRAL"
60
+ (optional) export OTEL_RESOURCE_ATTRIBUTES=service.name=" python-flask.otel,service.instance.id=localhost-pc"
52
61
```
53
62
54
63
2 . Download the following packages to your virtual environment
@@ -62,7 +71,7 @@ pip install opentelemetry-distro
62
71
63
72
3 . No changes to the code is needed, just run the app as usual but with ` opentelemetry-instrument ` at the front
64
73
```
65
- opentelemetry-instrument python .\datacrunch-consulting\ webserver.py
74
+ opentelemetry-instrument python3 webserver.py
66
75
```
67
76
68
77
# Docker Image
0 commit comments