From 5d25c4d20ec88d3728e2621d818b05051ebec816 Mon Sep 17 00:00:00 2001
From: Tyler Yahn <MrAlias@users.noreply.github.com>
Date: Wed, 11 Aug 2021 09:32:00 -0700
Subject: [PATCH] Add support for int32 in attribute.Any (#2169)

* Support int32 for Any func in attribute pkg

* Add changes to changelog

* Update PR number in CHANGELOG.md
---
 CHANGELOG.md    | 1 +
 attribute/kv.go | 4 +---
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index f5b6d94a15de..1d49b2394dcb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
 
diff --git a/attribute/kv.go b/attribute/kv.go
index 2fcc8863f733..20cc29924a82 100644
--- a/attribute/kv.go
+++ b/attribute/kv.go
@@ -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())