The Simplest Way to Make Cosmosdb and Honeycomb Work Like They Should
Using cosmosdb and honeycomb together lets your team trace database calls and find slow queries fast. Your app sends query metrics and trace spans to the telemetry store for real-time charts. This workflow links app code performance to actual database load. When a page lags, engineers see which document read or write caused the delay. They can check request units, partition keys, and response times in one view. How cosmosdb and honeycomb share data and roles The database does not push trace
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Using cosmosdb and honeycomb together lets your team trace database calls and find slow queries fast. Your app sends query metrics and trace spans to the telemetry store for real-time charts.
This workflow links app code performance to actual database load. When a page lags, engineers see which document read or write caused the delay. They can check request units, partition keys, and response times in one view.
How cosmosdb and honeycomb share data and roles
The database does not push trace spans to your telemetry tool on its own. Instead, your app code wraps each database call in a trace span. The app runs the query, records the time and cost, and sends that span out.
You can also ship cloud platform logs through a collector to your tracing tool. This setup requires two distinct sets of keys and roles. First, your app needs an identity role or key to read and write database items.
Second, your app or collector needs an API key to send trace events outward. Keep these two roles separate in your cloud setup. Use managed identities for database calls so keys do not sit in plain text files.
Store your telemetry API key in a secret store and limit what it can do. An ingest key should only create events and never manage team boards or billing.
Common failure modes in database tracing
Teams often hit trouble when they share one broad database key across many services. If three apps use one master key, your traces and audit logs blur together. You cannot tell which team or service spiked your request unit budget.
Another common risk happens when engineers log raw query bodies inside trace attributes. Database documents often hold emails, phone numbers, card numbers, or national IDs. If an app puts full document payloads into trace spans, sensitive data leaks into your charts.
CosmosDB RBAC + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Anyone with read rights on your telemetry dashboard will see those fields in search results. Ad-hoc queries during an outage add another blind spot. An engineer might log in to the database directly to fix a broken document.
Those manual edits bypass the app code and never show up in your app traces. When a manual write breaks a partition, the trace dashboard shows no clear cause.
How to scope roles and network paths
Fix shared keys by giving each app its own scoped role in the database. Grant read-only rights to services that only fetch data. Limit write permissions to the exact containers each service needs to update.
Lock down network paths so the database only accepts traffic from known virtual networks. Next, clean up your trace spans before they leave your network. Configure your telemetry collector to strip raw document fields from outgoing spans.
Record the query status, latency, container name, and request unit cost instead of raw values. For manual database work, require individual user logins instead of shared root keys. Apply data masking so queries rewrite matched emails or card numbers in results.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
How do we track request unit costs in our traces?
Read the request charge header from each database response inside your app code. Attach that number as a custom field on the active trace span before sending it.
Should we send full database queries in trace spans?
No, full queries often hold private user data like emails or phone numbers. Send only the operation type, container name, status code, and latency to keep traces safe.
How do we control manual database queries during an incident?
Stop using shared master keys for manual checks during outages. Require engineers to log in with their own identity and use read-only roles by default.
Related guides
In this post