Commit Graph

286 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
Marc Alff b4254a4acf
[EXPORTER] ostream log exporter, fix memory ownership issues (#3417) 2025-05-21 13:29:02 +02:00
Doug Barker 165983a128
[CMAKE] remove global include_directories usage and rely on target properties (#3426) 2025-05-20 23:44:47 +02: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
Pranav Sharma d976876feb
[API] Add Enabled method to Tracer (#3357) 2025-04-22 07:13:52 -07:00
Tom Tan 3bd8de9702
[METRICS SDK] Fix hash collision in MetricAttributes (#3322) 2025-04-01 23:12:24 +02:00
Pranav Sharma d09bfbac57
[SDK] Add logger scope configurator (#3282) 2025-03-20 22:22:11 +01:00
IcySteam dee5b0bc5c
[SDK] Implement spec: MetricFilter (#3235) 2025-03-12 00:18:55 +01:00
WenTao Ou 3c4afd0696
[API] Deprecate event logger (#3285) 2025-02-25 10:36:31 +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
Pranav Sharma 52a80b5a04
[SDK] Add tracer scope configurator (#3137) 2025-01-30 21:27:36 +01:00
Marc Alff d2ff95acbc
[CI] Add GRPC in maintainer CI (#3248) 2025-01-21 15:21:30 +01:00
Alex E. 25f7a13f6f
[EXPORTER] Support handling retry-able errors for OTLP/HTTP (#3223) 2025-01-17 16:35:19 +01:00
Doug Barker 02cda5103f
[SDK] enable deriving from ResourceDetector to create a Resource (#3247) 2025-01-16 18:38:05 +01:00
WenTao Ou 95baed7158
[SDK] Fix lifetime of GlobalLogHandler (#3221) 2025-01-15 21:18:26 +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
Marc Alff f7a9aea063
[SEMANTIC CONVENTIONS] Migration to weaver (#3105) 2024-11-13 19:14:12 +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
Weipeng Hong deed1e3a0c
[SDK] Fix memory leak in TlsRandomNumberGenerator() constructor (#2661) 2024-07-19 20:13:04 +02: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
Marc Alff 7aea1a6a94
[SEMANTIC CONVENTIONS] Rework on semantic conventions 1.25.0 (#2640) 2024-04-18 00:41:38 +02:00
Ehsan Saei 8f15440b45
[SEMANTIC CONVENTIONS] Upgrade to semantic convention 1.25.0 (#2633) 2024-04-16 23:29:10 +02:00
Marc Alff 78947b2ab1
[SDK] DefaultLogHandler to print errors to std::cerr, add LogLevel::None (#2622) 2024-04-13 17:20:11 +02:00
Willie Abrams 14f7542c18
[SDK] Support for OTEL_SERVICE_NAME (#2577) 2024-03-06 01:24:41 +01: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
Marc Alff 423ecacdf6
[PROTO] Upgrade to opentelemetry-proto v1.1.0 (#2488) 2024-01-16 23:49:59 +01:00
Lalit Kumar Bhasin 48e633e740
[API] Create root span with active span (#2427) 2023-12-06 00:26:16 +01: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
Tom Tan 86ee88615b
[SDK] Fix GetLogger with empty library name (#2398) 2023-11-10 10:53:12 +01:00