The Simplest Way to Make New Relic and Step Functions Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair new relic and step functions to track state runs in one place. This setup sends execution logs and timing metrics straight to your dashboards. Cloud workflows often span many small tasks, queues, and databases. When a step fails, engineers need to see why right away. Sending state metrics to a single view helps teams fix bugs fast. You can spot slow steps, check error rates, and alert on-call staff. How new relic and step functions share data and roles State machines run inside yo

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.

Teams pair new relic and step functions to track state runs in one place. This setup sends execution logs and timing metrics straight to your dashboards.

Cloud workflows often span many small tasks, queues, and databases. When a step fails, engineers need to see why right away. Sending state metrics to a single view helps teams fix bugs fast. You can spot slow steps, check error rates, and alert on-call staff.

How new relic and step functions share data and roles

State machines run inside your cloud account and produce metrics and logs. Each state change creates an event with timing and status details. To read this data, your monitoring tool needs a safe cloud role. You set up a cross-account role that grants read-only access to metrics.

Logs take a slightly different path from your cloud account. Your state machine writes execution history to a cloud log group. A small forwarder function reads those log lines and sends them out. This forwarder uses an API key to write data to your monitoring account.

Traces can also flow between the two systems during a run. When a state calls a worker function, it passes a trace header. The worker sends that header to your dashboard along with its own data. This links the state run to the exact code that ran inside it.

Common failure modes and how to scope permissions

Many teams start by sharing one broad API key across all workflows. If that key leaks, an attacker can send fake data or read secrets. Other teams give the cross-account role full read rights to everything. This breaks the rule of least privilege and puts cloud data at risk.

Unfiltered logs create another big risk for production workflows. State machines pass JSON payloads from one step to the next. Those payloads often hold emails, phone numbers, card numbers, or national IDs. If you log full payloads, sensitive fields end up in your monitoring tool.

Cloud Functions IAM + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

To fix role bloat, scope the cloud role to specific resource groups. Only allow the monitoring role to read metrics for approved state machines. Give each team or app its own forwarder key with narrow write rights. Rotate these keys on a set schedule and store them in a secret manager.

To protect data, turn off full payload logging on sensitive state runs. Log only state status transitions, error names, and step run times. When engineers inspect live databases or backend tools during an alert, use masking. Data masking rewrites matched fields like card numbers or emails in query results.

Keeping alerts fast and noise low

Collecting every log event from high-volume workflows can drive up costs fast. Standard workflows log start and end events for every single step. Express workflows run much faster and can flood your log forwarder. You should match your logging level to the risk of the workflow.

For high-speed runs, log only fatal errors and failed state transitions. Use cloud metrics to track total run counts and average run times. Set alerts on sudden spikes in failed runs or timed-out states. This keeps your bill low while still catching real production problems early.

When an alert fires, the on-call engineer needs to check the failed step. They read the error log in the dashboard and trace the bad input. From there, they may need to check the database or run a fix script. Tight role rules make sure this debug work stays safe and fully audited.

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 you send Step Functions logs to New Relic?

Send your state machine logs to a cloud log group first. Then use a log forwarder function to push those logs via an API key.

Can you trace tasks inside a Step Functions workflow?

Yes, enable distributed tracing on both your state machine and its worker functions. The state machine passes trace headers so each step links together in one view.

How do you stop sensitive payload data from reaching dashboards?

Set your state machine log level to record only errors and status changes. You can also filter or mask emails and card numbers before forwarding logs.

The query runs. The emails stay hidden.