-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add assertion for sys metrics * Lint * Move system metrics to its own oteltest * Lint * Revert changes to ott spec file * Add oteltests of system metrics instrumentor. Remove support for OTEL_METRICS_ENABLED 1.x env var. * Lint
- Loading branch information
Showing
4 changed files
with
75 additions
and
32 deletions.
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
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
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from ott_lib import project_path, trace_loop | ||
|
||
if __name__ == "__main__": | ||
trace_loop(1) | ||
|
||
|
||
class SysMetricsOtelTest: | ||
def requirements(self): | ||
return (project_path(),) | ||
|
||
def environment_variables(self): | ||
return { | ||
"OTEL_SERVICE_NAME": "my-svc", | ||
"OTEL_PYTHON_DISABLED_INSTRUMENTATIONS": "system_metrics", | ||
} | ||
|
||
def wrapper_command(self): | ||
return "opentelemetry-instrument" | ||
|
||
def on_start(self): | ||
return None | ||
|
||
def on_stop(self, telemetry, stdout: str, stderr: str, returncode: int) -> None: | ||
from oteltest.telemetry import get_metric_names | ||
|
||
assert "system.cpu.time" not in get_metric_names(telemetry) | ||
|
||
def is_http(self): | ||
return False |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from ott_lib import project_path, trace_loop | ||
|
||
if __name__ == "__main__": | ||
trace_loop(1) | ||
|
||
|
||
class SysMetricsOtelTest: | ||
def requirements(self): | ||
return (project_path(),) | ||
|
||
def environment_variables(self): | ||
return { | ||
"OTEL_SERVICE_NAME": "my-svc", | ||
} | ||
|
||
def wrapper_command(self): | ||
return "opentelemetry-instrument" | ||
|
||
def on_start(self): | ||
return None | ||
|
||
def on_stop(self, telemetry, stdout: str, stderr: str, returncode: int) -> None: | ||
from oteltest.telemetry import get_metric_names | ||
|
||
assert "system.cpu.time" in get_metric_names(telemetry) | ||
|
||
def is_http(self): | ||
return False |