Skip to content

Commit

Permalink
Add ott w spec assertions for resource sdk (#560)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmcollins authored Nov 26, 2024
1 parent 86ff420 commit 97efee8
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/ott_spec.py
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

0 comments on commit 97efee8

Please sign in to comment.