Commit Graph

21 Commits

Author SHA1 Message Date
Lalit Kumar Bhasin d2e728914d
[SDK] Use shared_ptr internally for AttributesProcessor to prevent use-after-free (#3457)
* fix

* fix

* add test

* fix

* iwuc
2025-06-03 10:40:10 -07:00
Doug Barker 92dd28c2cb
[SDK] support aggregation of identical instruments (#3358)
* use the existing storage for sync or async instruments of the same name. add tests

* add hash and name case insensitive hash for InstrumentDescriptor. Update storage registry to use the hash and equality structs. Add tests.

* don't allocate heap in the hash. fix some ci failures

* fix a few more ci failures.

* move the instrument descriptor ostream operator to meter.cc to not leak the ostream header and keep the meter instrument creation warning implementation in the same file

* adds instrument descriptor tests

* add comments

* Move case-insensitive equals method and IsDuplicate method into InstrumentDescriptorUtils struct. Add log streamable wrappers for scopes and instrument descriptors. Add tests for correcitve views for name and description duplicates

* fix iwyu errors

* duplicate instrument log message improvements to match spec. minor test additions/cleanup

* changelog entry

* address review feedback. Add Ascii to the name of the instrument util case-insensitive equal function

* address feedback: short circuit the instrument descriptor CaseInsensitiveAsciiEquals and IsDuplicate checks

* fix comments

---------

Co-authored-by: Tom Tan <lilotom@gmail.com>
Co-authored-by: Marc Alff <marc.alff@oracle.com>
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2025-05-09 05:53:05 +00:00
Pranav Sharma a7f9daf4cf
[SDK] Add meter scope configurator (#3268) 2025-02-21 12:10:14 +01:00
Marc Alff e5a1a15296
[Code Health] Include what you use, part 6 (#3216) 2025-01-08 10:31:06 +01:00
Marc Alff d15da3b256
[Code health] Include what you use cleanup, part 5 (#3140) 2024-11-27 11:57:47 +01:00
Marc Alff c6d394547b
[Code Health] include-what-you-use cleanup, part 4 (#3040) 2024-09-11 21:05:32 +02:00
Punya Biswal 7f785b5d5c
[TEST] Add missing tests to Bazel build (#3045)
* Fix overflow in timeout logic

Also use steady clock consistently.

Prior to this change, the test would fail under ASAN:

bazel test --config=asan --test_output=errors //sdk/test/metrics:meter_provider_sdk_test
INFO: Analyzed target //sdk/test/metrics:meter_provider_sdk_test (0 packages loaded, 0 targets configured).
FAIL: //sdk/test/metrics:meter_provider_sdk_test (see /private/var/tmp/_bazel_punya/e3bd968ba61238cdeb1a5537fc3dbf7d/execroot/_main/bazel-out/darwin_arm64-fastbuild-asan/testlogs/sdk/test/metrics/meter_provider_sdk_test/test.log)
INFO: From Testing //sdk/test/metrics:meter_provider_sdk_test:
==================== Test output for //sdk/test/metrics:meter_provider_sdk_test:
Running main() from gmock_main.cc
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from MeterProvider
[ RUN      ] MeterProvider.GetMeter
[Warning] File: sdk/src/metrics/meter_provider.cc:65 [MeterProvider::GetMeter] Library name is empty.
[Warning] File: sdk/src/metrics/meter_provider.cc:65 [MeterProvider::GetMeter] Library name is empty.
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__chrono/duration.h:102:59: runtime error: signed integer overflow: 9221646818050376183 * 1000 cannot be represented in type '_Ct' (aka 'long long')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__chrono/duration.h:102:59 in 
================================================================================
INFO: Found 1 test target...
Target //sdk/test/metrics:meter_provider_sdk_test up-to-date:
  bazel-bin/sdk/test/metrics/meter_provider_sdk_test
INFO: Elapsed time: 2.251s, Critical Path: 2.13s
INFO: 5 processes: 5 darwin-sandbox.
INFO: Build completed, 1 test FAILED, 5 total actions
//sdk/test/metrics:meter_provider_sdk_test                               FAILED in 0.6s
  /private/var/tmp/_bazel_punya/e3bd968ba61238cdeb1a5537fc3dbf7d/execroot/_main/bazel-out/darwin_arm64-fastbuild-asan/testlogs/sdk/test/metrics/meter_provider_sdk_test/test.log

Executed 1 out of 1 test: 1 fails locally.

Fix overflow in periodic_exporting_metric_reader

* Add missing tests to Bazel build by globbing test files

Previously, we were missing
* instrument_metadata_validator_test
* observable_registry_test
* cardinality_limit_test
* periodic_exporting_metric_reader_test
And there were no checks in place to prevent things from getting worse.

Remove unnecessary exception checks in attributes_hashmap_test,
which simplifies the build and CI script.

Resolve symbol collision using anonymous namespaces.

---------

Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2024-09-03 21:08:37 +02:00
Siddhartha Malladi eb2b9753ea
[Code Health] clang-tidy cleanup, part 1 (#2990) 2024-07-11 11:45:17 +02:00
Lalit Kumar Bhasin 7c0826efe0
Add benchmark tests for Sum Aggregation #1949 (#1948) 2023-02-22 20:18:12 +00:00
Ehsan Saei b8b715faf9
[Metrics SDK] Cleanup ENABLE_METRICS_PREVIEW (#1735) 2022-11-06 21:03:08 +00:00
Ehsan Saei 9b8a4dcdc7
[Metrics API/SDK] Change Meter API/SDK to return nostd::unique_ptr for Sync Instruments (#1707) 2022-10-25 19:02:05 +02:00
Ehsan Saei 7fd76eec7d
[Metrics] Switch to explicit 64 bit integers (#1686) 2022-10-25 16:57:49 +02:00
Marc Alff f29703b21c
Fixes #249 (#1677)
Fixed many remaining compiler warnings.
2022-10-13 20:56:17 +02:00
Lalit Kumar Bhasin 99f2ba4e34
Fix #1663 Threading issue between Meter::RegisterSyncMetricStorage and Meter::Collect (#1666) 2022-10-11 10:58:07 -07:00
Marc Alff c7dfc0de26
Fix build warnings (#1613) 2022-09-14 16:32:56 +02:00
Lalit Kumar Bhasin ad23f20392
METRICS SDK - Calling Observable Instruments callback during metrics collection (#1554) 2022-08-15 16:19:34 -07:00
Lalit Kumar Bhasin e58524c49a
Move old metrics implementation to different directory, and rename targets to *_deprecated (#1053)
Co-authored-by: Tom Tan <Tom.Tan@microsoft.com>
2021-11-05 14:25:22 -07:00
Lalit Kumar Bhasin 3fa6525f40
Add missing Copyright headers (#754) 2021-05-25 11:37:08 +05:30
Lalit Kumar Bhasin b696e11b7c
Add preview feature-flag/macro for metrics (#745) 2021-05-14 14:37:28 +05:30
Karen Xu f2708921be
Move KeyValueIterable and KeyValueIterableView from trace to common (#363) 2020-10-17 20:10:44 -07:00
Brandon Kimberly 6f6978d840
Add Meter SDK Class (#212) 2020-08-05 18:58:50 -07:00