Skip to main content

Database traffic

Speedscale records the calls your services make to their databases from the network, the same way it records HTTP and gRPC. It reads the database's own wire protocol, so you see every statement your app actually sent and every answer it got, without database credentials, an agent on the database server, or database logs to turn on.

That is what makes database calls useful far beyond mocking: you can watch them live, find the slow or failing ones, see which request ran them, compare two releases, export them as SQL, and replay them against a database to load or regression test it.

What is recorded for each call​

Every Postgres, MySQL and SQL Server call is one request and response pair (RRPair). For SQL Server a call is one SQL batch, one RPC such as sp_executesql or a stored procedure called by name, one transaction request, or one attention (cancel). Besides the raw request and response, Speedscale works out these facts and makes each of them something you can filter, group and show as a column:

FactWhat it holds
StatementThe SQL your app sent, such as a whole T-SQL batch. Its shape masks literals and parameters, so every execution of one logical statement shares it.
Bound valuesThe parameter values of a prepared statement or RPC, shown filled into the SQL.
Operation and tablesThe leading command, such as SELECT or UPDATE, and the tables the statement names.
EventA statement, a login or a logout.
User, database, applicationWho logged in, to which database, and the client's application name.
SessionThe server's id for the connection: the Postgres backend pid, the MySQL connection id or the SQL Server session id (SPID).
TransactionWhether the statement ran inside a transaction, and whether that transaction had already failed.
OutcomeRows returned or changed, and warnings. For SQL Server, also the return value and return status of a stored procedure and its informational messages, such as PRINT output.
ErrorThe SQLSTATE for Postgres, or the error number for MySQL and SQL Server, with its name. SQL Server sends no SQLSTATE, so a well-known error number such as 2627 takes the name of the condition it amounts to, unique_violation.
AttentionWhy a call needs a look: cancelled, timeout, deadlock, lock timeout, terminated, cancel request or aborted.
Trace id and routeThe W3C trace id and the route the app wrote into a SQL comment, which link the statement to the request that ran it. See Link queries to the request that ran them.

proxymock and the Speedscale cloud compute these facts the same way, so a filter selects the same calls on your laptop and in the dashboard.

Connection facts (user, database, application, session) need a capture from proxymock or the Speedscale operator at version 2.5.1103 or later. Trace ids and routes need 2.5.1153 or later. In the cloud, traffic indexed before an upgrade keeps the facts it was indexed with.

Supported databases​

DatabaseRecorded and mockedDatabase factsReplayed against a database
PostgreSQLYesYesYes
MySQL and MariaDBYesYesYes
SQL Server, Azure SQL Database, Amazon RDS for SQL Server and Azure SQL Managed InstanceYesYesYes
MongoDBYesNoNo
Redis and ValkeyYesNoNo
DynamoDBYes, as AWS API callsNoNo

Technology support lists every protocol.

How the calls are recorded​

  • Locally, proxymock record --map listens on a local port and forwards to the real database, and your app connects to that port. See Record your database.
  • In Kubernetes, the Speedscale operator records database calls with the rest of a workload's traffic, through its sidecar or the eBPF collector, with no change to the app.

Decoding SQL needs the conversation in clear text where it is recorded. Locally, connect your app to proxymock without TLS for the recording, for example with sslmode=disable for Postgres or ssl-mode=DISABLED for MySQL. The eBPF collector reads Postgres and MySQL TLS traffic before it is encrypted. SQL Server connections can stay encrypted: proxymock, and the sidecar with outbound TLS interception on, decrypt them; see Record SQL Server.

SQL Server is recorded through proxymock or the sidecar, which decrypt encrypted connections the way they decrypt HTTPS, when the driver trusts the proxymock or Speedscale certificate authority. The sidecar needs outbound TLS interception for this; without it, a connection that encrypts only its login is recorded without the user and application name, and a fully encrypted one records only its opening handshake. Record SQL Server shows the settings for each driver and the limits.

Privacy​

Recorded statements hold real values: the literals in the SQL, the bound parameters, and the rows that came back. Data loss prevention rules redact them before they leave your environment, and you can author and test those rules locally with proxymock against your own recordings. The statement shape, which most filters and reports use, never contains a literal value. SQL Server passwords, Windows (SSPI) authentication data and Microsoft Entra ID access tokens are never recorded.

Where to go next​

Loading search...