Skip to content

Commit

Permalink
example/metric : Make build and run instructions example agnostic.
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscovalentecastro committed Mar 25, 2024
1 parent 6b66782 commit aadd0dc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
8 changes: 2 additions & 6 deletions example/metric/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,15 @@ Once you ensure the API is enabled, then build the example application and run t
2. Exporting metrics via the OpenTelemetry Collector - [collector](./collector/).
3. Exporting histogram metrics via the SDK - [exponential_histogram](./exponential_histogram/).

Change the current directory to the example you wish to run, for example `cd sdk`, and then run the example using following commands:
Change the current directory to the example you wish to run, e.g. `cd sdk` or `cd exponential_histogram`, and then run the example using following commands:

```
$ go build -o metrics
$ ./metrics
2020/06/11 21:11:15 Most recent data: counter 110, observer 13.45
2020/06/11 21:11:15 Most recent data: counter 160, observer 16.02
2020/06/11 21:11:15 Most recent data: counter 134, observer 14.33
2020/06/11 21:11:15 Most recent data: counter 125, observer 15.12
...
```

To ensure you have enough data to create interesting charts for the Counter and Observer metrics generated by the example, keep the application running for at least five minutes.
To ensure you have enough data to create interesting charts for the exported metrics generated by the example, keep the application running for at least five minutes.

*Note: For running the collector example, you need to have a locally running OpenTelemetry Collector, configured using the provided [sample config](./collector/sample-collector-config.yaml). Instructions for running OpenTelemetry Collector on your system can be found [here](https://opentelemetry.io/docs/collector/getting-started/#local).*

Expand Down
10 changes: 10 additions & 0 deletions example/metric/exponential_histogram/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ We explore the resulting distributions with three types of histograms :

Go to the [example/metric/README.md](../README.md) instructions that describe how to build and run all examples.

## Sample execution

```
$ ./metrics
2024/03/21 15:38:58 Sent Latency Data (Original Distribution): #points 1000 , mean 36.64255895183214, sdv 19.670797833645373
2024/03/21 15:38:58 Sent Latency Data (Shifted Distribution): #points 1000 , mean 277.70002931783233, sdv 143.59582355437485
2024/03/21 15:38:58 Sent Latency Data (Multimodal Distribution): #points 1000 , mean 151.49111863163805, sdv 159.2187295223318
...
```

## Create dashboard

When filling in the **Find resource type and metric box**, use the metric names with the prefix "workload.googleapis.com/latency_" to observe histogram metrics (for example "workload.googleapis.com/latency_a").
Expand Down
11 changes: 11 additions & 0 deletions example/metric/sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ This example shows how to use [`go.opentelemetry.io/otel`](https://pkg.go.dev/go

Go to the [example/metric/README.md](../README.md) instructions that describe how to build and run all examples.

## Sample execution

```
$ ./metrics
2020/06/11 21:11:15 Most recent data: counter 110, observer 13.45
2020/06/11 21:11:15 Most recent data: counter 160, observer 16.02
2020/06/11 21:11:15 Most recent data: counter 134, observer 14.33
2020/06/11 21:11:15 Most recent data: counter 125, observer 15.12
...
```

## Create dashboard

When filling in the **Find resource type and metric box**, use the metric names "custom.googleapis.com/opentelemetry/counter-a" and "custom.googleapis.com/opentelemetry/observer-a".
Expand Down

0 comments on commit aadd0dc

Please sign in to comment.