Skip to content

Commit dd20c24

Browse files
authored
Update README.md
wording
1 parent fe14bcd commit dd20c24

File tree

1 file changed

+45
-66
lines changed

1 file changed

+45
-66
lines changed

README.md

Lines changed: 45 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
Disclaimer: This SDK is currently in EAP and still work in progress.
22

3-
> Read the latest version of this README, with working internal links, at
4-
[GitHub](https://github.com/Dynatrace/OneAgent-SDK-for-Python#readme).
3+
> Read the latest version of this README, with working internal links, at [GitHub](https://github.com/Dynatrace/OneAgent-SDK-for-Python#readme).
54
65
# Dynatrace OneAgent SDK for Python
76

8-
This SDK enables Dynatrace customers to extend request level visibility into
9-
Python applications. It provides the Python implementation of the [Dynatrace OneAgent
10-
SDK](https://github.com/Dynatrace/OneAgent-SDK).
7+
This SDK enables Dynatrace customers to extend request level visibility into Python applications. It provides the Python implementation of the [Dynatrace OneAgent SDK](https://github.com/Dynatrace/OneAgent-SDK).
118

129
<!-- Generate with https://github.com/jonschlinkert/markdown-toc -->
1310

@@ -35,13 +32,11 @@ SDK](https://github.com/Dynatrace/OneAgent-SDK).
3532
<a name="requirements"></a>
3633
## Requirements
3734

38-
The SDK supports Python 2 ≥ 2.7 and Python 3 ≥ 3.4. Only the official CPython
39-
(that is, the "normal" Python, i.e. the Python implementation from
40-
<https://python.org>) is supported.
35+
The SDK supports Python 2 ≥ 2.7 and Python 3 ≥ 3.4. Only the official CPython (that is, the "normal" Python, i.e. the Python implementation from <https://python.org>) is supported.
4136

42-
The Dynatrace OneAgent SDK for Python is a wrapper of the [Dynatrace OneAgent SDK for C/C++](https://github.com/Dynatrace/OneAgent-SDK-for-C) and therefore the SDK for C/C++ is required and included into the Python SDK. See [here](https://github.com/Dynatrace/OneAgent-SDK-for-C#dynatrace-oneagent-sdk-for-cc-requirements) for its requirements, which also apply to the SDK for Python.
37+
The Dynatrace OneAgent SDK for Python is a wrapper of the [Dynatrace OneAgent SDK for C/C++](https://github.com/Dynatrace/OneAgent-SDK-for-C) and therefore the SDK for C/C++ is required and delivered with the Python SDK. See [here](https://github.com/Dynatrace/OneAgent-SDK-for-C#dynatrace-oneagent-sdk-for-cc-requirements) for its requirements, which also apply to the SDK for Python.
4338

44-
The version of the SDK for C/C++ that is included in each version of the SDK for Python is shown in the following table. The SDK for C/C++'s requirement for the Dynatrace OneAgent is also shown here, for your convenience (it is the same as [listed in the OneAgent SDK for C/C++'s documentation](https://github.com/Dynatrace/OneAgent-SDK-for-C/blob/master/README.md#compatibility-of-dynatrace-oneagent-sdk-for-cc-releases-with-oneagent-releases)).
39+
The version of the SDK for C/C++ that is included in each version of the SDK for Python is shown in the following table. required Dynatrace OneAgent version is also shown here (it is the same as [listed in the OneAgent SDK for C/C++'s documentation](https://github.com/Dynatrace/OneAgent-SDK-for-C/blob/master/README.md#compatibility-of-dynatrace-oneagent-sdk-for-cc-releases-with-oneagent-releases)).
4540

4641
|OneAgent SDK for Python|OneAgent SDK for C/C++|Dynatrace OneAgent|
4742
|:----------------------|:---------------------|:-----------------|
@@ -65,13 +60,16 @@ To verify your installation, execute
6560
python -c "import oneagent; print(oneagent.try_init())"
6661
```
6762

68-
If everything worked, you should get some output ending with
69-
`InitResult(status=0, error=None)`. Otherwise, see
70-
[Troubleshooting](#troubleshooting).
63+
If the installation was successful, you should get an output ending with `InitResult(status=0, error=None)`. Otherwise, see the [Troubleshooting](#troubleshooting) section.
7164

72-
You then need to load the SDK into the application and add code that traces your
73-
application using the SDK. For a quick “Hello World” that should give you a Path
74-
in the Dynatrace UI, try this:
65+
To load the OneAgent SDK into your application, just add the following lines of code at the top of your script:
66+
67+
```python
68+
import oneagent
69+
from oneagent.sdk import SDK
70+
```
71+
72+
Here is a quick "Hello World" that will produce a service call in Dynatrace:
7573

7674
```python
7775
import oneagent
@@ -88,16 +86,18 @@ input('Please wait...')
8886
oneagent.shutdown()
8987
```
9088

91-
A more detailed [sample application](https://github.com/Dynatrace/OneAgent-SDK-for-Python/blob/master/samples/basic-sdk-sample/basic_sdk_sample.py) is available. See also Quickstart section in the [API documentation](https://dynatrace.github.io/OneAgent-SDK-for-Python/docs/quickstart.html).
89+
A more detailed [sample application is available here](https://github.com/Dynatrace/OneAgent-SDK-for-Python/blob/master/samples/basic-sdk-sample/basic_sdk_sample.py). See also the Quickstart section in the [API documentation](https://dynatrace.github.io/OneAgent-SDK-for-Python/docs/quickstart.html).
9290

9391

9492
<a name="api-concepts"></a>
9593
## API Concepts
9694

95+
Common concepts of the Dynatrace OneAgent SDK are explained the [Dynatrace OneAgent SDK repository](https://github.com/Dynatrace/OneAgent-SDK#apiconcepts).
96+
9797
<a name="initialization-and-sdk-objects"></a>
9898
### Initialization and SDK objects
9999

100-
Before first using any other SDK functions, you should initialize the SDK.
100+
Before first using any other SDK functions, you need to initialize the SDK.
101101

102102
```python
103103
init_result = oneagent.try_init()
@@ -108,22 +108,13 @@ if not init_result:
108108
print('SDK will definitely not work (i.e. functions will be no-ops).')
109109
```
110110

111-
See the documentation for the [`try_init`
112-
function](https://dynatrace.github.io/OneAgent-SDK-for-Python/docs/sdkref.html#oneagent.try_init)
113-
and the [`InitResult`
114-
class](https://dynatrace.github.io/OneAgent-SDK-for-Python/docs/sdkref.html#oneagent.InitResult)
115-
for more information.
111+
See the API documentation for the [`try_init` function](https://dynatrace.github.io/OneAgent-SDK-for-Python/docs/sdkref.html#oneagent.try_init) and the [`InitResult` class](https://dynatrace.github.io/OneAgent-SDK-for-Python/docs/sdkref.html#oneagent.InitResult) for more information.
116112

117-
To then use the SDK, get a reference to the
118-
[`SDK`](https://dynatrace.github.io/OneAgent-SDK-for-Python/docs/sdkref.html#oneagent.sdk.SDK)
119-
singleton by calling its static
120-
[`get`](https://dynatrace.github.io/OneAgent-SDK-for-Python/docs/sdkref.html#oneagent.sdk.SDK.get)
121-
static method. The first thing you may want to do with this object, is checking
122-
if the agent is active by comparing the value of the
113+
To use the SDK, get a reference to the [`SDK`](https://dynatrace.github.io/OneAgent-SDK-for-Python/docs/sdkref.html#oneagent.sdk.SDK)
114+
singleton by calling its static [`get`](https://dynatrace.github.io/OneAgent-SDK-for-Python/docs/sdkref.html#oneagent.sdk.SDK.get)
115+
static method. The first thing you may want to do with this object, is checking if the agent is active by comparing the value of the
123116
[`agent_state`](https://dynatrace.github.io/OneAgent-SDK-for-Python/docs/sdkref.html#oneagent.sdk.SDK.agent_state)
124-
property to the
125-
[`oneagent.common.AgentState`](https://dynatrace.github.io/OneAgent-SDK-for-Python/docs/sdkref.html#oneagent.common.AgentState)
126-
constants.
117+
property to the [`oneagent.common.AgentState`](https://dynatrace.github.io/OneAgent-SDK-for-Python/docs/sdkref.html#oneagent.common.AgentState) constants.
127118

128119
```python
129120
import oneagent.sdk
@@ -173,18 +164,22 @@ strings. Byte strings must always use the UTF-8 encoding!
173164
<a name="features-and-how-to-use-them"></a>
174165
## Features and how to use them
175166

167+
The feature sets differ slightly with each language implementation. More functionality will be added over time, see <a href="https://answers.dynatrace.com/spaces/483/dynatrace-product-ideas/idea/198106/planned-features-for-oneagent-sdk.html" target="_blank">Planned features for OneAgent SDK</a> for details on upcoming features.
168+
169+
A more detailed specification of the features can be found in [Dynatrace OneAgent SDK](https://github.com/Dynatrace/OneAgent-SDK#features).
170+
171+
|Feature|Required OneAgent SDK for Python version|
172+
|:------|:--------|
173+
|Trace incoming and outgoing remote calls |>=1.0.0 |
174+
|SQL database requests |>=1.0.0 |
175+
|Incoming web requests |>=1.0.0 |
176+
176177
<a name="remote-calls"></a>
177178
### Remote calls
178179

179-
You can use the SDK to trace communication from one process to another. This
180-
will enable you to see full Service Flow, PurePath and Smartscape topology for
181-
remoting technologies that Dynatrace is not aware of.
180+
You can use the SDK to trace communication from one process to another. This will enable you to see full Service Flow, PurePath and Smartscape topology for remoting technologies that Dynatrace is not aware of.
182181

183-
To trace any kind of remote call you first need to create a Tracer. The Tracer
184-
object represents the endpoint that you want to call, thus you need to supply
185-
the name of the remote service and method. In addition, you need to transport
186-
a tag in your remote call from the client side to the server side if you want
187-
to trace it end to end.
182+
To trace any kind of remote call you first need to create a Tracer. The Tracer object represents the endpoint that you want to call, thus you need to supply the name of the remote service and method. In addition, you need to transport a tag in your remote call from the client side to the server side if you want to trace it end to end.
188183

189184
On the client side, you would trace the outgoing remote call like this:
190185

@@ -221,10 +216,7 @@ See the documentation for more information:
221216
<a name="sql-database-requests"></a>
222217
### SQL database requests
223218

224-
To trace database requests you need a database info object which stores the
225-
information about your database which does not change between individual
226-
requests. This will typically be created somewhere in your initialization code
227-
(after initializing the SDK):
219+
To trace database requests you need a database info object which stores the information about your database which does not change between individual requests. This will typically be created somewhere in your initialization code (after initializing the SDK):
228220

229221
```python
230222

@@ -242,8 +234,7 @@ with sdk.trace_sql_database_request(dbinfo, 'SELECT foo FROM bar;') as tracer:
242234
tracer.set_round_trip_count(3) # Optional
243235
```
244236

245-
Note that you need to release the database info object. You can do this by
246-
calling `close()` on it or using it in a `with` block.
237+
Note that you need to release the database info object. You can do this by calling `close()` on it or using it in a `with` block.
247238

248239
See the documentation for more information:
249240

@@ -254,9 +245,7 @@ See the documentation for more information:
254245
<a name="incoming-web-requests"></a>
255246
### Incoming web requests
256247

257-
[Like for database infos](#sql-database-requests), to trace incoming web
258-
requests you need a web application info object which stores the information
259-
about your web application which does not change:
248+
[Like for database infos](#sql-database-requests), to trace incoming web requests you need a web application info object which stores the information about your web application which does not change:
260249

261250
```python
262251
wappinfo = sdk.create_web_application_info(
@@ -283,24 +272,20 @@ with wreq:
283272
wreq.set_status_code(200) # OK
284273
```
285274

286-
Note that you need to release the web application info object. You can do this
287-
by calling `close()` on it or using it in a `with` block.
275+
Note that you need to release the web application info object. You can do this by calling `close()` on it or using it in a `with` block.
288276

289-
Incoming web request tracers support some more features not shown here. Be sure
290-
to check out the documentation:
277+
Incoming web request tracers support some more features not shown here. Be sure to check out the documentation:
291278

292279
* [`create_web_application_info`](https://dynatrace.github.io/OneAgent-SDK-for-Python/docs/sdkref.html#oneagent.sdk.SDK.create_web_application_info)
293280
* [`trace_incoming_web_request`](https://dynatrace.github.io/OneAgent-SDK-for-Python/docs/sdkref.html#oneagent.sdk.SDK.trace_incoming_web_request)
294281
* [`IncomingWebRequestTracer`](https://dynatrace.github.io/OneAgent-SDK-for-Python/docs/sdkref.html#oneagent.sdk.tracers.IncomingWebRequestTracer)
295282

296-
There is currently no explicit support for tracing outgoing web requests. You
297-
can use an [outgoing remote call tracer](#remote-calls) instead.
283+
There is currently no explicit support for tracing outgoing web requests. You can use an [outgoing remote call tracer](#remote-calls) instead.
298284

299285
<a name="troubleshooting"></a>
300286
## Troubleshooting
301287

302-
To debug your OneAgent SDK for Python installation, execute the following
303-
Python code:
288+
To debug your OneAgent SDK for Python installation, execute the following Python code:
304289

305290
```python
306291
import oneagent
@@ -309,19 +294,13 @@ init_result = oneagent.try_init(['loglevelsdk=finest', 'loglevel=finest'])
309294
print('InitResult=' + repr(init_result))
310295
```
311296

312-
If you get output containing `InitResult=InitResult(status=0, error=None)`, your
313-
installation should be fine.
314-
315-
Otherwise, hopefully the output is helpful in determining the issue.
297+
If you get output containing `InitResult=InitResult(status=0, error=None)`, your installation should be fine. Otherwise, the output is helpful in determining the issue.
316298

317299
Known gotchas:
318300

319-
* `ImportError` or `ModuleNotFoundError` in line 1 that says that there is no
320-
module named `oneagent`.
301+
* `ImportError` or `ModuleNotFoundError` in line 1 that says that there is no module named `oneagent`.
321302

322-
Make sure that the `pip install` or equivalent succeeded (see
323-
[here](#installation)). Also make sure you use the `pip` corresponding to your
324-
`python` (if in doubt, use `python -m pip` instead of `pip` for installing).
303+
Make sure that the `pip install` or equivalent succeeded (see [here](#installation)). Also make sure you use the `pip` corresponding to your `python` (if in doubt, use `python -m pip` instead of `pip` for installing).
325304

326305
<a name="repository-contents"></a>
327306
## Repository contents

0 commit comments

Comments
 (0)