Home Healthcare Reporting Customized Metrics to FSO Platform The usage of the OpenTelemetry SDK

Reporting Customized Metrics to FSO Platform The usage of the OpenTelemetry SDK

0
Reporting Customized Metrics to FSO Platform The usage of the OpenTelemetry SDK

[ad_1]

With Cisco FSO Platform, metrics will also be reported at once from the code. Not like the use of any roughly auto-instrumentation characteristic, this comes in handy when a carrier proprietor is aware of what must be reported. A normal use case can be enabling reporting of area particular metrics – like collection of pieces within the catalogue for e-shops, collection of unfinished orders, SQL queries to express desk, and many others. Principally, anything else which could be fascinating to watch for some time period, or when put next amongst other implementation variations.

Arms-on steerage on methods to set this up

Open Telemetry has a advisable manner of the way the metric reporting must be routed to any device. The carrier which will probably be reporting the information goes to ship them to the open telemetry collector, which is a somewhat handy common receiver, processor and exported of (now not most effective) open telemetry formatted knowledge. Open Telemetry collector will then be configured to relay the entire knowledge to the FSO Platform tenant.

The very first thing that you wish to have to safe is a FSO Platform tenant, to which the information will drift. I occur to have one able, however I wish to get the fundamental and clientId and clientSecret used to export knowledge. After logging in, I opened a “Configuration” tab, then decided on “Kubernetes and APM,” named my configuration, and adopted the guidelines offered to me:

FSO Platform - Getting Agent Principal
FSO Platform – Getting Agent Foremost

That are meant to be all I wish to configure my Open Telemetry collector.

Open Telemetric Collector configuration

Subsequent, I used Docker symbol otel/opentelemetry-collector-contrib:newest, since that’s the most straightforward manner for me to run the collector. All I wish to do is to give you the proper configuration, which is completed by way of supplying –config parameter.

After some quick analysis, I determined to make use of the next configuration:

OTEL Collector configuration
Click on symbol to get right of entry to the gist in Github

Then the one factor left to do is to begin the collector:

% docker run --rm -t -v $PWD/otel-config.yaml:/and many others/otel-collector-config.yaml 

-p 4317:4317 otel/opentelemetry-collector-contrib:newest --config=/and many others/otel-collector-config.yaml

The collector begins truly briefly, I most effective verified that the entire extensions I added are initialised, no mistakes published out.

My go-to language is Java, so we could check out that first. Open Telemetry supplies a somewhat in depth checklist of SDK libraries for any fashionable languages and runtimes. The Java SDK appears to be essentially the most mature one on that checklist. This doesn’t imply that Java is the one selection. Realistically, there’s already fortify for reporting Open Telemetry knowledge from any actively used language. And if now not, there’s all the time an way to record knowledge the use of other receivers. As an example, you’ll use Prometheus or Zipkin fortify which your programming or runtime atmosphere already has.

Metric Information Supply

Since I don’t have any software able for this experiment, I selected to do the handbook instrumentation (it’s going to perhaps be extra amusing anyway).

After putting in place a venture and a dependency on the newest SDK model to be had (1.29.0), I put in combination the next magnificence package deal com.cisco.fso:

Java Class reporting OTEL Metric
Click on symbol to get right of entry to the gist in Github

Let’s undergo some necessary portions of this code snippet.

First one is the Useful resource declaration. In Open Telemetry, each and every knowledge level must be reported within the context of a useful resource, together with metrics. Right here I’m stating my useful resource as one thing with the attributes carrier.title and carrier.example.identity — which is a de-facto same old, described as a part of the Open Telemetry semantic conventions.

If you happen to discover that area extra, you’ll in finding a number of different conventions, defining which useful resource attributes must be reported for more than a few parts, like container, pod, carrier working deployed on some cloud supplier and plenty of extra. By means of the use of carrier.title and carrier.example.identity, we’re reporting a carrier. On FSO Platform that is mapped to the sort apm:service_instance.

Any other section value bringing up is the metric initialization. You’ll be able to see that I named my metric “my.first.metric”, set the sort to gauge, declared that it’s going to be reporting lengthy values, and registered a callback, which does go back random lengthy values. Now not very helpful, however must be just right sufficient to get some knowledge in.

After executing this system, you’ll see new logs reported by way of the Open Telemetry Collector we began sooner than:

OTEL Collector log
Click on symbol to get right of entry to the gist in Github

Exploring ingested metrics the use of FSO Platform

It is a just right signal that the information arrived from my Java program to the collector. Additionally, the collector comprises additional logs which recommend that it was once in a position to record the information to the platform. So, let’s get again to the browser and take a look at whether or not we will be able to see reported knowledge.

FSO Platform Entity Centric Service view
FSO Platform – Cloud Local Utility Observability – Provider Entity view

It appears my carrier was once registered by way of the platform, however there don’t seem to be a lot knowledge reported. And, any metrics which might be displayed by way of default, don’t seem to be populated. Why is that taking place?

All of the metrics which might be there are derived from spans and lines which might be reported by way of any same old APM Provider or even any framework which you’d be the use of. The Open Telemetry SDK has great auto-discoverable options for Spring, Micronaut, and different equipment you could be the use of. After placing some load for your carrier, you can see the ones. However that’s now not what we wish to do as of late. We wish to see our crucial “my.first.metric” knowledge issues.

For that, we can wish to use Question Builder, a Machine Utility of FSO Platform, which lets you question saved knowledge at once the use of Unified Question Language.

FETCH metrics(dynamicmetrics:my.first.metric)
FROM entities(apm:service_instance)[attributes(service.name)='manualService']

This actual question fetches the reported metric for the apm:service_instance, which was once mapped from the useful resource reported the use of the Java snippet above. It retrieves values of a metric my.first.metric and presentations them at the output. The dynamicmetrics string represents a distinct namespace for metrics, which have been ingested however don’t seem to be outlined in any of the answers which the present tenant is lately subscribed to.

FSO Platform - Query Builder
FSO Platform – Question Builder

Clearly, that is most effective the start and maximum of you wouldn’t be most effective reporting customized metrics by way of hand, you’d be instrumenting code of your current packages, infrastructure, cloud suppliers and anything else you’ll fashion.

Able to check out? Get mentioned with Cisco FSO Platform 

Similar sources

Proportion:

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here