8000 appinsights ref comment fixes · ToucanToco/botbuilder-python@af681bc · GitHub
[go: up one dir, main page]

Skip to content

Commit af681bc

Browse files
author
Emily Olshefski
committed
appinsights ref comment fixes
1 parent 3519739 commit af681bc

File tree

3 files changed

+64
-19
lines changed

3 files changed

+64
-19
lines changed

libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/application_insights_telemetry_client.py

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,19 @@ def track_pageview(
6868
) -> None:
6969
"""
7070
Send information about the page viewed in the application (a web page for instance).
71+
7172
:param name: the name of the page that was viewed.
73+
:type name: str
7274
:param url: the URL of the page that was viewed.
75+
:type url: str
7376
:param duration: the duration of the page view in milliseconds. (defaults to: 0)
77+
:duration: int
7478
:param properties: the set of custom properties the client wants attached to this data item.
7579
(defaults to: None)
80+
:type properties: :class:`typing.Dict[str, object]`
7681
:param measurements: the set of custom measurements the client wants to attach to this data item.
7782
(defaults to: None)
83+
:type measurements: :class:`typing.Dict[str, object]`
7884
"""
7985
self._client.track_pageview(name, url, duration, properties, measurements)
8086

@@ -88,13 +94,16 @@ def track_exception(
8894
) -> None:
8995
"""
9096
Send information about a single exception that occurred in the application.
97+
9198
:param exception_type: the type of the exception that was thrown.
9299
:param value: the exception that the client wants to send.
93100
:param trace: the traceback information as returned by :func:`sys.exc_info`.
94101
:param properties: the set of custom properties the client wants attached to this data item.
95102
(defaults to: None)
103+
:type properties: :class:`typing.Dict[str, object]`
96104
:param measurements: the set of custom measurements the client wants to attach to this data item.
97105
(defaults to: None)
106+
:type measurements: :class:`typing.Dict[str, object]`
98107
"""
99108
self._client.track_exception(
100109
exception_type, value, trace, properties, measurements
@@ -108,11 +117,15 @@ def track_event(
108117
) -> None:
109118
"""
110119
Send information about a single event that has occurred in the context of the application.
120+
111121
:param name: the data to associate to this event.
122+
:type name: str
112123
:param properties: the set of custom properties the client wants attached to this data item.
113124
(defaults to: None)
125+
:type properties: :class:`typing.Dict[str, object]`
114126
:param measurements: the set of custom measurements the client wants to attach to this data item.
115127
(defaults to: None)
128+
:type measurements: :class:`typing.Dict[str, object]`
116129
"""
117130
self._client.track_event(name, properties=properties, measurements=measurements)
118131

@@ -129,19 +142,27 @@ def track_metric(
129142
) -> NotImplemented:
130143
"""
131144
Send information about a single metric data point that was captured for the application.
145+
132146
:param name: The name of the metric that was captured.
147+
:type name: str
133148
:param value: The value of the metric that was captured.
149+
:type value: float
134150
:param tel_type: The type of the metric. (defaults to: TelemetryDataPointType.aggregation`)
135151
:param count: the number of metrics that were aggregated into this data point. (defaults to: None)
152+
:type count: int
136153
:param min_val: the minimum of all metrics collected that were aggregated into this data point.
137154
(defaults to: None)
155+
:type min_val: float
138156
:param max_val: the maximum of all metrics collected that were aggregated into this data point.
139157
(defaults to: None)
158+
:type max_val: float
140159
:param std_dev: the standard deviation of all metrics collected that were aggregated into this data point.
141160
(defaults to: None)
161+
:type std_dev: float
142162
:param properties: the set of custom properties the client wants attached to this data item.
143163
(defaults to: None)
144-
"""
164+
:type properties: :class:`typing.Dict[str, object]`
165+
"""
145166
self._client.track_metric(
146167
name, value, tel_type, count, min_val, max_val, std_dev, properties
147168
)
@@ -151,8 +172,11 @@ def track_trace(
151172
):
152173
"""
153174
Sends a single trace statement.
175+
154176
:param name: the trace statement.
177+
:type name: str
155178
:param properties: the set of custom properties the client wants attached to this data item. (defaults to: None)
179+
:type properties: :class:`typing.Dict[str, object]`
156180
:param severity: the severity level of this trace, one of DEBUG, INFO, WARNING, ERROR, CRITICAL
157181
"""
158182
self._client.track_trace(name, properties, severity)
@@ -172,19 +196,30 @@ def track_request(
172196
):
173197
"""
174198
Sends a single request that was captured for the application.
199+
175200
:param name: The name for this request. All requests with the same name will be grouped together.
201+
:type name: str
176202
:param url: The actual URL for this request (to show in individual request instances).
203+
:type url: str
177204
:param success: True if the request ended in success, False otherwise.
205+
:type success: bool
178206
:param start_time: the start time of the request. The value should look the same as the one returned by
179207
:func:`datetime.isoformat`. (defaults to: None)
208+
:type start_time: str
180209
:param duration: the number of milliseconds that this request lasted. (defaults to: None)
210+
:type duration: int
181211
:param response_code: the response code that this request returned. (defaults to: None)
212+
:type response_code: str
182213
:param http_method: the HTTP method that triggered this request. (defaults to: None)
214+
:type http_method: str
183215
:param properties: the set of custom properties the client wants attached to this data item.
184216
(defaults to: None)
217+
:type properties: :class:`typing.Dict[str, object]`
185218
:param measurements: the set of custom measurements the client wants to attach to this data item.
186219
(defaults to: None)
220+
:type measurements: :class:`typing.Dict[str, object]`
187221
:param request_id: the id for this request. If None, a new uuid will be generated. (defaults to: None)
222+
:type request_id: str
188223
"""
189224
self._client.track_request(
190225
name,
@@ -214,25 +249,33 @@ def track_dependency(
214249
):
215250
"""
216251
Sends a single dependency telemetry that was captured for the application.
252+
217253
:param name: the name of the command initiated with this dependency call. Low cardinality value.
218254
Examples are stored procedure name and URL path template.
255+
:type name: str
219256
:param data: the command initiated by this dependency call.
257+
:type data: str
220258
Examples are SQL statement and HTTP URL with all query parameters.
221259
:param type_name: the dependency type name. Low cardinality value for logical grouping of dependencies and
222260
interpretation of other fields like commandName and resultCode. Examples are SQL, Azure table, and HTTP.
223-
(default to: None)
224-
:param target: the target site of a dependency call. Examples are server name, host address.
225261
(default to: None)
226-
:param duration: the number of milliseconds that this dependency call lasted.
227-
(defaults to: None)
228-
:param success: true if the dependency call ended in success, false otherwise.
229-
(defaults to: None)
F438 262+
:type type_name: str
263+
:param target: the target site of a dependency call. Examples are server name, host address. (default to: None)
264+
:type target: str
265+
:param duration: the number of milliseconds that this dependency call lasted. (defaults to: None)
266+
:type duration: int
267+
:param success: true if the dependency call ended in success, false otherwise. (defaults to: None)
268+
:type success: bool
230269
:param result_code: the result code of a dependency call. Examples are SQL error code and HTTP status code.
231270
(defaults to: None)
271+
:type result_code: str
232272
:param properties: the set of custom properties the client wants attached to this data item. (defaults to: None)
273+
:type properties: :class:`typing.Dict[str, object]`
233274
:param measurements: the set of custom measurements the client wants to attach to this data item.
234275
(defaults to: None)
235-
:param id: the id for this dependency call. If None, a new uuid will be generated. (defaults to: None)
276+
:type measurements: :class:`typing.Dict[str, object]`
277+
:param dependency_id: the id for this dependency call. If None, a new uuid will be generated. (defaults to: None)
278+
:type dependency_id: str
236279
"""
237280
self._client.track_dependency(
238281
name,

libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/django/bot_telemetry_middleware.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111

1212
def retrieve_bot_body():
13-
""" retrieve_bot_body
13+
"""
1414
Retrieve the POST body text from temporary cache.
15-
The POST body corresponds with the thread id and should resides in
16-
cache just for lifetime of request.
15+
16+
The POST body corresponds to the thread ID and should reside in cache just for the lifetime of a request.
1717
"""
1818

1919
result = _REQUEST_BODIES.get(current_thread().ident, None)
@@ -22,15 +22,17 @@ def retrieve_bot_body():
2222

2323
class BotTelemetryMiddleware:
2424
"""
25-
Save off the POST body to later populate bot-specific properties to
26-
add to Application Insights.
25+
Save off the POST body to later populate bot-specific properties to add to Application Insights.
2726
2827
Example activating MIDDLEWARE in Django settings:
29-
MIDDLEWARE = [
30-
# Ideally add somewhere near top
31-
'botbuilder.applicationinsights.django.BotTelemetryMiddleware',
32-
...
33-
]
28+
29+
.. code-block:: python
30+
31+
MIDDLEWARE = [
32+
# Ideally add somewhere near top
33+
'botbuilder.applicationinsights.django.BotTelemetryMiddleware',
34+
...
35+
]
3436
"""
3537

3638
def __init__(self, get_response):

libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/django/logging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class LoggingHandler(logging.LoggingHandler):
99
"""This class is a LoggingHandler that uses the same settings as the Django middleware to configure
1010
the telemetry client. This can be referenced from LOGGING in your Django settings.py file. As an
11-
example, this code would send all Django log messages--WARNING and up--to Application Insights:
11+
example, this code would send all Django log messages, WARNING and up, to Application Insights:
1212
1313
.. code:: python
1414

0 commit comments

Comments
 (0)
0