Ruby on Rails Can't Access Server

Hi, I just launched a trial so I imagine everything is up to date.

So far I have..

  • Added the elastic-apm gem
  • Uncommented the lines for my elastic_apm.yml
  • Loaded the kibana objects as directed to in the setup docs
  • Used CI to rebuild the docker container with these changes and deploy to my kubernetes cluster

I believe the server is running, as I configured apm logs to go to a file. The contents of the file are this:

$ cat elastic_apm.log
# Logfile created on 2019-04-01 18:36:37 +0000 by logger.rb/56815

However, going to my server URL listed in the elastic_apm.yml gives me a blank screen (in chrome and safari)

Additionally, clicking launch APM at the bottom of the setup instructions just redirects me to a page saying that I don't have any services configured for APM.

Finally, here's the my config.yml

# config/elastic_apm.yml:

# Set service name - allowed characters: a-z, A-Z, 0-9, -, _ and space
# Defaults to the name of your Rails app
service_name: 'elastic-service'

# Use if APM Server requires a token
secret_token: '$my_token'

# Set custom APM Server URL (default: http://localhost:8200)
server_url: 'https://$my_server.apm.us-central1.gcp.cloud.es.io:443'

log_path: elastic_apm.log

Any assistance anyone can offer would be greatly appreciated!

Hi there!

When you visit APM Server directly, it's not supposed to show anything. So that blank screen is on purpose. Your data will show up in Kibana under APM.

If the agent boots via the gem, your Rails log will have a message like [ElasticAPM] [2.6.0] Starting agent, reporting to https://$my_server.apm.us-central1.gcp.cloud.es.io:443.

Does that help in debugging?

Mikkel, Elastic

Thanks for the reply. This was helpful as I went into the rails console and saw this message when it booted up

[ElasticAPM] Not tracking anything in "sandboxa" env

sandboxa is the name of the $RAILS_ENV that this kubernetes deployment uses. Any idea what this would mean? Is ElasticAPM looking for a different $RAILS_ENV?

Additionally, the APM screen states that no services are installed which I suppose makes sense given the above message showing that nothing is being tracked. I've attached the relevant screenshot either way.

I just found the enabled_environments
config key in https://www.elastic.co/guide/en/apm/agent/ruby/1.x/configuration.html

I'll let you know if I have additional problems.

Sounds like you might have an old (1.x) version of the agent? Try bundle update elastic-apm.

So it looks like we've got some dependency conflicts that I don't believe can be resolved. Here's a excerpt from CI

Bundler could not find compatible versions for gem "http":
  In snapshot (Gemfile.lock):
    http (= 0.9.9)

  In Gemfile:
    contentful_rails was resolved to 0.4.1, which depends on
      contentful_model (~> 0.2) was resolved to 0.2.0, which depends on
        contentful (~> 0.9) was resolved to 0.10.0, which depends on
          http (~> 0.8)

    elastic-apm (~> 2.0.1) was resolved to 2.0.1, which depends on
      http (>= 3.0)

One of these gems requires http <3, while elastic-apm requires >=3. I also tried the elastic-apm version 1.1.0 which doesn't require http, but that also wasn't compatible.

This is a stretch, but is it possible to deploy the elastic rails agent as a container in the same pod as our application?

Sorry, no. The agent needs to run as part of the app process to be able to do what it does. I (re)checked the changelog of Http.rb and we do need 3.0+ for what we use it for.

I can see contentful, in it's current form, could work with a >= 3.0 Http.rb: https://github.com/contentful/contentful.rb/blob/master/contentful.gemspec#L24

Did you try upgrading contentful_rails? I have no idea how it might've changed over time but if we're lucky it's an easy upgrade :slight_smile:

Bummer. Yeah I did some upgrading but I don't think it'll be possible.

Thanks for consistently following up that said :slight_smile:

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.