Skip to content

Commit

Permalink
update golden
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-gtokernliang committed Jan 6, 2025
1 parent 0a5668d commit 8d2cece
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
6 changes: 5 additions & 1 deletion src/core/trulens/experimental/otel_tracing/core/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,9 @@ def init(session: TruSession, debug: bool = False):

# Add the TruLens database exporter
db_exporter = TruLensDBSpanExporter(session.connector)
db_processor = BatchSpanProcessor(db_exporter)
db_processor = (
SimpleSpanProcessor(db_exporter)
if debug
else BatchSpanProcessor(db_exporter)
)
provider.add_span_processor(db_processor)
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
,record,event_id,record_attributes,record_type,resource_attributes,start_timestamp,timestamp,trace
0,"{'name': 'root', 'kind': 'SPAN_KIND_TRULENS', 'parent_span_id': '', 'status': 'STATUS_CODE_UNSET'}",2432797738845484840,"{'name': 'root', 'kind': 'SPAN_KIND_TRULENS', 'trulens.span_type': 'record_root', 'trulens.app_id': 'app_hash_baf7b2cb6402e84fa3b0b3a028d4bf65', 'trulens.record_id': '0a418857-30df-46ea-ad2b-fabe23d5586c', 'trulens.record_root.app_name': 'default_app', 'trulens.record_root.app_version': 'base', 'trulens.record_root.app_id': 'app_hash_baf7b2cb6402e84fa3b0b3a028d4bf65', 'trulens.record_root.record_id': '0a418857-30df-46ea-ad2b-fabe23d5586c'}",EventRecordType.SPAN,"{'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.29.0', 'service.name': 'trulens'}",2025-01-03 16:24:22.047832,2025-01-03 16:24:22.051431,"{'trace_id': '58108881239798836388310224737437935350', 'parent_id': '', 'span_id': '2432797738845484840'}"
1,"{'name': 'respond_to_query', 'kind': 'SPAN_KIND_TRULENS', 'parent_span_id': '2432797738845484840', 'status': 'STATUS_CODE_UNSET'}",16589007816071986692,"{'name': 'respond_to_query', 'kind': 'SPAN_KIND_TRULENS', 'trulens.span_type': 'unknown', 'trulens.app_id': 'app_hash_baf7b2cb6402e84fa3b0b3a028d4bf65', 'trulens.record_id': '0a418857-30df-46ea-ad2b-fabe23d5586c'}",EventRecordType.SPAN,"{'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.29.0', 'service.name': 'trulens'}",2025-01-03 16:24:22.047889,2025-01-03 16:24:22.050729,"{'trace_id': '58108881239798836388310224737437935350', 'parent_id': '2432797738845484840', 'span_id': '16589007816071986692'}"
2,"{'name': 'nested', 'kind': 'SPAN_KIND_TRULENS', 'parent_span_id': '16589007816071986692', 'status': 'STATUS_CODE_UNSET'}",8072709013542374350,"{'name': 'nested', 'kind': 'SPAN_KIND_TRULENS', 'trulens.span_type': 'unknown', 'trulens.app_id': 'app_hash_baf7b2cb6402e84fa3b0b3a028d4bf65', 'trulens.record_id': '0a418857-30df-46ea-ad2b-fabe23d5586c', 'trulens.unknown.nested_attr1': 'value1'}",EventRecordType.SPAN,"{'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.29.0', 'service.name': 'trulens'}",2025-01-03 16:24:22.047913,2025-01-03 16:24:22.050007,"{'trace_id': '58108881239798836388310224737437935350', 'parent_id': '16589007816071986692', 'span_id': '8072709013542374350'}"
3,"{'name': 'nested2', 'kind': 'SPAN_KIND_TRULENS', 'parent_span_id': '8072709013542374350', 'status': 'STATUS_CODE_UNSET'}",4575055756743485863,"{'name': 'nested2', 'kind': 'SPAN_KIND_TRULENS', 'trulens.span_type': 'unknown', 'trulens.app_id': 'app_hash_baf7b2cb6402e84fa3b0b3a028d4bf65', 'trulens.record_id': '0a418857-30df-46ea-ad2b-fabe23d5586c', 'trulens.unknown.nested2_ret': 'nested2: nested3', 'trulens.unknown.nested2_args[1]': 'test'}",EventRecordType.SPAN,"{'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.29.0', 'service.name': 'trulens'}",2025-01-03 16:24:22.047933,2025-01-03 16:24:22.049227,"{'trace_id': '58108881239798836388310224737437935350', 'parent_id': '8072709013542374350', 'span_id': '4575055756743485863'}"
4,"{'name': 'nested3', 'kind': 'SPAN_KIND_TRULENS', 'parent_span_id': '4575055756743485863', 'status': 'STATUS_CODE_UNSET'}",16787720027442065238,"{'name': 'nested3', 'kind': 'SPAN_KIND_TRULENS', 'trulens.span_type': 'unknown', 'trulens.app_id': 'app_hash_baf7b2cb6402e84fa3b0b3a028d4bf65', 'trulens.record_id': '0a418857-30df-46ea-ad2b-fabe23d5586c', 'trulens.unknown.nested3_ret': 'nested3', 'trulens.special.nested3_ret': 'nested3', 'trulens.unknown.selector_name': 'special', 'trulens.unknown.cows': 'moo', 'trulens.special.cows': 'moo'}",EventRecordType.SPAN,"{'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.29.0', 'service.name': 'trulens'}",2025-01-03 16:24:22.047952,2025-01-03 16:24:22.047990,"{'trace_id': '58108881239798836388310224737437935350', 'parent_id': '4575055756743485863', 'span_id': '16787720027442065238'}"
5,"{'name': 'root', 'kind': 'SPAN_KIND_TRULENS', 'parent_span_id': '', 'status': 'STATUS_CODE_UNSET'}",242567963789507041,"{'name': 'root', 'kind': 'SPAN_KIND_TRULENS', 'trulens.span_type': 'record_root', 'trulens.app_id': 'app_hash_baf7b2cb6402e84fa3b0b3a028d4bf65', 'trulens.record_id': '61f3e0ac-6bb8-4cfd-8c50-173025506f22', 'trulens.record_root.app_name': 'default_app', 'trulens.record_root.app_version': 'base', 'trulens.record_root.app_id': 'app_hash_baf7b2cb6402e84fa3b0b3a028d4bf65', 'trulens.record_root.record_id': '61f3e0ac-6bb8-4cfd-8c50-173025506f22'}",EventRecordType.SPAN,"{'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.29.0', 'service.name': 'trulens'}",2025-01-03 16:24:22.052177,2025-01-03 16:24:22.055689,"{'trace_id': '219361885883593679657924986861537632625', 'parent_id': '', 'span_id': '242567963789507041'}"
6,"{'name': 'respond_to_query', 'kind': 'SPAN_KIND_TRULENS', 'parent_span_id': '242567963789507041', 'status': 'STATUS_CODE_UNSET'}",8489630649231593679,"{'name': 'respond_to_query', 'kind': 'SPAN_KIND_TRULENS', 'trulens.span_type': 'unknown', 'trulens.app_id': 'app_hash_baf7b2cb6402e84fa3b0b3a028d4bf65', 'trulens.record_id': '61f3e0ac-6bb8-4cfd-8c50-173025506f22'}",EventRecordType.SPAN,"{'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.29.0', 'service.name': 'trulens'}",2025-01-03 16:24:22.052211,2025-01-03 16:24:22.054993,"{'trace_id': '219361885883593679657924986861537632625', 'parent_id': '242567963789507041', 'span_id': '8489630649231593679'}"
7,"{'name': 'nested', 'kind': 'SPAN_KIND_TRULENS', 'parent_span_id': '8489630649231593679', 'status': 'STATUS_CODE_UNSET'}",13898377917720400937,"{'name': 'nested', 'kind': 'SPAN_KIND_TRULENS', 'trulens.span_type': 'unknown', 'trulens.app_id': 'app_hash_baf7b2cb6402e84fa3b0b3a028d4bf65', 'trulens.record_id': '61f3e0ac-6bb8-4cfd-8c50-173025506f22', 'trulens.unknown.nested_attr1': 'value1'}",EventRecordType.SPAN,"{'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.29.0', 'service.name': 'trulens'}",2025-01-03 16:24:22.052232,2025-01-03 16:24:22.054314,"{'trace_id': '219361885883593679657924986861537632625', 'parent_id': '8489630649231593679', 'span_id': '13898377917720400937'}"
8,"{'name': 'nested2', 'kind': 'SPAN_KIND_TRULENS', 'parent_span_id': '13898377917720400937', 'status': 'STATUS_CODE_UNSET'}",15183556283066412628,"{'name': 'nested2', 'kind': 'SPAN_KIND_TRULENS', 'trulens.span_type': 'unknown', 'trulens.app_id': 'app_hash_baf7b2cb6402e84fa3b0b3a028d4bf65', 'trulens.record_id': '61f3e0ac-6bb8-4cfd-8c50-173025506f22', 'trulens.unknown.nested2_ret': 'nested2: ', 'trulens.unknown.nested2_args[1]': 'throw'}",EventRecordType.SPAN,"{'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.29.0', 'service.name': 'trulens'}",2025-01-03 16:24:22.052250,2025-01-03 16:24:22.053510,"{'trace_id': '219361885883593679657924986861537632625', 'parent_id': '13898377917720400937', 'span_id': '15183556283066412628'}"
9,"{'name': 'nested3', 'kind': 'SPAN_KIND_TRULENS', 'parent_span_id': '15183556283066412628', 'status': 'STATUS_CODE_ERROR'}",8890878408638308382,"{'name': 'nested3', 'kind': 'SPAN_KIND_TRULENS', 'trulens.span_type': 'unknown', 'trulens.app_id': 'app_hash_baf7b2cb6402e84fa3b0b3a028d4bf65', 'trulens.record_id': '61f3e0ac-6bb8-4cfd-8c50-173025506f22', 'trulens.unknown.nested3_ex': ['nested3 exception'], 'trulens.special.nested3_ex': ['nested3 exception'], 'trulens.unknown.selector_name': 'special', 'trulens.unknown.cows': 'moo', 'trulens.special.cows': 'moo'}",EventRecordType.SPAN,"{'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.29.0', 'service.name': 'trulens'}",2025-01-03 16:24:22.052266,2025-01-03 16:24:22.052646,"{'trace_id': '219361885883593679657924986861537632625', 'parent_id': '15183556283066412628', 'span_id': '8890878408638308382'}"
0,"{'name': 'root', 'kind': 'SPAN_KIND_TRULENS', 'parent_span_id': '', 'status': 'STATUS_CODE_UNSET'}",14327454352716866937,"{'name': 'root', 'kind': 'SPAN_KIND_TRULENS', 'trulens.span_type': 'record_root', 'trulens.app_id': 'app_hash_baf7b2cb6402e84fa3b0b3a028d4bf65', 'trulens.record_id': '44bfab09-d1e5-49d6-a07a-3660f96f6b28', 'trulens.record_root.app_name': 'default_app', 'trulens.record_root.app_version': 'base', 'trulens.record_root.app_id': 'app_hash_baf7b2cb6402e84fa3b0b3a028d4bf65', 'trulens.record_root.record_id': '44bfab09-d1e5-49d6-a07a-3660f96f6b28'}",EventRecordType.SPAN,"{'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.29.0', 'service.name': 'trulens'}",2025-01-06 10:35:06.964675,2025-01-06 10:35:06.968732,"{'trace_id': '144282703647043990575107655191646646862', 'parent_id': '', 'span_id': '14327454352716866937'}"
1,"{'name': 'respond_to_query', 'kind': 'SPAN_KIND_TRULENS', 'parent_span_id': '14327454352716866937', 'status': 'STATUS_CODE_UNSET'}",17674944483240759796,"{'name': 'respond_to_query', 'kind': 'SPAN_KIND_TRULENS', 'trulens.span_type': 'main', 'trulens.app_id': 'app_hash_baf7b2cb6402e84fa3b0b3a028d4bf65', 'trulens.record_id': '44bfab09-d1e5-49d6-a07a-3660f96f6b28', 'trulens.main.main_input': 'test', 'trulens.main.main_output': 'answer: nested: nested2: nested3'}",EventRecordType.SPAN,"{'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.29.0', 'service.name': 'trulens'}",2025-01-06 10:35:06.964720,2025-01-06 10:35:06.967988,"{'trace_id': '144282703647043990575107655191646646862', 'parent_id': '14327454352716866937', 'span_id': '17674944483240759796'}"
2,"{'name': 'nested', 'kind': 'SPAN_KIND_TRULENS', 'parent_span_id': '17674944483240759796', 'status': 'STATUS_CODE_UNSET'}",10247752478833396301,"{'name': 'nested', 'kind': 'SPAN_KIND_TRULENS', 'trulens.span_type': 'unknown', 'trulens.app_id': 'app_hash_baf7b2cb6402e84fa3b0b3a028d4bf65', 'trulens.record_id': '44bfab09-d1e5-49d6-a07a-3660f96f6b28', 'trulens.SpanType.UNKNOWN.nested_attr1': 'value1'}",EventRecordType.SPAN,"{'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.29.0', 'service.name': 'trulens'}",2025-01-06 10:35:06.964739,2025-01-06 10:35:06.967177,"{'trace_id': '144282703647043990575107655191646646862', 'parent_id': '17674944483240759796', 'span_id': '10247752478833396301'}"
3,"{'name': 'nested2', 'kind': 'SPAN_KIND_TRULENS', 'parent_span_id': '10247752478833396301', 'status': 'STATUS_CODE_UNSET'}",6933110724327092438,"{'name': 'nested2', 'kind': 'SPAN_KIND_TRULENS', 'trulens.span_type': 'unknown', 'trulens.app_id': 'app_hash_baf7b2cb6402e84fa3b0b3a028d4bf65', 'trulens.record_id': '44bfab09-d1e5-49d6-a07a-3660f96f6b28', 'trulens.SpanType.UNKNOWN.nested2_ret': 'nested2: nested3', 'trulens.SpanType.UNKNOWN.nested2_args[1]': 'test'}",EventRecordType.SPAN,"{'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.29.0', 'service.name': 'trulens'}",2025-01-06 10:35:06.964755,2025-01-06 10:35:06.966292,"{'trace_id': '144282703647043990575107655191646646862', 'parent_id': '10247752478833396301', 'span_id': '6933110724327092438'}"
4,"{'name': 'nested3', 'kind': 'SPAN_KIND_TRULENS', 'parent_span_id': '6933110724327092438', 'status': 'STATUS_CODE_UNSET'}",13038894380232615265,"{'name': 'nested3', 'kind': 'SPAN_KIND_TRULENS', 'trulens.span_type': 'unknown', 'trulens.app_id': 'app_hash_baf7b2cb6402e84fa3b0b3a028d4bf65', 'trulens.record_id': '44bfab09-d1e5-49d6-a07a-3660f96f6b28', 'trulens.SpanType.UNKNOWN.nested3_ret': 'nested3', 'trulens.special.nested3_ret': 'nested3', 'trulens.SpanType.UNKNOWN.selector_name': 'special', 'trulens.SpanType.UNKNOWN.cows': 'moo', 'trulens.special.cows': 'moo'}",EventRecordType.SPAN,"{'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.29.0', 'service.name': 'trulens'}",2025-01-06 10:35:06.964771,2025-01-06 10:35:06.964845,"{'trace_id': '144282703647043990575107655191646646862', 'parent_id': '6933110724327092438', 'span_id': '13038894380232615265'}"
5,"{'name': 'root', 'kind': 'SPAN_KIND_TRULENS', 'parent_span_id': '', 'status': 'STATUS_CODE_UNSET'}",3952039165605553205,"{'name': 'root', 'kind': 'SPAN_KIND_TRULENS', 'trulens.span_type': 'record_root', 'trulens.app_id': 'app_hash_baf7b2cb6402e84fa3b0b3a028d4bf65', 'trulens.record_id': '457bda18-585b-4d47-87bc-0a1e664fe382', 'trulens.record_root.app_name': 'default_app', 'trulens.record_root.app_version': 'base', 'trulens.record_root.app_id': 'app_hash_baf7b2cb6402e84fa3b0b3a028d4bf65', 'trulens.record_root.record_id': '457bda18-585b-4d47-87bc-0a1e664fe382'}",EventRecordType.SPAN,"{'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.29.0', 'service.name': 'trulens'}",2025-01-06 10:35:06.969596,2025-01-06 10:35:06.973727,"{'trace_id': '7358739192569121753827351142744298022', 'parent_id': '', 'span_id': '3952039165605553205'}"
6,"{'name': 'respond_to_query', 'kind': 'SPAN_KIND_TRULENS', 'parent_span_id': '3952039165605553205', 'status': 'STATUS_CODE_UNSET'}",1478712444735576554,"{'name': 'respond_to_query', 'kind': 'SPAN_KIND_TRULENS', 'trulens.span_type': 'main', 'trulens.app_id': 'app_hash_baf7b2cb6402e84fa3b0b3a028d4bf65', 'trulens.record_id': '457bda18-585b-4d47-87bc-0a1e664fe382', 'trulens.main.main_input': 'throw', 'trulens.main.main_output': 'answer: nested: nested2: '}",EventRecordType.SPAN,"{'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.29.0', 'service.name': 'trulens'}",2025-01-06 10:35:06.969632,2025-01-06 10:35:06.972837,"{'trace_id': '7358739192569121753827351142744298022', 'parent_id': '3952039165605553205', 'span_id': '1478712444735576554'}"
7,"{'name': 'nested', 'kind': 'SPAN_KIND_TRULENS', 'parent_span_id': '1478712444735576554', 'status': 'STATUS_CODE_UNSET'}",11893598297289172269,"{'name': 'nested', 'kind': 'SPAN_KIND_TRULENS', 'trulens.span_type': 'unknown', 'trulens.app_id': 'app_hash_baf7b2cb6402e84fa3b0b3a028d4bf65', 'trulens.record_id': '457bda18-585b-4d47-87bc-0a1e664fe382', 'trulens.SpanType.UNKNOWN.nested_attr1': 'value1'}",EventRecordType.SPAN,"{'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.29.0', 'service.name': 'trulens'}",2025-01-06 10:35:06.969662,2025-01-06 10:35:06.972061,"{'trace_id': '7358739192569121753827351142744298022', 'parent_id': '1478712444735576554', 'span_id': '11893598297289172269'}"
8,"{'name': 'nested2', 'kind': 'SPAN_KIND_TRULENS', 'parent_span_id': '11893598297289172269', 'status': 'STATUS_CODE_UNSET'}",12750433148730500631,"{'name': 'nested2', 'kind': 'SPAN_KIND_TRULENS', 'trulens.span_type': 'unknown', 'trulens.app_id': 'app_hash_baf7b2cb6402e84fa3b0b3a028d4bf65', 'trulens.record_id': '457bda18-585b-4d47-87bc-0a1e664fe382', 'trulens.SpanType.UNKNOWN.nested2_ret': 'nested2: ', 'trulens.SpanType.UNKNOWN.nested2_args[1]': 'throw'}",EventRecordType.SPAN,"{'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.29.0', 'service.name': 'trulens'}",2025-01-06 10:35:06.969680,2025-01-06 10:35:06.971267,"{'trace_id': '7358739192569121753827351142744298022', 'parent_id': '11893598297289172269', 'span_id': '12750433148730500631'}"
9,"{'name': 'nested3', 'kind': 'SPAN_KIND_TRULENS', 'parent_span_id': '12750433148730500631', 'status': 'STATUS_CODE_ERROR'}",12702464521771855067,"{'name': 'nested3', 'kind': 'SPAN_KIND_TRULENS', 'trulens.span_type': 'unknown', 'trulens.app_id': 'app_hash_baf7b2cb6402e84fa3b0b3a028d4bf65', 'trulens.record_id': '457bda18-585b-4d47-87bc-0a1e664fe382', 'trulens.SpanType.UNKNOWN.nested3_ex': ['nested3 exception'], 'trulens.special.nested3_ex': ['nested3 exception'], 'trulens.SpanType.UNKNOWN.selector_name': 'special', 'trulens.SpanType.UNKNOWN.cows': 'moo', 'trulens.special.cows': 'moo'}",EventRecordType.SPAN,"{'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.29.0', 'service.name': 'trulens'}",2025-01-06 10:35:06.969698,2025-01-06 10:35:06.970256,"{'trace_id': '7358739192569121753827351142744298022', 'parent_id': '12750433148730500631', 'span_id': '12702464521771855067'}"
4 changes: 3 additions & 1 deletion tests/unit/test_otel_instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from trulens.core.session import TruSession
from trulens.experimental.otel_tracing.core.init import init
from trulens.experimental.otel_tracing.core.instrument import instrument
from trulens.otel.semconv.trace import SpanAttributes

from tests.test import TruTestCase
from tests.util.df_comparison import (
Expand All @@ -19,7 +20,7 @@


class _TestApp:
@instrument()
@instrument(span_type=SpanAttributes.SpanType.MAIN)
def respond_to_query(self, query: str) -> str:
return f"answer: {self.nested(query)}"

Expand Down Expand Up @@ -121,6 +122,7 @@ def test_instrument_decorator(self) -> None:
test_app.respond_to_query("test")
with custom_app:
test_app.respond_to_query("throw")

# Compare results to expected.
GOLDEN_FILENAME = "tests/unit/static/golden/test_otel_instrument__test_instrument_decorator.csv"
actual = self._get_events()
Expand Down

0 comments on commit 8d2cece

Please sign in to comment.