A monitoring engine for .NET applications running on Pivotal's Cloud Foundry (PCF) platform.
This component targets the PCF Metrics Forwarder, an HTTP API that can be used to inject metrics directly into the PCF loggregator stream. Any metrics recorded by this component will be directly visible inside PCF's built-in PCF Metrics application.
Petabridge.Monitoring.PCF supports the following types of metrics:
- Counters - used for measuring throughput or frequency per second;
- Gauges - used to measure values over time (i.e. changes in the size of a queue length or size of message); and
- Timings - used to measure durations measured in milliseconds.
The PCF Metrics Forwarder only natively supports gauges, so this driver does some work under the covers to adapt the other metrics types on your behalf.
We developed this driver to support our customers who are running .NET applications on PCF and intend on supporting this driver perpetually. It is licensed under Apache 2.0.
This driver is built to be extremely memory-efficient, thread-safe, and highly concurrent - it's powered by Akka.NET actors under the hood.
To get started with
Petabridge.Monitoring.PCF, install the following NuGet package:
PS> Install-Package Petabridge.Monitoring.PCF
And then create an instance of the
var metrics = PcfMetricRecorder.Create(); metrics.IncrementCounter("http.serv"); // record a counter (increment by 1) metrics.IncrementCounter("http.serv");
Typically you don't need to explicitly pass in any configuration elements for the
PcfMetricRecorder to work correctly. We're able to extract all of the necessary credentials and authentication information from the
PcfEnvironment class defined inside the
Akka.Bootstrap.PCF package, which we take as a dependency.
Integrating with Akka.NET
If you're intending on using PCF alongside Akka.NET and you want
Petabridge.Monitoring.PCF to leverage your pre-existing
ActorSystem instead of creating a new one, you can adjust the call to
var mySys = ActorSystem.Create("foo"); // your ActorSystem var metrics = PcfMetricsRecorder.Create(mySys);
This will cause the
PcfMetricsRecorder to hook its reporting infrastructure into your
ActorSystem instead of creating its own.
Petabridge.Monitoring.PCF on PCF
If you have the PCF CLI installed:
- Install the PCF Metrics Forwarder and make it available in the space you'll be using for deployment;
- clone this repository;
- edit the
manifest.ymlfile to include your application settings. Specifically, you'll want to edit the
servicessection to include the name of your PCF Metrics Forwarder service.
And then execute the following command:
PS> cf push pcf-akka-demo -b https://github.com/cloudfoundry/dotnet-core-buildpack.git
Once the deployment goes through, if you click around on the web application a couple of times you should see some metrics show up inside PCF Metrics under the heads
http.serv.duration, a counter and a timer respectively.
Building this solution
To run the build script associated with this solution, execute the following:
c:\> build.cmd all
Linux / OS X
c:\> build.sh all
If you need any information on the supported commands, please execute the
build.[cmd|sh] help command.
To preview the documentation for this project, execute the following command at the root of this folder:
This will use the built-in
docfx.console binary that is installed as part of the NuGet restore process from executing any of the usual
build.sh steps to preview the fully-rendered documentation. For best results, do this immediately after calling
Release Notes, Version Numbers, Etc
This project will automatically populate its release notes in all of its modules via the entries written inside
RELEASE_NOTES.md and will automatically update the versions of all assemblies and NuGet packages via the metadata included inside
If you add any new projects to the solution created with this template, be sure to add the following line to each one of them in order to ensure that you can take advantage of
common.props for standardization purposes:
<Import Project="..\common.props" />
This library is maintained by Petabridge®. Copyright 2018.