-
Notifications
You must be signed in to change notification settings - Fork 1.2k
RUM-10436: Add documentation to Logs global attributes #31282
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
base: master
Are you sure you want to change the base?
Conversation
ℹ️ Documentation Team ReviewNo documentation team review is required for this pull request. |
Preview links (active after the
|
b1846cb
to
75638f3
Compare
75638f3
to
6c7e361
Compare
```kotlin | ||
|
||
// This adds an attribute "version_code" with an integer value in all logs instance. |
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.
```kotlin | |
// This adds an attribute "version_code" with an integer value in all logs instance. | |
```kotlin | |
// This adds an attribute "version_code" with an integer value in all Logs instances. |
|
||
```kotlin | ||
|
||
// This adds an attribute "version_code" with an integer value in all logs instance. |
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.
// This adds an attribute "version_code" with an integer value in all logs instance. | |
// This adds an attribute "version_code" with an integer value in all Logs instances. |
// This adds an attribute "version_code" with an integer value in all logs instance. | ||
Logs.addAttribute("version_code", BuildConfig.VERSION_CODE) | ||
|
||
// This adds an attribute "version_name" with a String value in all logs instance. |
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.
// This adds an attribute "version_name" with a String value in all logs instance. | |
// This adds an attribute "version_name" with a String value in all Logs instances. |
To remove a global attribute from all Logs instances: | ||
|
||
```kotlin | ||
// This removes the attribute "version_code" from all logs instance. | ||
Logs.removeAttribute("version_code") | ||
|
||
// This removes the attribute "version_name" from all logs instance. | ||
Logs.removeAttribute("version_name") | ||
``` |
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.
To remove a global attribute from all Logs instances: | |
```kotlin | |
// This removes the attribute "version_code" from all logs instance. | |
Logs.removeAttribute("version_code") | |
// This removes the attribute "version_name" from all logs instance. | |
Logs.removeAttribute("version_name") | |
``` | |
To remove a global attribute from all Logs instances: | |
```kotlin | |
// This removes the attribute "version_code" from all Logs instances. | |
Logs.removeAttribute("version_code") | |
// This removes the attribute "version_name" from all Logs instances. | |
Logs.removeAttribute("version_name") |
{{< tabs >}} | ||
{{% tab "Swift" %}} | ||
```swift | ||
// This adds an attribute "device-model" with a string value in all logs instance. |
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.
// This adds an attribute "device-model" with a string value in all logs instance. | |
// This adds an attribute "device-model" with a string value in all Logs instances. |
@@ -533,7 +549,7 @@ Use the `removeAttribute(forKey:)` method to remove a custom attribute from all | |||
{{< tabs >}} | |||
{{% tab "Swift" %}} | |||
```swift | |||
// This removes the attribute "device-model" from all further log send. | |||
// This removes the attribute "device-model" from all further log sent from this logger instance. |
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.
// This removes the attribute "device-model" from all further log sent from this logger instance. | |
// This removes the attribute "device-model" from all further logs sent from this logger instance. |
{{< tabs >}} | ||
{{% tab "Swift" %}} | ||
```swift | ||
// This removes the attribute "device-model" from all further log sent from all logger instance. |
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.
// This removes the attribute "device-model" from all further log sent from all logger instance. | |
// This removes the attribute "device-model" from all further logs sent from all logger instances. |
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.
a minor feedback, but otherwise looks good.
logger.addAttribute("version_name", BuildConfig.VERSION_NAME) | ||
``` | ||
|
||
Attributes can be added globally across all Logs instances using: |
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.
When would a user want to use logger-specific vs global attributes? Can we add one sentence explaining that?
What does this PR do? What is the motivation?
Merge instructions
Merge readiness:
For Datadog employees:
Your branch name MUST follow the
<name>/<description>
convention and include the forward slash (/
). Without this format, your pull request will not pass CI, the GitLab pipeline will not run, and you won't get a branch preview. Getting a branch preview makes it easier for us to check any issues with your PR, such as broken links.If your branch doesn't follow this format, rename it or create a new branch and PR.
[6/5/2025] Merge queue has been disabled on the documentation repo. If you have write access to the repo, the PR has been reviewed by a Documentation team member, and all of the required checks have passed, you can use the Squash and Merge button to merge the PR. If you don't have write access, or you need help, reach out in the #documentation channel in Slack.
Additional notes