-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable metric collection for Async Instruments - Delta and Cumulative (…
- Loading branch information
Showing
13 changed files
with
391 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
sdk/include/opentelemetry/sdk/metrics/state/temporal_metric_storage.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#pragma once | ||
#ifndef ENABLE_METRICS_PREVIEW | ||
# include "opentelemetry/sdk/metrics/state/attributes_hashmap.h" | ||
# include "opentelemetry/sdk/metrics/state/metric_collector.h" | ||
|
||
# include <memory> | ||
|
||
OPENTELEMETRY_BEGIN_NAMESPACE | ||
namespace sdk | ||
{ | ||
namespace metrics | ||
{ | ||
|
||
struct LastReportedMetrics | ||
{ | ||
std::unique_ptr<AttributesHashMap> attributes_map; | ||
opentelemetry::common::SystemTimestamp collection_ts; | ||
}; | ||
|
||
class TemporalMetricStorage | ||
{ | ||
public: | ||
TemporalMetricStorage(InstrumentDescriptor instrument_descriptor); | ||
|
||
bool buildMetrics(CollectorHandle *collector, | ||
nostd::span<std::shared_ptr<CollectorHandle>> collectors, | ||
opentelemetry::common::SystemTimestamp sdk_start_ts, | ||
opentelemetry::common::SystemTimestamp collection_ts, | ||
std::shared_ptr<AttributesHashMap> delta_metrics, | ||
nostd::function_ref<bool(MetricData)> callback) noexcept; | ||
|
||
private: | ||
InstrumentDescriptor instrument_descriptor_; | ||
|
||
// unreported metrics stash for all the collectors | ||
std::unordered_map<CollectorHandle *, std::list<std::shared_ptr<AttributesHashMap>>> | ||
unreported_metrics_; | ||
// last reported metrics stash for all the collectors. | ||
std::unordered_map<CollectorHandle *, LastReportedMetrics> last_reported_metrics_; | ||
|
||
// Lock while building metrics | ||
mutable opentelemetry::common::SpinLockMutex lock_; | ||
}; | ||
} // namespace metrics | ||
} // namespace sdk | ||
OPENTELEMETRY_END_NAMESPACE | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
9c734b3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible performance regression was detected for benchmark 'OpenTelemetry-cpp api Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold
2
.BM_ProcYieldSpinLockThrashing/2/process_time/real_time
0.4553000132242839
ms/iter0.21524297679128823
ms/iter2.12
This comment was automatically generated by workflow using github-action-benchmark.
9c734b3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible performance regression was detected for benchmark 'OpenTelemetry-cpp sdk Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold
2
.BM_BaselineBuffer/2
5075492.858886719
ns/iter1819069.3855285645
ns/iter2.79
This comment was automatically generated by workflow using github-action-benchmark.