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
Deprecate non-preaggregating Metric APIs #760
Comments
Not much feedback to date. This may be because I published this article not so long ago, or because we have already discussed this internally. I will wait a little longer to make sure everybody has enough time to provide feedback. In the meantime, I published a PR: #767 That PR makes code changes described here (except the public website doc changes which are not in this repo). We can update the PR as the discussion here progresses. However, let us please be mindful of the release timelines. |
Sorry for delay. Copying my reply from PR below. Just to summarize - I believe making this change now will make more harm than good. We want to keep a way for advanced users to send
|
Update to 2.8.0-beta2 of base wek. Bump version to 2.5.0-beta2
This issue is stale because it has been open 300 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
Metrics should always be pre-aggregated across a time period before being sent.
Applications emit metrics when they observe numerical values, however, the user is not usually interested in every single value, but instead in a statistical summary over some time period (e.g., the average measurement value over a minute interval). Applications Insights and Azure Monitoring uses Metric Telemetry data items to support this use case. Azure Monitoring APIs are always aggregating. Metric values are always aggregated and queries are only possible for specific time buckets and not for specific values tracked originally.
On contrary, Applications that are interested in actually observed values, without aggregation across time, need to be using Event Telemetry data items. Such items contain fields for custom measurements. These measurements are available for analytical queries, plots and the-like, but they are not available as Azure Monitor metrics by default.
In a recent SDK Beta we shipped APIs that support metric pre-aggregation by default. Users can track individual values, potentially many thousand times per second. The values are not sent immediately, but aggregated into aggregates, containing statistical summaries over time periods. These aggregates are sent at regular time intervals.
The Application Insights SDK also contains legacy APIs that incorrectly encourage users to misuse the above application model and to send non-aggregated metric values to the ingestion endpoints. Now, we want to deprecate such APIs:
MetricTelemetry
ctors that take only a single metric value will be deprecated. Users should useTelemetryClient.GetMetric(..)
andMetric.[Try]TrackValue(..)
overloads to track values. (However, some expert users may choose to implement their own pre-aggregation subsystems. To support such cases, theMetricTelemetry
ctors that takes statistical summary values remain publicly available.)TelemetryClient.TrackMetric(..)
overloads will be deprecated. Existing application code that uses those methods will receive warnings during recompilation. Such warnings will contain descriptive messages on transitioning to theGetMetric(..)
APIs. The few expert users who choose to implement their own aggregation subsystems may use the unspecificTelemetryClient.Track(ITelemetry)
method to track their custom aggregates.Update documentation. Specifically, https://docs.microsoft.com/en-us/azure/application-insights/app-insights-api-custom-events-metrics#trackmetric. (What else?)
We have previously discussed these changes at length and agreed on this strategy with the SDK architects and the Metrics work group. This atricle is to facilitate a broader discussion before proceeding with the changes. In particular, the changes will ensure:
TrackMetric(..)
methods.TrackMetric(..)
uses and that a helpful resolution message is provided.Thank you for your feedback.
The text was updated successfully, but these errors were encountered: