Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Metrics SDK, version Alpha 0.1: request for feedback. #643

Closed
macrogreg opened this issue Oct 31, 2017 · 9 comments
Closed

Azure Metrics SDK, version Alpha 0.1: request for feedback. #643

macrogreg opened this issue Oct 31, 2017 · 9 comments

Comments

@macrogreg
Copy link
Contributor

Here I introduce the pre-release version of the Microsoft Azure Metrics SDK. I give a brief overview of the feature set and then provide a number of usage examples as a tutorial for the API surface. The goal of this publication is to collect feedback on the API surface and on the implementation strategy.

The goal of the Azure Metrics SDK is to provide an API for metric pre-aggregation and metric ingestion into Azure. In the current pre-release version we target the Application Insights ingestion endpoint. However, the SDK is designed with minimal dependencies on the Application Insights Core SDK. It is structured to be naturally used to submit preaggregated metrics to other endpoints. In the mid- to long-term, a subset of the features may be moved into more platform-level .Net APIs.

Metrics, once emitted by the source application, are always a conceptually aggregated quantity. Specific metric measurements should never be sent or stored in the original, non-aggregated form. Once the APIs discussed here reach a stable public release, the Application Insights TelemetryClient.TrackMetric(..) API should be deprecated. Advanced developers wishing to implement their own pre-aggregation logic should use TelemetryClient.Track(ITelemetry) API to send any telemetry that results from their custom aggregation. Developers who want to send specific single-point measurements should use Events.

Currently the SDK offers the following features:

• Different kinds of aggregators:
-- Measurements
-- Counters
-- Custom aggregators

• Zero-dimensional and multi-dimensional metrics:
-- Local metric series capping
-- Local dimension cardinality capping
-- Support for dynamic discovery of dimension values.

• Data introspection: applications can reason about their own telemetry.

• Support for centrally configured aggregation.

• APIs structure is layered:
-- Low level APIs are optimized for performance and memory consumption. Aggregation is lock-free and GC-friendly.
-- Convenience APIs are discoverable and provide a smooth learning curve.

• Support for QuickPulse/LiveMetrics.

• Support for custom aggregation cycles, data filters, value filters.

• Support for unit and integration of metrics-emitting code.

Currently the Azure Metrics SDK is available as source code in the ApplicationInsights-SDK-Labs repo on GitHub in the branch metrics/master. Direct link:
https://github.com/Microsoft/ApplicationInsights-SDK-Labs/tree/metrics/master

We will be starting work to move it into the ApplicationInsights-dotnet repo soon.

What follows is a series for code-samples and mini-totorials that explain the APIs, starting for the very basics, all the way to more advanced use cases. Instead of pasting it all here, please take a look at this file:
https://github.com/Microsoft/ApplicationInsights-SDK-Labs/blob/metrics/master/Metrics/Tests/Microsoft.ApplicationInsights.Metrics.Convenience.Test/Examples.cs

All examples are maintained there and updated when SDK APIs are updated. The examples can be built and run. Please pay attention to the comments in the examples. You can consider them as a continuation of this post.
Here is a list of the topics you will find there:

// *** SENDING METRICS ***
// *** MEASUREMENTS AND COUNTERS ***
// *** MULTI-DIMENSIONAL METRICS ***
// *** ACCESSING METRIC DATA SERIES ***
// *** WORKING WITH THE EMITTED METRIC DATA ***
// *** ADDITIONAL DATA CONTEXT ***
// *** SEPARATION OF CONCERNS: TRACKING METRICS AND CONFIGURING AGGREGATIONS ARE INDEPENDENT ***
// *** CUSTOM METRIC CONFIGURATIONS ***
// *** MANUALLY CREATING METRIC SERIES WITHOUT THE CONTEXT OF A METRIC ***
// *** FLUSHING ***
// *** AGGREGATION SCOPE ***
// *** UNIT TESTS: CAPTURING APPLICATION INSIGHTS TELEMETRY BY INJECTING A TELEMETRY CLIENT ***
// *** UNIT TESTS: CAPTURING APPLICATION INSIGHTS TELEMETRY BY SUBSTITUTING THE TELEMETRY CHANNEL ***
// *** UNIT TESTS: CAPTURING METRIC AGGREGATES ***
// *** Running it all ***

Thank you!

@macrogreg
Copy link
Contributor Author

@zakimaksyutov
Copy link
Member

I think we'll go in deep details a bit later. Here is one very small tactical question. I noticed that we're introducing a class which allows tracking objects, including tracking strings (by doing Double.TryParse). Do we need to do it? Can we limit API surface to double (int?) and reduce the code we will have to maintain?

I'm not sure I'm sold that we should provide API which will allow usage like this:

metric.Track("135.45")

@macrogreg
Copy link
Contributor Author

@zakimaksyutov , good question.
The reason this overload exists is that we will need to support distinct count aggregations going forward. D-counts are usually an aggregate of data points represented by strings, not numbers. That is why the generic interface has the two overloads. And the measurement merely does the "sensible" thing by trying to parse the strings to numbers.

The trouble is that interfaces are not version-able and we would not be able to have only the numeric Track method now and add the object overload later.

There is, however, another way to do distinct counts - by counting dimension values rather than metric values. Let me see if processing folks can provide some information of whether they have definite plans on what option they will pick. Maybe we can simplify.

@cijothomas
Copy link
Contributor

@macrogreg
Copy link
Contributor Author

@cijothomas , correct. :)
I will move the tests into another directory soon, to adjust with the folder structure in the Core SDK repo. I'll post an updated link.

@TimothyMothra
Copy link
Member

@macrogreg can this be closed because it's already shipped with 2.6.0-Beta3

@macrogreg
Copy link
Contributor Author

Yes.

TimothyMothra pushed a commit that referenced this issue Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants