Skip to content

Commit cec0ec6

Browse files
author
Phillip Kuznetsov
authored
Update OTel plugin tutorial to include px.plugin.end_time (#200)
Signed-off-by: Phillip Kuznetsov <pkuznetsov@pixielabs.ai>
1 parent a8632f8 commit cec0ec6

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

content/en/04-tutorials/03-integrations/03-otel.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ PxL scripts are used to query telemetry data collected by the Pixie Platform. Ou
4646
```python:numbers
4747
import px
4848
# Read in the http_events table
49-
df = px.DataFrame(table='http_events', start_time='-10s')
49+
df = px.DataFrame(table='http_events', start_time='-10s', end_time=px.now())
5050
5151
# Attach the pod and service metadata
5252
df.pod = df.ctx['pod']
@@ -113,7 +113,7 @@ The first part of the PxL script (lines 1-19) read in the `http_events` data and
113113
import px
114114

115115
# Read in the http_events table
116-
df = px.DataFrame(table='http_events', start_time='-10s')
116+
df = px.DataFrame(table='http_events', start_time='-10s', end_time=px.now())
117117

118118
# Attach the pod and service metadata
119119
df.pod = df.ctx['pod']
@@ -225,7 +225,7 @@ Now that we have a PxL script that exports OTel data, let's set up the [Plugin S
225225
```python
226226
import px
227227
# Read in the http_events table
228-
df = px.DataFrame(table='http_events', start_time=px.plugin.start_time)
228+
df = px.DataFrame(table='http_events', start_time=px.plugin.start_time, end_time=px.plugin.end_time)
229229

230230
# Attach the pod and service metadata
231231
df.pod = df.ctx['pod']
@@ -236,7 +236,7 @@ df = df.groupby(['pod', 'service', 'req_path']).agg(
236236
time_=('time_', px.max),
237237
)
238238

239-
# Change the denominator if you change start_time above.
239+
# Change the denominator if you change summary window size away from 10s.
240240
df.requests_per_s = df.throughput / 10
241241

242242
px.export(df, px.otel.Data(
@@ -261,9 +261,9 @@ px.export(df, px.otel.Data(
261261

262262
> This is the script we developed in [Step 2](/tutorials/integrations/otel/#write-the-pxl-script) with a few modifications:
263263
264-
> - We changed the DataFrame's `start_time` argument to use `px.plugin.start_time`. This value can be configured using the `Summary Window` field on this page.
264+
> - We changed the DataFrame's `start_time` and `end_time` arguments to use `px.plugin.start_time` and `px.plugin.end_time`. These are set whenever the plugin executes the script. The size of this window sample can be configured using the `Summary Window` field on this page.
265265
266-
> - We removed the `Endpoint` parameter. We configured the plugin with this value in Step 3.
266+
> - We removed the `Endpoint` parameter. The plugin sets this value from what We configured in Step 3.
267267
268268
> - We removed the `px.display()` call on the last line. This was used to display the data in the Live UI when developing our script in the Scratch Pad.
269269

0 commit comments

Comments
 (0)