DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Data Engineering
  3. Databases
  4. Transport Cinnamon Matrices From Lagom to Prometheus

Transport Cinnamon Matrices From Lagom to Prometheus

Learn how simplify monitoring distributed applications with the Cinnamon and Prometheus tools to generate and visualize metrics.

Piyush Rana user avatar by
Piyush Rana
·
Sep. 07, 18 · Tutorial
Like (1)
Save
Tweet
Share
3.25K Views

Join the DZone community and get the full member experience.

Join For Free

Monitoring is a pain when it comes to distributed applications, and even more when you have shared or non-shared variables to monitor in your application.

In this article, I'll explain two tools which can ease the monitoring efforts, one for generating metrics called Cinnamon and other to visualize them, called Prometheus.

Let's have a quick brief intro to these two:

  • Prometheus - An open-source monitoring system with a dimensional data model, flexible query language, efficient time series database, and modern alerting approach.

  • Cinnamon Metrics - (a.k.a Lightbend Telemetry) provides insight into applications built with Lightbend technologies. It does so by instrumenting frameworks and toolkits such as Akka. The instrumentation is done by a Java agent that runs when your application is starting up. It collects information, at runtime, about your application based on a configuration that you must provide. One can use Lightbend Telemetry for free during development, but you must have a valid license to use it in production.

In this tutorial, we will see how we can export our Cinnamon metrics into the monitoring tool Prometheus. Let's start with the configuration.

Configuration on the Lagom Side

/* Configuration for Cinnamon to ElasticSearch */
cinnamon {
  chmetrics {
    reporters += "elasticsearch-reporter"
    elasticsearch-reporter {
      hostString = "http://127.0.0.1:9200"
      index-date-format = "yyyy-MM-dd"
      basic-auth {
        username = "YourESUsername"
        password = "Password"
      }
    }
  }
}

Similarly, you will require Prometheus Exporter:

/* Configuration for Cinnamon to Prometheus */
cinnamon {
    prometheus {
    exporters += http-server
    http-server {
      host = "localhost"
      port = 9001
    }
  }
}

This configuration will start exporting your cinnamon metrics defined in the Lagom code at your defined host and port.

Now let's do the configuration at Prometheus level. On Prometheus, these metrics can also be checked at http://hostname:9090/graph, where the hostname is the IP address where Prometheus is installed.

Configuration on the Prometheus Side

We are using the property "file_sd_config" in Prometheus configuration which fetches the properties defined in the file as mentioned and ships them to the server.

- job_name: lagom
  scrape_interval: 15s
  scrape_timeout: 10s
  metrics_path: /metrics
  scheme: http
  file_sd_configs:
  - files:
    - /prometheus/config/lagom.yml
    refresh_interval: 5m

This points to a config file named lagom.yml, which contains the path where Lagom is exporting the Cinnamon metrics. This is the best way to define the target for Prometheus where you use a file to define your URLs or other configurations.

Other ways are to hardcode the path, like so:

- job_name: kafka_exporter
  scrape_interval: 15s
  scrape_timeout: 10s
  metrics_path: /metrics
  scheme: http
  static_configs:
  - targets:
    - localhost1:port1
    - localhost2:port2

In our case, Lagom is running on DCOS on top of conductR, so the address will be something like this:

cat /opt/prometheus/config/lagom.yml - targets: [ "lagom-impl-snapshot-8d8q1-s3.conductr-2.1.14.slave.mesos:9001" ] labels: environment: test4

It can vary by where and how you are deploying your app.

That's all for today. See you guys in the next blog, where we will see how one can dynamically fetch the metrics from a Lagom app running on DCOS.

application Metric (unit) Open source Time series app Database Property (programming) Telemetry Fetch (FTP client)

Published at DZone with permission of Piyush Rana, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Key Considerations When Implementing Virtual Kubernetes Clusters
  • Why You Should Automate Code Reviews
  • Writing a Modern HTTP(S) Tunnel in Rust
  • The Importance of Delegation in Management Teams

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: