Skip to content

Commit

Permalink
[EXAMPLES] Improve readme of Metrics example (#2510)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomsonTan authored Jan 25, 2024
1 parent 8da71b7 commit 14b74b9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions examples/metrics_simple/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Simple Metrics Example

See [INSTALL.md](../../INSTALL.md) for instructions on building and
running the example.

This example initializes the metrics pipeline with 3 different instrument types:

- [Counter](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#counter)
Expand Down Expand Up @@ -44,8 +47,9 @@ custom aggregation config, and attribute processor. Metrics SDK will implicitly
create a missing view with default mapping between Instrument and Aggregation.

```cpp
std::string counter_name = "counter_name";
std::unique_ptr<metric_sdk::InstrumentSelector> instrument_selector{
new metric_sdk::InstrumentSelector(metric_sdk::InstrumentType::kCounter, "counter_name")};
new metric_sdk::InstrumentSelector(metric_sdk::InstrumentType::kCounter, counter_name)};
std::unique_ptr<metric_sdk::MeterSelector> meter_selector{
new metric_sdk::MeterSelector(name, version, schema)};
std::unique_ptr<metric_sdk::View> sum_view{
Expand Down Expand Up @@ -111,6 +115,3 @@ Ensure to keep the Instrument object active for the lifetime of collection.
auto counter = meter->CreateDoubleObservableCounter(counter_name);
counter->AddCallback(MeasurementFetcher::Fetcher, nullptr);
```

See [INSTALL.md](../../INSTALL.md) for instructions on building and
running the example.

2 comments on commit 14b74b9

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'OpenTelemetry-cpp exporters Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 14b74b9 Previous: 8da71b7 Ratio
BM_OtlpExporterEmptySpans 68.9616832756907 ns/iter 22.426787754831366 ns/iter 3.07

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

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.

Benchmark suite Current: 14b74b9 Previous: 8da71b7 Ratio
BM_BaselineBuffer/1 6434786.319732666 ns/iter 1592209.1007232666 ns/iter 4.04
BM_LockFreeBuffer/1 1676778.3164978027 ns/iter 720934.8678588867 ns/iter 2.33

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.