Skip to content

Commit

Permalink
chore(profiling): remove unused field, timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
taegyunkim committed Sep 30, 2024
1 parent 7e8eb0b commit 84787b0
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 53 deletions.
7 changes: 1 addition & 6 deletions ddtrace/profiling/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import typing

from ddtrace._trace import span as ddspan # noqa:F401
from ddtrace.internal import compat


_T = typing.TypeVar("_T")
Expand All @@ -14,11 +13,7 @@
class Event(object):
"""An event happening at a point in time."""

__slots__ = ("timestamp",)

def __init__(self, timestamp=compat.time_ns()):
# type: (typing.Optional[int]) -> None
self.timestamp = timestamp
__slots__ = ()

@property
def name(self):
Expand Down
3 changes: 0 additions & 3 deletions tests/profiling/collector/test_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ def test_exception_collection_threads():
)
exception_events = r.events[stack_event.StackExceptionSampleEvent]
e = exception_events[0]
assert e.timestamp > 0
assert e.sampling_period > 0
assert e.thread_id in {t.ident for t in threads}
assert isinstance(e.thread_name, str)
Expand All @@ -441,7 +440,6 @@ def test_exception_collection():
exception_events = r.events[stack_event.StackExceptionSampleEvent]
assert len(exception_events) >= 1
e = exception_events[0]
assert e.timestamp > 0
assert e.sampling_period > 0
assert e.thread_id == _thread.get_ident()
assert e.thread_name == "MainThread"
Expand Down Expand Up @@ -475,7 +473,6 @@ def test_exception_collection_trace(
pytest.fail("No exception event found")

e = exception_events[0]
assert e.timestamp > 0
assert e.sampling_period > 0
assert e.thread_id == _thread.get_ident()
assert e.thread_name == "MainThread"
Expand Down
44 changes: 0 additions & 44 deletions tests/profiling/exporter/test_pprof.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
TEST_EVENTS = {
stack_event.StackExceptionSampleEvent: [
stack_event.StackExceptionSampleEvent(
timestamp=1,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -27,7 +26,6 @@
nframes=3,
),
stack_event.StackExceptionSampleEvent(
timestamp=2,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -41,7 +39,6 @@
nframes=3,
),
stack_event.StackExceptionSampleEvent(
timestamp=3,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -55,7 +52,6 @@
nframes=4,
),
stack_event.StackExceptionSampleEvent(
timestamp=4,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -69,7 +65,6 @@
nframes=6,
),
stack_event.StackExceptionSampleEvent(
timestamp=5,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -83,7 +78,6 @@
nframes=3,
),
stack_event.StackExceptionSampleEvent(
timestamp=6,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -97,7 +91,6 @@
nframes=3,
),
stack_event.StackExceptionSampleEvent(
timestamp=7,
thread_id=67892304,
thread_native_id=123987,
local_root_span_id=1322219321,
Expand All @@ -115,7 +108,6 @@
],
memalloc.MemoryAllocSampleEvent: [
memalloc.MemoryAllocSampleEvent(
timestamp=1,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -130,7 +122,6 @@
nevents=1024,
),
memalloc.MemoryAllocSampleEvent(
timestamp=2,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -145,7 +136,6 @@
nevents=1024,
),
memalloc.MemoryAllocSampleEvent(
timestamp=3,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -160,7 +150,6 @@
nevents=1024,
),
memalloc.MemoryAllocSampleEvent(
timestamp=4,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -175,7 +164,6 @@
nevents=1024,
),
memalloc.MemoryAllocSampleEvent(
timestamp=5,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -192,7 +180,6 @@
nevents=2048,
),
memalloc.MemoryAllocSampleEvent(
timestamp=6,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -207,7 +194,6 @@
nevents=2048,
),
memalloc.MemoryAllocSampleEvent(
timestamp=7,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -224,7 +210,6 @@
],
memalloc.MemoryHeapSampleEvent: [
memalloc.MemoryHeapSampleEvent(
timestamp=1,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -238,7 +223,6 @@
sample_size=512 * 1024,
),
memalloc.MemoryHeapSampleEvent(
timestamp=2,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -252,7 +236,6 @@
sample_size=512 * 1024,
),
memalloc.MemoryHeapSampleEvent(
timestamp=3,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -266,7 +249,6 @@
sample_size=512 * 1024,
),
memalloc.MemoryHeapSampleEvent(
timestamp=4,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -280,7 +262,6 @@
sample_size=512 * 1024,
),
memalloc.MemoryHeapSampleEvent(
timestamp=5,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -295,7 +276,6 @@
sample_size=512 * 1024,
),
memalloc.MemoryHeapSampleEvent(
timestamp=6,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -309,7 +289,6 @@
sample_size=512 * 1024,
),
memalloc.MemoryHeapSampleEvent(
timestamp=7,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -325,7 +304,6 @@
],
stack_event.StackSampleEvent: [
stack_event.StackSampleEvent(
timestamp=1,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -346,7 +324,6 @@
nframes=3,
),
stack_event.StackSampleEvent(
timestamp=2,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -365,7 +342,6 @@
nframes=3,
),
stack_event.StackSampleEvent(
timestamp=3,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -382,7 +358,6 @@
nframes=4,
),
stack_event.StackSampleEvent(
timestamp=4,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -397,7 +372,6 @@
nframes=6,
),
stack_event.StackSampleEvent(
timestamp=5,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -414,7 +388,6 @@
nframes=3,
),
stack_event.StackSampleEvent(
timestamp=6,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -429,7 +402,6 @@
nframes=3,
),
stack_event.StackSampleEvent(
timestamp=7,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -447,7 +419,6 @@
_lock.LockAcquireEvent: [
_lock.LockAcquireEvent(
lock_name="foobar.py:12",
timestamp=1,
thread_id=67892304,
thread_name="MainThread",
frames=[
Expand All @@ -467,7 +438,6 @@
),
_lock.LockAcquireEvent(
lock_name="foobar.py:12",
timestamp=2,
thread_id=67892304,
thread_name="MainThread",
local_root_span_id=23435,
Expand All @@ -485,7 +455,6 @@
),
_lock.LockAcquireEvent(
lock_name="foobar.py:12",
timestamp=3,
thread_id=67892304,
thread_name="MainThread",
frames=[
Expand All @@ -499,7 +468,6 @@
),
_lock.LockAcquireEvent(
lock_name="foobar.py:12",
timestamp=4,
thread_id=67892304,
thread_name="MainThread",
frames=[
Expand All @@ -513,7 +481,6 @@
),
_lock.LockAcquireEvent(
lock_name="foobar.py:12",
timestamp=5,
thread_id=67892304,
thread_name="MainThread",
frames=[
Expand All @@ -527,7 +494,6 @@
),
_lock.LockAcquireEvent(
lock_name="foobar.py:12",
timestamp=6,
thread_id=67892304,
thread_name="MainThread",
frames=[
Expand All @@ -541,7 +507,6 @@
),
_lock.LockAcquireEvent(
lock_name="foobar.py:12",
timestamp=7,
thread_id=67892304,
thread_name="MainThread",
frames=[
Expand All @@ -557,7 +522,6 @@
_lock.LockReleaseEvent: [
_lock.LockReleaseEvent(
lock_name="foobar.py:12",
timestamp=1,
thread_id=67892304,
thread_name="MainThread",
frames=[
Expand All @@ -571,7 +535,6 @@
),
_lock.LockReleaseEvent(
lock_name="foobar.py:12",
timestamp=2,
thread_id=67892304,
thread_name="MainThread",
frames=[
Expand All @@ -585,7 +548,6 @@
),
_lock.LockReleaseEvent(
lock_name="foobar.py:12",
timestamp=3,
thread_id=67892304,
thread_name="MainThread",
frames=[
Expand All @@ -599,7 +561,6 @@
),
_lock.LockReleaseEvent(
lock_name="foobar.py:12",
timestamp=4,
thread_id=67892304,
thread_name="MainThread",
frames=[
Expand All @@ -613,7 +574,6 @@
),
_lock.LockReleaseEvent(
lock_name="foobar.py:12",
timestamp=5,
thread_id=67892304,
thread_name="MainThread",
frames=[
Expand All @@ -627,7 +587,6 @@
),
_lock.LockReleaseEvent(
lock_name="foobar.py:12",
timestamp=6,
thread_id=67892304,
thread_name="MainThread",
frames=[
Expand All @@ -641,7 +600,6 @@
),
_lock.LockReleaseEvent(
lock_name="foobar.py:12",
timestamp=7,
thread_id=67892304,
thread_name="MainThread",
frames=[
Expand Down Expand Up @@ -704,7 +662,6 @@ def test_pprof_exporter_libs(gan):
TEST_EVENTS = {
stack_event.StackSampleEvent: [
stack_event.StackSampleEvent(
timestamp=1,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand All @@ -724,7 +681,6 @@ def test_pprof_exporter_libs(gan):
nframes=3,
),
stack_event.StackSampleEvent(
timestamp=2,
thread_id=67892304,
thread_native_id=123987,
thread_name="MainThread",
Expand Down

0 comments on commit 84787b0

Please sign in to comment.