Skip to content

Commit

Permalink
chore: add language identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
brnhensley committed May 29, 2023
1 parent ea1f038 commit 7fdff6a
Showing 1 changed file with 20 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ redirects:

## Syntax

```
```py
newrelic.agent.datastore_trace(product, target, operation)
```

Expand All @@ -39,7 +39,7 @@ For an explanation of the uses of these different call formats, see [Different c

### Parameters for decorator [#main-parameters]

```
```py
newrelic.agent.datastore_trace(product, target, operation)
```

Expand Down Expand Up @@ -99,7 +99,7 @@ This call includes these parameters:

### Parameters for context manager [#context-mgr-parameters]

```
```py
newrelic.agent.DatastoreTrace(product, target, operation, host=None, port_path_or_id=None, database_name=None)
```

Expand Down Expand Up @@ -159,7 +159,7 @@ Parameters for the context manager includes all of the [parameters](#main-parame

### Wrapper parameters

```
```py
newrelic.agent.DatastoreTraceWrapper(wrapped, product, target, operation)
```

Expand Down Expand Up @@ -195,7 +195,7 @@ Parameters for the wrapper include all [parameters](#main-parameters) for `datas

### Path-based wrapping parameters [#path-wrap-parameters]

```
```py
newrelic.agent.wrap_datastore_trace(module, object_path, product, target, operation)
```

Expand Down Expand Up @@ -251,7 +251,7 @@ Parameters include all [parameters](#main-parameters) for `datastore_trace` and

An example of using the `datastore_trace` decorator:

```
```py
import newrelic.agent

class _Database(UserDict.DictMixin):
Expand All @@ -265,7 +265,7 @@ class _Database(UserDict.DictMixin):

An example of using the `datastore_trace` decorator with native coroutines:

```
```py
import newrelic.agent

class _Database(UserDict.DictMixin):
Expand All @@ -281,27 +281,29 @@ class _Database(UserDict.DictMixin):

An example of using the `DatastoreTrace` context manager: This will give timings for how long it takes to do \`custom_action\`.

```
```py
import newrelic.agent


def complex_query(a, b, c):
with Connection(host, port, db) as conn:
with newrelic.agent.DatastoreTrace(
product='Custom Product',
target=None,
operation='custom',
host=host,
port_path_or_id=port,
database_name=db):
product="Custom Product",
target=None,
operation="custom",
host=host,
port_path_or_id=port,
database_name=db,
):

conn.custom_action()
```

### Wrapper example [#trace-wrap-example]

An example of using the `DatastoreTraceWrapper`:

```
```py
import newrelic.agent

class _Database(UserDict.DictMixin):
Expand All @@ -313,5 +315,6 @@ class _Database(UserDict.DictMixin):


_Database._get = newrelic.agent.DatastoreTraceWrapper(
_Database._get, 'Redis', None, 'get')
_Database._get, "Redis", None, "get"
)
```

0 comments on commit 7fdff6a

Please sign in to comment.