-
Notifications
You must be signed in to change notification settings - Fork 682
update process metric name #2727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
arunk1988
wants to merge
2
commits into
open-telemetry:main
from
fidelity-contributions:Feature-2662
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,12 +111,12 @@ | |
"system.network.io": ["transmit", "receive"], | ||
"system.network.connections": ["family", "type"], | ||
"system.thread_count": None, | ||
"process.runtime.memory": ["rss", "vms"], | ||
"process.runtime.cpu.time": ["user", "system"], | ||
"process.runtime.gc_count": None, | ||
"process.runtime.thread_count": None, | ||
"process.runtime.cpu.utilization": None, | ||
"process.runtime.context_switches": ["involuntary", "voluntary"], | ||
"process.memory": ["rss", "vms"], | ||
"process.cpu.time": ["user", "system"], | ||
"process.gc_count": None, | ||
"process.thread.count": None, | ||
"process.cpu.utilization": None, | ||
"process.context_switches": ["involuntary", "voluntary"], | ||
"process.open_file_descriptor.count": None, | ||
} | ||
|
||
|
@@ -164,12 +164,12 @@ def __init__( | |
|
||
self._system_thread_count_labels = self._labels.copy() | ||
|
||
self._runtime_memory_labels = self._labels.copy() | ||
self._runtime_cpu_time_labels = self._labels.copy() | ||
self._runtime_gc_count_labels = self._labels.copy() | ||
self._runtime_thread_count_labels = self._labels.copy() | ||
self._runtime_cpu_utilization_labels = self._labels.copy() | ||
self._runtime_context_switches_labels = self._labels.copy() | ||
self._process_memory_labels = self._labels.copy() | ||
self._process_cpu_time_labels = self._labels.copy() | ||
self._process_gc_count_labels = self._labels.copy() | ||
self._process_thread_count_labels = self._labels.copy() | ||
self._process_cpu_utilization_labels = self._labels.copy() | ||
self._process_context_switches_labels = self._labels.copy() | ||
self._open_file_descriptor_count_labels = self._labels.copy() | ||
|
||
def instrumentation_dependencies(self) -> Collection[str]: | ||
|
@@ -345,55 +345,55 @@ def _instrument(self, **kwargs): | |
description="System active threads count", | ||
) | ||
|
||
if "process.runtime.memory" in self._config: | ||
if "process.memory" in self._config: | ||
self._meter.create_observable_up_down_counter( | ||
name=f"process.runtime.{self._python_implementation}.memory", | ||
callbacks=[self._get_runtime_memory], | ||
description=f"Runtime {self._python_implementation} memory", | ||
name="process.memory", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have |
||
callbacks=[self._get_process_memory], | ||
description="The amount of physical memory in use", | ||
unit="bytes", | ||
) | ||
|
||
if "process.runtime.cpu.time" in self._config: | ||
if "process.cpu.time" in self._config: | ||
self._meter.create_observable_counter( | ||
name=f"process.runtime.{self._python_implementation}.cpu_time", | ||
callbacks=[self._get_runtime_cpu_time], | ||
description=f"Runtime {self._python_implementation} CPU time", | ||
name="process.cpu_time", | ||
callbacks=[self._get_process_cpu_time], | ||
description="Total CPU seconds broken down by different states", | ||
unit="seconds", | ||
) | ||
|
||
if "process.runtime.gc_count" in self._config: | ||
if "process.gc_count" in self._config: | ||
if self._python_implementation == "pypy": | ||
_logger.warning( | ||
"The process.runtime.gc_count metric won't be collected because the interpreter is PyPy" | ||
"The process.gc_count metric won't be collected because the interpreter is PyPy" | ||
) | ||
else: | ||
self._meter.create_observable_counter( | ||
name=f"process.runtime.{self._python_implementation}.gc_count", | ||
callbacks=[self._get_runtime_gc_count], | ||
description=f"Runtime {self._python_implementation} GC count", | ||
name="process.gc_count", | ||
callbacks=[self._get_process_gc_count], | ||
description="Process GC count", | ||
unit="bytes", | ||
) | ||
|
||
if "process.runtime.thread_count" in self._config: | ||
if "process.thread.count" in self._config: | ||
self._meter.create_observable_up_down_counter( | ||
name=f"process.runtime.{self._python_implementation}.thread_count", | ||
callbacks=[self._get_runtime_thread_count], | ||
description="Runtime active threads count", | ||
name="process.thread.count", | ||
callbacks=[self._get_process_thread_count], | ||
description="The number of threads currently used by the process", | ||
) | ||
|
||
if "process.runtime.cpu.utilization" in self._config: | ||
if "process.cpu.utilization" in self._config: | ||
self._meter.create_observable_gauge( | ||
name=f"process.runtime.{self._python_implementation}.cpu.utilization", | ||
callbacks=[self._get_runtime_cpu_utilization], | ||
description="Runtime CPU utilization", | ||
name="process.cpu.utilization", | ||
callbacks=[self._get_process_cpu_utilization], | ||
description="Process CPU utilization", | ||
unit="1", | ||
) | ||
|
||
if "process.runtime.context_switches" in self._config: | ||
if "process.context_switches" in self._config: | ||
self._meter.create_observable_counter( | ||
name=f"process.runtime.{self._python_implementation}.context_switches", | ||
callbacks=[self._get_runtime_context_switches], | ||
description="Runtime context switches", | ||
name="process.context_switches", | ||
callbacks=[self._get_process_context_switches], | ||
description="The number voluntary and involuntary context switches performed by the process ", | ||
unit="switches", | ||
) | ||
|
||
|
@@ -681,67 +681,67 @@ def _get_system_thread_count( | |
threading.active_count(), self._system_thread_count_labels | ||
) | ||
|
||
def _get_runtime_memory( | ||
def _get_process_memory( | ||
self, options: CallbackOptions | ||
) -> Iterable[Observation]: | ||
"""Observer callback for runtime memory""" | ||
"""Observer callback for process memory""" | ||
proc_memory = self._proc.memory_info() | ||
for metric in self._config["process.runtime.memory"]: | ||
for metric in self._config["process.memory"]: | ||
if hasattr(proc_memory, metric): | ||
self._runtime_memory_labels["type"] = metric | ||
self._process_memory_labels["type"] = metric | ||
yield Observation( | ||
getattr(proc_memory, metric), | ||
self._runtime_memory_labels.copy(), | ||
self._process_memory_labels.copy(), | ||
) | ||
|
||
def _get_runtime_cpu_time( | ||
def _get_process_cpu_time( | ||
self, options: CallbackOptions | ||
) -> Iterable[Observation]: | ||
"""Observer callback for runtime CPU time""" | ||
proc_cpu = self._proc.cpu_times() | ||
for metric in self._config["process.runtime.cpu.time"]: | ||
for metric in self._config["process.cpu.time"]: | ||
if hasattr(proc_cpu, metric): | ||
self._runtime_cpu_time_labels["type"] = metric | ||
self._process_cpu_time_labels["type"] = metric | ||
yield Observation( | ||
getattr(proc_cpu, metric), | ||
self._runtime_cpu_time_labels.copy(), | ||
self._process_cpu_time_labels.copy(), | ||
) | ||
|
||
def _get_runtime_gc_count( | ||
def _get_process_gc_count( | ||
self, options: CallbackOptions | ||
) -> Iterable[Observation]: | ||
"""Observer callback for garbage collection""" | ||
for index, count in enumerate(gc.get_count()): | ||
self._runtime_gc_count_labels["count"] = str(index) | ||
yield Observation(count, self._runtime_gc_count_labels.copy()) | ||
self._process_gc_count_labels["count"] = str(index) | ||
yield Observation(count, self._process_gc_count_labels.copy()) | ||
|
||
def _get_runtime_thread_count( | ||
def _get_process_thread_count( | ||
self, options: CallbackOptions | ||
) -> Iterable[Observation]: | ||
"""Observer callback for runtime active thread count""" | ||
"""Observer callback for process threads count""" | ||
yield Observation( | ||
self._proc.num_threads(), self._runtime_thread_count_labels.copy() | ||
self._proc.num_threads(), self._process_thread_count_labels.copy() | ||
) | ||
|
||
def _get_runtime_cpu_utilization( | ||
def _get_process_cpu_utilization( | ||
self, options: CallbackOptions | ||
) -> Iterable[Observation]: | ||
"""Observer callback for runtime CPU utilization""" | ||
"""Observer callback for CPU utilization""" | ||
proc_cpu_percent = self._proc.cpu_percent() | ||
yield Observation( | ||
proc_cpu_percent, | ||
self._runtime_cpu_utilization_labels.copy(), | ||
self._process_cpu_utilization_labels.copy(), | ||
) | ||
|
||
def _get_runtime_context_switches( | ||
def _get_process_context_switches( | ||
self, options: CallbackOptions | ||
) -> Iterable[Observation]: | ||
"""Observer callback for runtime context switches""" | ||
"""Observer callback for context switches""" | ||
ctx_switches = self._proc.num_ctx_switches() | ||
for metric in self._config["process.runtime.context_switches"]: | ||
for metric in self._config["process.context_switches"]: | ||
if hasattr(ctx_switches, metric): | ||
self._runtime_context_switches_labels["type"] = metric | ||
self._process_context_switches_labels["type"] = metric | ||
yield Observation( | ||
getattr(ctx_switches, metric), | ||
self._runtime_context_switches_labels.copy(), | ||
self._process_context_switches_labels.copy(), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to say this looked more process.runtime but I don't see this is defined at all in the semantic conventions