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

[EXAMPLES] Improve readme of Metrics example #2510

Merged
merged 2 commits into from
Jan 25, 2024
Merged
Changes from all commits
Commits
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
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.