Repository navigation
feat(emit): a broken database call fails the way the database would - #69
Merged
Merged
Conversation
A broken edge into a datastore used to emit a span named "api -> db" with the diagram's reason as its status and a placeholder query, so nobody without the diagram could say which query failed or why. The DB client span now carries the statement that ran (db.query.text, db.namespace, db.collection.name, db.operation.name, db.system.name read off the label) and, when the edge is broken, the error the driver would return: db.response.status_code, error.type, and an exception event with exception.type, exception.message and exception.stacktrace. "wrong column" on SQL Server is SqlException 207, "Invalid column name 'Discount'.", with the column in the query; a quoted name in the reason picks the column. Wrong table, syntax error and division by zero get their own errors, and PostgreSQL gets its own SQLSTATE and wording. The calling span is now ERROR with the same description, so the failure shows up the chain. Healthy calls, including other calls into the same database, carry a real statement and stay green. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…server A broken call now fails every synchronous span above it, up to the entry point, not only its direct caller. It stops at an async hop: a publish succeeded once the broker took the message, so a consumer failing later is not the producer's error. failedSpanCount is documented as counting failed edges, not red spans. DB client spans carry server.address (the node label) and server.port (1433 for SQL Server, 5432 for PostgreSQL). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ETWOYA
approved these changes
Oct 6, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A broken database call fails the way the database would
When a diagram breaks a call into a database (for example
api[Orders API] -->|broken: wrong column| db[(SQL Server)]), the telemetry now reads like a real database failure, following the OpenTelemetry database and exception conventions. Someone who has not seen the diagram can name the failing query and the cause from the trace alone.The database client span (
SELECT dbo.Orders): status ERROR,db.system.name,db.namespace,db.collection.name,db.operation.name,db.query.text(the statement that failed),db.response.status_code,error.type,server.addressandserver.port.An exception event on it: the driver's exception type (
Microsoft.Data.SqlClient.SqlExceptionorNpgsql.PostgresException), a message naming the cause (Invalid column name 'Discount'.), the error number and a realistic stack trace.wrong column,wrong table,syntax erroranddivision by zeroeach map to the database's own error; a quoted name (broken: wrong column 'ShipDate') sets the column or table.Up the chain: the error climbs the synchronous call chain to the entry point. It stops at queues: a publish succeeded once the broker took the message.
Scoped: only the broken edge (or run N with
broken on #N) fails; healthy calls to the same database stay OK and now carry a real statement instead of a placeholder.Behaviour changes to know:
db.namespace,server.addressandserver.port, and SQL Server labels reportmicrosoft.sql_serverinstead ofpostgresql. Tools that identify a database by system plus namespace or address will see these as new, more accurate nodes.failedSpanCountcounts failed edges, not red spans (documented).Tests: .NET 1223 passed (16 new, including a three-tier chain and a queue hop); SPA vitest 44 passed. Output is derived only from the diagram, so a shared link replays the same SQL and error.
🤖 Generated with Claude Code