apm-agent-ruby: Error [400] /properties/process/properties/pid/type expected number, but got null

Hi, I’m having some trouble using Elastic APM ruby agent on a Rails app hosted using puma (3.11.2 (ruby 2.4.1-p111)) in production environment (not really a production app, but hosted like so 😉 ). I get errors like (agent side):

[ElasticAPM] {"error":"Problem validating JSON document against schema: I[#] S[#] doesn't validate with \"transaction#\"\n  I[#/process/pid] S[#/properties/process/properties/pid/type] expected number, but got null"}

Occuring only in production mode, when using the rails s in DEV env mode it works like a charm (also using puma as dev server when running rails s also`).

Here is the full apm rails agent output:

D, [2018-02-07T01:11:58.377672 #7856] DEBUG -- : ** [ElasticAPM] Flushing transactions
E, [2018-02-07T01:11:59.144111 #7856] ERROR -- : ** [ElasticAPM] POST returned an unsuccessful status code (400)
D, [2018-02-07T01:11:59.144372 #7856] DEBUG -- : ** [ElasticAPM] {"error":"Problem validating JSON document against schema: I[#] S[#] doesn't validate with \"transaction#\"\n  I[#/process/pid] S[#/properties/process/properties/pid/type] expected number, but got null"}

And here are the apm-server logs:

2018-02-07T01:11:15.732+0100    INFO    [request]       beater/handlers.go:150  handled request {"request_id": "c426b616-b81c-404e-8431-2e0ee8768008", "response_code": 400, "method": "POST", "URL": "http://livia.cypressxt.net:8200/v1/trans
actions", "content_length": 94047, "remote_address": "192.168.1.106", "user_agent": "elastic-apm/ruby 0.3.0"}
2018-02-07T01:11:44.152+0100    INFO    [monitoring]    log/log.go:124  Non-zero metrics in the last 30s        {"monitoring": {"metrics": {"apm-server":{"processor":{"transaction":{"validation":{"count":1,"errors":1}}},"server":{"requests
":{"counter":1},"response":{"errors":1}}},"beat":{"cpu":{"system":{"ticks":210,"time":216},"total":{"ticks":1250,"time":1260,"value":1250},"user":{"ticks":1040,"time":1044}},"info":{"ephemeral_id":"feabd8ce-1786-47a7-b306-1d430a4c8dcb","up
time":{"ms":3240010}},"memstats":{"gc_next":4194304,"memory_alloc":2640816,"memory_total":146758632}},"libbeat":{"config":{"module":{"running":0}},"pipeline":{"clients":1,"events":{"active":0}}},"system":{"load":{"1":0.03,"15":0.09,"5":0.0
8,"norm":{"1":0.015,"15":0.045,"5":0.04}}}}}}
2018-02-07T01:11:59.113+0100    ERROR   [request]       beater/handlers.go:384  error handling request  {"request_id": "2bec79d8-1bc8-4aa8-8fc8-a5ac2430059f", "error": "Problem validating JSON document against schema: I[#] S[#] doesn't val
idate with \"transaction#\"\n  I[#/process/pid] S[#/properties/process/properties/pid/type] expected number, but got null"}

And last, here is my puma configuration file used:

#!/usr/bin/env puma

directory '/var/www/myapp/current'
rackup "/var/www/myapp/current/config.ru"
environment 'preproduction'
daemonize true
pidfile "/var/www/myapp/shared/tmp/pids/puma.pid"
state_path "/var/www/myapp/shared/tmp/pids/puma.state"
stdout_redirect '/var/www/myapp/shared/log/puma_access.log', '/var/www/myapp/shared/log/puma_error.log'
threads 5,5
bind 'unix:///var/www/myapp/shared/tmp/sockets/puma.sock'
workers 0
prune_bundler

Don’t know exactly why but the agent seems to parse the pid type as null in this configuration.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

Great! Thanks for reporting. I’d love to get any and all feedback that you might have 😃

Yep, fixed for me too !

Seems to work fine now!

Hi @mikker, ok I’m checking this tonight, will keep you informed. Thx !