Skip to content

Commit

Permalink
include feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
bourbonkk committed Jan 5, 2024
1 parent b9a303d commit 5f7bd4b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class AsyncioInstrumentor(BaseInstrumentor):
def __init__(self):
super().__init__()
self.process_duration_histogram = None
self.process_counts_counter = None
self.process_created_counter = None

self._tracer = None
self._meter = None
Expand Down Expand Up @@ -147,8 +147,8 @@ def _instrument(self, **kwargs):
description="Duration of asyncio process",
unit="s",
)
self.process_counts_counter = self._meter.create_counter(
name="asyncio.process.count",
self.process_created_counter = self._meter.create_counter(
name="asyncio.process.created",
description="Number of asyncio process",
unit="{process}",
)
Expand Down Expand Up @@ -331,7 +331,7 @@ def record_process(
"""
duration = max(default_timer() - start, 0)
self.process_duration_histogram.record(duration, attr)
self.process_counts_counter.add(1, attr)
self.process_created_counter.add(1, attr)

if span:
if span.is_recording() and exception:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
from typing import Set

# pylint: disable=no-name-in-module
from opentelemetry.instrumentation.asyncio.environment_variables import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_cancel(self):
point.attributes["name"],
["cancellation_coro", "cancellable_coroutine"],
)
if metric.name == "asyncio.process.count":
if metric.name == "asyncio.process.created":
for point in metric.data.data_points:
self.assertEqual(point.attributes["type"], "coroutine")
self.assertIn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async def test():
if metric.name == "asyncio.process.duration":
for point in metric.data.data_points:
self.assertEqual(point.attributes["type"], "future")
if metric.name == "asyncio.process.count":
if metric.name == "asyncio.process.created":
for point in metric.data.data_points:
self.assertEqual(point.attributes["type"], "future")
self.assertEqual(point.attributes["state"], "finished")
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ async def to_thread():
for point in metric.data.data_points:
self.assertEqual(point.attributes["type"], "to_thread")
self.assertEqual(point.attributes["name"], "multiply")
if metric.name == "asyncio.process.count":
if metric.name == "asyncio.process.created":
for point in metric.data.data_points:
self.assertEqual(point.attributes["type"], "to_thread")
self.assertEqual(point.attributes["name"], "multiply")

0 comments on commit 5f7bd4b

Please sign in to comment.