User Properties
Learn how to set user properties in your traces
Introduction
HoneyHive allows you to set user properties in your traces to gain more insights into your application.
Prerequisites
You have already set tracing for your code as described in our quickstart guide.
Setting
You can set on both the trace level or the span level. If the applies to the entire trace, then set it on the trace level. If the applies to a specific span, then set it on the span level. For more details, refer to the enrich traces documentation.
In Python, you can use the enrich_session
function to set on the trace level.
To pass to HoneyHive, pass it to the param in the enrich_session
function. This function is used to enrich the session with additional information. Remember that enrich_session
will update, not overwrite, the existing object on the trace.
Read more about the enrich_session
function in the Python SDK reference.
Here’s an example of how to set on the trace level in Python:
In Python, you can use the enrich_session
function to set on the trace level.
To pass to HoneyHive, pass it to the param in the enrich_session
function. This function is used to enrich the session with additional information. Remember that enrich_session
will update, not overwrite, the existing object on the trace.
Read more about the enrich_session
function in the Python SDK reference.
Here’s an example of how to set on the trace level in Python:
In TypeScript, you can use the tracer.enrichSession
function to set on the trace level.
To pass to HoneyHive, pass it to the param in the tracer.enrichSession
function. This function is used to enrich the session with additional information. Remember that tracer.enrichSession
will update, not overwrite, the existing object linked to the trace.
Read more about the tracer.enrichSession
function in the TypeScript SDK reference.
Here’s an example of how to set on the trace level in TypeScript:
Previously, enrichment involved calling methods directly on the tracer
instance (e.g., tracer.enrichSession()
). While this pattern still works, it is now deprecated and will be removed in a future major version.
Please update your code to use the imported enrichSession
function along with the tracer.trace()
wrapper as shown in the example above. This new approach provides a consistent pattern with span-level tracing and enrichment.
Example of the deprecated pattern:
Concepts
What are User Properties?
User properties are additional attributes that you can set on your traces to gain more insights into your application.
Examples include:
- User ID
- User email
- User properties
- User payment plan details
- User experiment group
User properties can help you link traces to specific users, improving your ability to group and filter traces using user-centric attributes.
SDK Reference
Read more about the enrich_session
function in the Python SDK reference.