-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add custom_dimensions using kwargs instead of args #837
Conversation
The CircleCI tests seem to be failing on |
@lzchen, do you want to me also keep the deprecated args implementation as well? I can add it, and print out a warning message about new functionality |
contrib/opencensus-ext-azure/examples/logs/contextual_logging.py
Outdated
Show resolved
Hide resolved
contrib/opencensus-ext-azure/examples/logs/contextual_logging.py
Outdated
Show resolved
Hide resolved
contrib/opencensus-ext-azure/examples/logs/contextual_logging.py
Outdated
Show resolved
Hide resolved
|
@xinyi-joffre |
@xinyi-joffre |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xinyi-joffre
Actually now that I think about it, introducing these classes in the examples might cause confusion to users (they might assume these exist as features). I think it will be better to remove this example file.
Okay, no worries, I will remove the contextual_logging.py example
I also realized that opencensus also uses 'attributes' in tracing for contextual information. Do you like the custom_dimensions name (since it matches the Application Insights field name)? Or should I change it to something simpler like attributes, properties, etc.? |
@xinyi-joffre |
@xinyi-joffre |
@lzchen this PR is ready to go, and passed the checks! Please let me know if you want me to fix anything else :). I can also help update the docs.microsoft.com entry for this once this is released. |
@xinyi-joffre |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR allows users to add customDimensions to their logs for both traces and exceptions. This approach was discussed in #834 before implementing.
As a part of this shift, it will break the changes introduced as part of #822. However, the new implementation allows for a smoother transition for those wanting to keep existing logging functionality with string interpolation and args. In addition, this PR adds support for exceptions which was not covered as part of the previous implementation.
Usage:
Once this data is uploaded to App Insights, you can search in the traces and exceptions table by keys included in the customDimensions column like this:
Finally, this PR also contains contextual logging examples, for those who need to add context to a large number of logs without needing to add the
extra=
keyword to each log statement.