Skip to content

Conversation

@ZStriker19
Copy link

It's often very helpful to know the actual difference between received and expected snapshots when there's a length mismatch.

@ZStriker19 ZStriker19 changed the title logging: log received and expected if reasonable when len() mismatch chore: log received and expected if reasonable when len() mismatch Jan 9, 2024
raise AssertionError(
f"Received fewer spans ({len(received)}) than expected ({len(expected)}). Expected unmatched spans: {', '.join(names)}"
f"Received different number of spans ({len(received)}) than expected ({len(expected)})."
f"If spans<=20, will display received and expected.\nReceived: {received if (len(received) <= 20) else 'too long'}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this render? I imagine the raw python dicts might be difficult to read (which is why we had reduced it to just the span names before). What do you think about formatting them to make them more readable?

f"Received fewer spans ({len(received)}) than expected ({len(expected)}). Expected unmatched spans: {', '.join(names)}"
f"Received different number of spans ({len(received)}) than expected ({len(expected)})."
f"If spans<=20, will display received and expected.\nReceived: {received if (len(received) <= 20) else 'too long'}"
f"\nExpected: {expected if (len(expected) <= 20) else 'too long'}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we resort to just the names in this case? Just so that there's at least some signal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants