When using Smithy tracing APIs, you can set key-value pairs in a smithy.Properties container. These pairs are automatically propagated to the underlying OTEL SDK.
Supported Types
The adapter natively supports the following attribute types (and their slice variants):
boolintint64float64string
Key and Value Stringification
If a key is a string and the value is one of the supported types above, it is passed directly. For other types, the adapter follows these rules:
- If the value implements the
String() method, that value is used. - Otherwise, the adapter uses the Go-string representation via
fmt.Sprintf("%#v", ...).
Example of key stringification behavior:
type key struct{}
func (k key) String() string { return "app.key" }
type key2 struct{}
// (No String() method)
// Inside a tracing context:
o.Properties.Set("app.version", "bar") // Result: ("app.version", "bar")
o.Properties.Set(key{}, "baz") // Result: ("app.key", "baz")
o.Properties.Set(key2{}, "qux") // Result: ("main.key2{}", "qux")