Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Boten <[email protected]>
  • Loading branch information
codeboten committed Dec 4, 2024
1 parent 7661cd6 commit b4eb435
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sdk/metric/internal/x/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ To help users avoid performing computationally expensive operations when recordi
The following code shows an example of how to check if an instrument implements the `EnabledInstrument` interface before using the `Enabled` function to avoid doing an expensive computation:

```go
type enabledInstrument interface { Enabled() bool }
type enabledInstrument interface { Enabled(context.Context) bool }

ctr, err := m.Int64Counter("expensive-counter")
c, ok := ctr.(enabledInstrument)
if c.Enabled() {
if !ok || c.Enabled(context.Background()) {
c.Add(expensiveComputation())
}
```
Expand Down

0 comments on commit b4eb435

Please sign in to comment.