Skip to content

Commit

Permalink
Add support for int32 in attribute.Any (#2169)
Browse files Browse the repository at this point in the history
* Support int32 for Any func in attribute pkg

* Add changes to changelog

* Update PR number in CHANGELOG.md
  • Loading branch information
MrAlias authored Aug 11, 2021
1 parent 2b0e139 commit 5d25c4d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

- The `fromEnv` detector no longer throws an error when `OTEL_RESOURCE_ATTRIBUTES` environment variable is not set or empty. (#2138)
- Setting the global `ErrorHandler` with `"go.opentelemetry.io/otel".SetErrorHandler` multiple times is now supported. (#2160, #2140)
- The `"go.opentelemetry.io/otel/attribute".Any` function now supports `int32` values. (#2169)

### Security

Expand Down
4 changes: 1 addition & 3 deletions attribute/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ func Any(k string, value interface{}) KeyValue {
return Array(k, value)
case reflect.Bool:
return Bool(k, rv.Bool())
case reflect.Int, reflect.Int8, reflect.Int16:
return Int(k, int(rv.Int()))
case reflect.Int64:
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
return Int64(k, rv.Int())
case reflect.Float64:
return Float64(k, rv.Float())
Expand Down

0 comments on commit 5d25c4d

Please sign in to comment.