Commit Graph

136 Commits

Author SHA1 Message Date
Marc Alff 545f9f4108
[CodeHealth] fix include-what-you-use, part 8 (#3465) 2025-06-09 10:23:10 +02:00
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 2faa400782
[SDK] Fix Base2ExponentialHistogramAggregation Merge with empty buckets (#3425) 2025-05-20 08:52:56 +02: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
Yash Tibrewal 4e4d8de860
[Metrics SDK] Use nostd::function_ref in AttributesHashMap (#3393) 2025-05-08 23:26:50 +00:00
Tom Tan a145a56880
[TEST] Add stress test for histogram metric for multiple threads validation (#3388) 2025-05-03 10:56:25 +02:00
ethan 7bf114913d
Base2 exponential histogram aggregation (#3346)
* add base2 expo histo aggregation

* add base2 expo histo, test, benchmark

* add prom, otlp exporter and example

* add ostream exporter and example

* update vscode launch

* run tools/format.sh

* add grpc exporter target switch for unix sockets

* Added ConvertExponentialHistogramMetric unit test

* Update the osstream_metric_test with ExponentialHistogram

* update CHANGELOG.md

* markdown lint

* Comment non-used function add missing includes

* add metrics dependency to otlp exporters test build

* run format

* remove unused function definition

* Added empty line in the end of a test file and removed comments

* Fix windows build errors

* fix iwyu warnings

* add comment to trigger pr update

* fix additional iwyu warnings

* Fix iwyu warning

* Fix include order in base2_exponential_histogram_aggregation.h

* Add kcumulative and kdelta aggregation temporality test with collect calls for base2 histogram aggregation

* add prelim bucketing checks

* Tested the exp2 constructor with point data

* Fix missing include in sync histogram test

* move diff and merge to use union of all buckets approach

* make get a const method

* update base2 expo hiso diff test

* add base2 expo histo test with sync storage collect

* uncomment examples

* format

* use static_cast

* fix comments

* update changelog

* Fix comments and errors in the pipeline

* Update sdk/src/metrics/aggregation/base2_exponential_histogram_aggregation.cc

Co-authored-by: Tom Tan <lilotom@gmail.com>

* remove unused code

* set max_buckets minimum to 2

* Revert otlp grpc client changes

Propose change in follow up PR

* [wip] make buckets unique ptr

* refactor unique_ptr for buckets with deep copies

* format

* update otlp serialization test with unique ptr

* format

* Small pipeline fixes

* iwyu fix

* remove boundary and format

---------

Co-authored-by: Ruslan Nigmatullin <euroelessar@gmail.com>
Co-authored-by: Felipe C. Dos Santos <felipe.santos.k@gmail.com>
Co-authored-by: Tom Tan <lilotom@gmail.com>
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
Co-authored-by: Felipe C. Dos Santos <42920697+felipesantosk@users.noreply.github.com>
2025-04-25 18:13:23 +00:00
Tom Tan 3bd8de9702
[METRICS SDK] Fix hash collision in MetricAttributes (#3322) 2025-04-01 23:12:24 +02:00
IcySteam dee5b0bc5c
[SDK] Implement spec: MetricFilter (#3235) 2025-03-12 00:18:55 +01:00
Pranav Sharma a7f9daf4cf
[SDK] Add meter scope configurator (#3268) 2025-02-21 12:10:14 +01:00
Marc Alff 5bc053e522
[SDK] Support OTEL_SDK_DISABLED environment variable (#3245) 2025-02-05 21:42:51 +01:00
Marc Alff e5a1a15296
[Code Health] Include what you use, part 6 (#3216) 2025-01-08 10:31:06 +01:00
Doug Barker 92bf8daad5
[SDK] Fix include instrumentation scope attributes in equal method (#3214) 2024-12-18 21:13:44 +01:00
Marc Alff d15da3b256
[Code health] Include what you use cleanup, part 5 (#3140) 2024-11-27 11:57:47 +01:00
uuzay f30ab925c8
[API] Add synchronous gauge (#3029)
* Add synchronous gauge

* Add ABI Version macro, update tests

* Fix function description

* Fix formatting

* Remove ABI macros from SDK.

* Add error log for gauge delta temporality.

* Fix formatting

* Apply suggestions from code review

Move kGauge to the end, for better ABI compatibility.

---------

Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
Co-authored-by: Marc Alff <marc.alff@free.fr>
2024-10-30 22:34:25 +01:00
Punya Biswal 7b824738c3
[SDK] Update MetricProducer interface to match spec (#3044)
Following https://github.com/open-telemetry/opentelemetry-specification/blob/v1.36.0/specification/metrics/sdk.md#metricproducer.

Updates #1831
2024-10-01 22:29:22 +02: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 a71642fe67
[Code Health] Clang Tidy cleanup, Part 2 (#3038) 2024-08-25 19:58:32 +02:00
Lalit Kumar Bhasin 1203bcf264
[SDK] Support empty histogram buckets (#3027)
* support empty buckets

* Update histogram_test.cc

* Update histogram_test.cc

* test for negative values

* fix count
2024-08-14 17:47:59 +00:00
WenTao Ou 4520aa598b
[SDK] Fix crash in `PeriodicExportingMetricReader`. (#2983) 2024-07-19 12:12:48 +02:00
Lalit Kumar Bhasin d8ae09e53d
[Metrics SDK] Fix hash calculation for nostd::string (#2999)
* add test to validate cardinaity limit

* format

* warning

* Format

* maint mode CI

* modify test to reproduce the issue

* Format

* remove vscode settings

* remove redundant test

* remove unused code

* fix to calculate hash on string_view

* remove iostream

* template specialization for const char *, and varous string type tests

* unused variable warning

* more warnings

* format

* fix use-after-stack-scope

* format

* another try

* format

---------

Co-authored-by: Tom Tan <Tom.Tan@microsoft.com>
2024-07-17 07:00:20 -07:00
Siddhartha Malladi eb2b9753ea
[Code Health] clang-tidy cleanup, part 1 (#2990) 2024-07-11 11:45:17 +02:00
Harish e1d96901fc
[Code health] Remove Unicode Text from Source files (#2707)
Signed-off-by: perhapsmaple <140232061+perhapsmaple@users.noreply.github.com>
2024-06-20 09:20:57 +02:00
Marc Alff c42dcca9f8
[CI] Upgrade to clang-format 18 (#2684) 2024-05-29 22:01:06 +02:00
Tom Tan 2d077f8ec5
Update ExemplarFilter and ExemplarReservoir for spec (#2372) 2024-04-29 13:14:06 -07:00
Keith Smiley eaaf6cd602
Fix old style cast warning (#2567)
Fixes https://github.com/open-telemetry/opentelemetry-cpp/issues/2556
2024-02-28 23:01:19 +01:00
Lalit Kumar Bhasin cf5cdaae86
Fix attribute filtering for synchronous instruments. (#2472) 2024-02-08 13:02:25 -08:00
Kyle L a86f8f094a
[BUILD] Improve the handling of OPENTELEMETRY_HAVE_WORKING_REGEX. (#2430) 2023-12-05 20:39:39 +01:00
Tom Tan 064fef0d87
[Metrics] Make context optional for histogram instruments in Metrics SDK (#2416) 2023-11-29 09:45:09 -08:00
Lalit Kumar Bhasin 9b89843553
[SDK] Cardinality limits for metrics streams (Sync Instruments + Delta Temporality) (#2255) 2023-11-21 10:06:06 +01:00
Lalit Kumar Bhasin d9ad76f6be
[SDK] Creating DoubleUpDownCounter with no matching view (#2379) 2023-10-19 11:28:12 +02:00
Marc Alff e918960e06
[BUILD] Remove WITH_REMOVE_METER_PREVIEW, use WITH_ABI_VERSION_2 instead (#2370) 2023-10-16 22:07:47 +02:00
Marc Alff c3c643a597
[API] Add InstrumentationScope attributes in MeterProvider::GetMeter() (#2224) 2023-09-30 10:08:02 +02:00
Tom Tan 13f01cae93
Add exemplar reservoir to async metric storage (#2319) 2023-09-21 22:41:18 +02:00
Lalit Kumar Bhasin 0563a71ce3
Fix Observable Counters/UpDownCounters (#2298) 2023-09-18 12:57:28 -07:00
Marc Alff 44096c8072
[SDK] Allow metric instrument names to contain / characters (#2310) 2023-09-14 18:44:01 +02:00
Marc Alff f52ec6cade
[SDK] Increase metric name maximum length from 63 to 255 characters (#2284) 2023-08-31 17:17:26 +02:00
Lalit Kumar Bhasin a15a9b8101
[Metrics SDK] Add unit to Instrument selection criteria (#2236) 2023-07-20 20:53:32 +02:00
Marc Alff 1111f3409f
[API] Remove Meters (#2205) 2023-07-10 10:48:57 +02:00
Cengizhan Pasaoglu cfcda5728e
[SDK] Header files cleanup, use forward declarations (#2182) 2023-06-21 00:11:31 +02:00
Ruslan Nigmatullin d233b9bc1a
[SDK] Add benchmark for base2 exponential histogram indexer (#2181) 2023-06-07 09:07:01 +02:00
Ruslan Nigmatullin 082bb93098
[SDK] Add base2 exponential histogram indexer (#2173) 2023-06-03 10:52:39 +02:00
Ruslan Nigmatullin f5fd9062de
[SDK] Add AdaptingCircularBufferCounter for exponential histograms (#2158) 2023-06-01 09:14:39 +02:00
davidmandle e71e28c2d7
Use sdk_start_ts for MetricData start_ts for instruments having cumulative aggregation temporality. (#2086)
Co-authored-by: Marc Alff <marc.alff@oracle.com>
2023-04-12 16:32:38 +02:00
Lalit Kumar Bhasin bd7a3c7b41
[Metrics SDK] Implement Forceflush for Periodic Metric Reader (#2064) 2023-03-27 15:14:27 -07:00
Lalit Kumar Bhasin da333f8eba
[Metrics SDK] Performance improvement in measurement processing (#1993) 2023-03-04 04:59:42 +00:00
Lalit Kumar Bhasin 7c0826efe0
Add benchmark tests for Sum Aggregation #1949 (#1948) 2023-02-22 20:18:12 +00:00
Lalit Kumar Bhasin 01eac4ca9c
fix variable names (#1987) 2023-02-17 02:32:53 +00:00
Marc Alff 6925fc4751
Fixed copyright for every file under sdk. (#1961) 2023-02-06 20:14:19 -08:00