-
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 ott w spec assertions for resource sdk (#560)
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from ott_lib import project_path, trace_loop | ||
|
||
if __name__ == "__main__": | ||
trace_loop(1) | ||
|
||
|
||
class SpecOtelTest: | ||
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 extract_leaves, get_attribute | ||
|
||
attributes = extract_leaves(telemetry, "trace_requests", "pbreq", "resource_spans", "resource", "attributes") | ||
|
||
assert get_attribute(attributes, "telemetry.sdk.name") | ||
assert get_attribute(attributes, "telemetry.sdk.version") | ||
assert get_attribute(attributes, "telemetry.sdk.language") | ||
|
||
def is_http(self): | ||
return False |