Skip to content

Commit

Permalink
Specify optional Exponential Histogram Aggregation, add example code …
Browse files Browse the repository at this point in the history
…in the data model (open-telemetry#2252)
  • Loading branch information
jmacd authored and beeme1mr committed Aug 31, 2022
1 parent 935d38f commit 43521e5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions specification/metrics/data-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,21 @@ func MapToIndexScale0(value float64) int {
}
```

Implementations are permitted to round subnormal values up to the
smallest normal value, which may permit the use of a built-in function:

```golang

func GetExponent(value float64) int {
// Note: Frexp() rounds submnormal values to the smallest normal
// value and returns an exponent corresponding to fractions in the
// range [0.5, 1), whereas we want [1, 2), so subtract 1 from the
// exponent.
_, exp := math.Frexp(value)
return exp - 1
}
```

##### Negative Scale: Extract and Shift the Exponent

For negative scales, the index of a value equals the normalized
Expand Down

0 comments on commit 43521e5

Please sign in to comment.