Skip to content

Commit 8207e50

Browse files
authored
Lamby v4 Interface
1 parent ff7118a commit 8207e50

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,11 @@ LambdaPunch.push do
5959
end
6060
```
6161

62-
For example, if you are using Rails with AWS Lambda via the [Lamby](https://lamby.custominktech.com/) gem along with [New Relic APM](https://dev.to/aws-heroes/using-new-relic-apm-with-rails-on-aws-lambda-51gi) here is how your handler function might appear to ensure their metrics are flushed after each request.
62+
For example, if you are using Rails with AWS Lambda via the [Lamby](https://lamby.custominktech.com/) v4 (or higher) gem along with [New Relic APM](https://dev.to/aws-heroes/using-new-relic-apm-with-rails-on-aws-lambda-51gi) here is how you configure the handled proc called after `Lamby.cmd` in an `ensure` block. This will force metrics to be flushed after each request.
6363

6464
```ruby
65-
def handler(event:, context:)
66-
Lamby.handler $app, event, context
67-
ensure
65+
# config/environments/production.rb
66+
config.lambda.handled_proc = Proc.new do |_event, context|
6867
LambdaPunch.push { NewRelic::Agent.agent.flush_pipe_data }
6968
LambdaPunch.handled!(context)
7069
end

0 commit comments

Comments
 (0)