Monitoring Ruby applications in Kubernetes environment

Before you monitor Ruby applications in Kubernetes environment, you must connect the data collector to the server by creating a secret. Then, you update your application deployment to monitor the Ruby applications.

Before you begin

About this task

You can create a secret for the global.environment file and the keyfiles that are extracted from the Monitoring configuration package. Then, you mount this secret when you deploy the application as a Kubernetes deployment. To enable the Ruby data collector, you need to install stacktracer-20.06.00.gem in Ruby application.

Procedure

  1. Go to the ibm-cloud-apm-dc-configpack directory where you extract the configuration package in Obtaining the server configuration information, and run the following command to create a secret to connect to the server, for example, name it as icam-server-secret.

    kubectl -n my_namespace create secret generic icam-server-secret \
    --from-file=keyfiles/keyfile.p12 \
    --from-file=keyfiles/ca.pem \
    --from-file=global.environment
    

    Where my_namespace is the namespace where you want to create the secret.

  2. Put stacktracer-20.06.00.gem into the Ruby application folder, for example, app_folder/RubyDC.

  3. In the Dockerfile, insert the following lines between the section of bundle package and bundle install.

    RUN cp <app_folder>/RubyDC/stacktracer-20.06.00.gem <app_folder>/vendor/cache/
    RUN echo "gem 'zipkin-tracer','>=0.32'" >> Gemfile
    RUN echo "gem 'stacktracer','=20.06.00'" >> Gemfile
    
  4. Rebuild the application docker image.

    docker build --network=host -t <image-name>:<version>
    
  5. Repush it to a docker repository.

    docker tag <image-name>:<version> <docker-repository>/<namespace>/<image-name>:<version>
    docker push <docker-repository>/<namespace>//<image-name>:<version>
    
  6. Redeploy the application deployment in Kubernetes environment, or relaunch the docker image into container.