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 165e797 commit 34ee9cd
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ redirects:

## Syntax

```
```py
newrelic.agent.record_custom_event(event_type, params, application=None)
```

Expand Down Expand Up @@ -96,23 +96,23 @@ None.

Here's an example of recording a custom event associated with a background task:

```
```py
@newrelic.agent.background_task()
def bg_task():
# do some type of work in this background task...
application = newrelic.agent.application()
newrelic.agent.record_custom_event('your_event_type', {'param1':'value1'}, application)
# do some type of work in this background task...
application = newrelic.agent.application()
newrelic.agent.record_custom_event('your_event_type', {'param1':'value1'}, application)
```

### Create a killed-query custom event [#event-example]

An example of creating a killed-query custom event inside a database-logging function:

```
```PY
application = newrelic.agent.register_application(timeout=10)

def task_runner():
event_type = "Killed_Query"
params = {'query_info':'select * from all_things;', 'killed_time': '2016-05-18 00:59:00', 'host': 'my_host'}
newrelic.agent.record_custom_event(event_type, params, application=application)
event_type = "Killed_Query"
params = {'query_info':'select * from all_things;', 'killed_time': '2016-05-18 00:59:00', 'host': 'my_host'}
newrelic.agent.record_custom_event(event_type, params, application=application)
```

0 comments on commit 34ee9cd

Please sign in to comment.