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

Synchronous Metric collection (Delta , Cumulative) #1265

Merged
merged 39 commits into from
Mar 30, 2022
Merged
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
c08cf38
collector and reader
lalitb Mar 2, 2022
c729c6a
fix format, and memory corruption
lalitb Mar 2, 2022
f692e15
changes for metric flow
lalitb Mar 3, 2022
ffb54ee
fix bazel build
lalitb Mar 3, 2022
8ecf729
fix ostream exporter
lalitb Mar 3, 2022
18e4f27
Merge branch 'main' into metric-collector
lalitb Mar 3, 2022
ad471d0
build error on windows
lalitb Mar 3, 2022
9cc53a4
Merge branch 'metric-collector' of github.com:lalitb/opentelemetry-cp…
lalitb Mar 3, 2022
05c1a8d
initial commit
lalitb Mar 14, 2022
f0380a9
implement collect function
lalitb Mar 16, 2022
fc657f9
Merge branch 'main' into temporary-storage
lalitb Mar 16, 2022
e702e89
fix build
lalitb Mar 16, 2022
d12686e
Fix async test
lalitb Mar 16, 2022
884f636
fix spell
lalitb Mar 16, 2022
1874375
fix build
lalitb Mar 17, 2022
12ba367
Merge branch 'main' into temporary-storage
lalitb Mar 18, 2022
e011a2b
add comments
lalitb Mar 18, 2022
5ab4f75
comments
lalitb Mar 18, 2022
c30b234
temp add .gitpod.yml
lalitb Mar 22, 2022
618de73
fix format
lalitb Mar 22, 2022
66d7af0
fix
lalitb Mar 22, 2022
e49e7c4
remove temp files
lalitb Mar 22, 2022
da5eb93
fix gcc48 install
lalitb Mar 22, 2022
a102d7f
Merge branch 'main' into temporary-storage
lalitb Mar 22, 2022
0551aeb
comment metric exporter till MetricData is finalised
lalitb Mar 22, 2022
b5d3bd5
add gcc4.8 TODO
lalitb Mar 22, 2022
b4bac61
add gcc4.8 TODO
lalitb Mar 22, 2022
015757c
fix spelling cumulative
lalitb Mar 22, 2022
ae65b1d
add tests for sum aggregation, and fix issues
lalitb Mar 23, 2022
29ee87d
Merge branch 'main' into temporary-storage
lalitb Mar 23, 2022
4b31fd3
Fix
lalitb Mar 23, 2022
62d0e92
remove commented code
lalitb Mar 23, 2022
464abf7
Merge branch 'main' into temporary-storage
lalitb Mar 28, 2022
4c26336
fix merge conflict
lalitb Mar 29, 2022
cb1c5a4
review comments
lalitb Mar 29, 2022
0a62679
make Aggregation::Merge/Diff/ToPoint methods as const
lalitb Mar 29, 2022
6919d1d
Update sdk/src/metrics/state/sync_metric_storage.cc
lalitb Mar 29, 2022
cf3c272
more review comments
lalitb Mar 29, 2022
010d1bc
review comments
lalitb Mar 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix async test
  • Loading branch information
lalitb committed Mar 16, 2022

Verified

This commit was signed with the committer’s verified signature.
commit d12686ebbfee97eb88dac9dadb34dc6ea1a84f3d
23 changes: 17 additions & 6 deletions sdk/test/metrics/async_metric_storage_test.cc
Original file line number Diff line number Diff line change
@@ -17,6 +17,15 @@ using namespace opentelemetry::sdk::metrics;
using namespace opentelemetry::sdk::instrumentationlibrary;
using namespace opentelemetry::sdk::resource;

class MockCollectorHandle : public CollectorHandle
{
public:
AggregationTemporarily GetAggregationTemporarily() noexcept override
{
return AggregationTemporarily::kCummulative;
}
};

void measurement_fetch(opentelemetry::metrics::ObserverResult<long> &observer_result)
{
observer_result.Observe(20l);
@@ -28,14 +37,16 @@ TEST(AsyncMetricStorageTest, BasicTests)
auto metric_callback = [](MetricData &metric_data) { return true; };
InstrumentDescriptor instr_desc = {"name", "desc", "1unit", InstrumentType::kCounter,
InstrumentValueType::kLong};
auto instrumentation_library = InstrumentationLibrary::Create("instr_lib");
auto resource = Resource::Create({});
MetricCollector collector;
std::vector<MetricCollector *> collectors;

MockCollectorHandle collector;
std::vector<std::shared_ptr<CollectorHandle>> collectors;
auto sdk_start_ts = std::chrono::system_clock::now();
// Some computation here
auto collection_ts = std::chrono::system_clock::now() + std::chrono::seconds(5);

opentelemetry::sdk::metrics::AsyncMetricStorage<long> storage(
instr_desc, AggregationType::kSum, &measurement_fetch, new DefaultAttributesProcessor());
EXPECT_NO_THROW(storage.Collect(&collector, collectors, instrumentation_library.get(), &resource,
metric_callback));
EXPECT_NO_THROW(
storage.Collect(&collector, collectors, sdk_start_ts, collection_ts, metric_callback));
}
#endif