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

Metrics API in azure-core and otel implementation #29086

Merged
merged 25 commits into from
Jul 25, 2022

Conversation

lmolkova
Copy link
Member

@lmolkova lmolkova commented May 25, 2022

Fixes #25603 and #25604

Context: https://gist.github.com/lmolkova/b9004307a09be788af04f05ebe22ad3c

Introduces metrics API in azure-core and its implementation in azure-core-metrics-opentelemetry.
Micrometer-based implementation is included as a sample.

Micro-benchmarks: <100 ns per measurement (~30 of them in Instant.now()x2), no allocations

Benchmark                                                                 Mode  Cnt   Score   Error  Units
OpenTelemetryMetricsBenchmark.basicHistogram                              avgt    6  75.781 ±  4.055  ns/op
OpenTelemetryMetricsBenchmark.basicHistogramWithCommonAndExtraAttributes  avgt    6  92.401 ±  6.281  ns/op
OpenTelemetryMetricsBenchmark.basicHistogramWithCommonAttributes          avgt    6  85.797 ± 16.855  ns/op
OpenTelemetryMetricsBenchmark.disabledNotOptimizedMetrics                 avgt    6  30.738 ±  2.421  ns/op
OpenTelemetryMetricsBenchmark.disabledOptimizedMetrics                    avgt    6   0.460 ±  0.013  ns/op
OpenTelemetryMetricsBenchmark.noopMeterProviderNotOptimized               avgt    6  33.055 ±  2.987  ns/op

Perf-tests: EvenHubs producer test ~6% overhead, need more work to properly measure:

Completed 56,180 operations in a weighted-average of 305.26s (184.04 ops/s, 0.005 s/op) - metrics off
Completed 60,923 operations in a weighted-average of 307.40s (198.19 ops/s, 0.005 s/op) - metrics on

EventHubs advanced usage prototype (perf-tested above):

https://github.com/lmolkova/azure-sdk-for-java/blob/9bc8e11b420ca91ad8760283a064044e88781d3a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProducerAsyncClient.java#L601

https://github.com/lmolkova/azure-sdk-for-java/blob/metrics-api-proto/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubsMetricProducerMetricHelper.java

@azure-sdk
Copy link
Collaborator

API change check

APIView has identified API level changes in this PR and created following API reviews.

azure-core

Copy link
Member

@srnagar srnagar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lmolkova lmolkova merged commit fa20ab5 into Azure:main Jul 25, 2022
@stliu
Copy link
Member

stliu commented Jul 25, 2022

Thanks @lmolkova

@yiliuTo @saragluna FYI, now we are able to start the issue of enabling metrics in spring

@lmolkova
Copy link
Member Author

@stliu @yiliuTo @saragluna let me know if you need any help! Note that SDKs don't emit metrics yet, we just have API to start doing it, but stay tuned for AMQP metrics coming - I hope to have the first AMQP metrics (from core) coming next month.

@stliu stliu mentioned this pull request Aug 15, 2022
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure.Core azure-core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Design Metrics API
7 participants