Skip to content

Tag logs with timestamp, datadog.product and ci.pipeline.name#297

Merged
albertvaka merged 6 commits into
masterfrom
albertvaka/add-tags
Jul 22, 2022
Merged

Tag logs with timestamp, datadog.product and ci.pipeline.name#297
albertvaka merged 6 commits into
masterfrom
albertvaka/add-tags

Conversation

@albertvaka

@albertvaka albertvaka commented Jul 19, 2022

Copy link
Copy Markdown
Collaborator

What does this PR do?

Adds the timestamp, datadog.product and ci.pipeline.name tags to logs, matching logs produced by other CIs.

I changed the way we read the pipeline name so it doesn't require git information, since that's not available when we create the logs DatadogWriter object.

Verification Process

After sending logs with this patch, the new fields should show up here:

Screenshot_20220721_122232

Review checklist (to be filled by reviewers)

  • Feature or bug fix MUST have appropriate tests (unit, integration, etc...)
  • PR title must be written as a CHANGELOG entry (see why)
  • Files changes must correspond to the primary purpose of the PR as described in the title (small unrelated changes should have their own PR)
  • PR must have one changelog/ label attached. If applicable it should have the backward-incompatible label attached.
  • PR should not have do-not-merge/ label attached.
  • If Applicable, issue must have kind/ and severity/ labels attached at least.

@albertvaka albertvaka changed the title Tag logs with timestamp and datadog.product Tag logs with timestamp, datadog.product and ci.pipeline.name Jul 21, 2022

@drodriguezhdez drodriguezhdez left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dropped some comments. Looks good to me in general. It's great the job name logic is not dependent anymore on the collected git info.

Comment thread src/main/java/org/datadog/jenkins/plugins/datadog/model/BuildData.java Outdated

@sarah-witt sarah-witt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I left a few comments. Can you also update the readme with the new tags?

Comment thread src/main/java/org/datadog/jenkins/plugins/datadog/model/BuildData.java Outdated
Comment thread src/main/java/org/datadog/jenkins/plugins/datadog/model/BuildData.java Outdated
@albertvaka
albertvaka force-pushed the albertvaka/add-tags branch from e7b4c0b to c7373b0 Compare July 22, 2022 15:06
@albertvaka
albertvaka force-pushed the albertvaka/add-tags branch from c7373b0 to 4058787 Compare July 22, 2022 15:11
@albertvaka
albertvaka force-pushed the albertvaka/add-tags branch from b2bb8b4 to bcfbf83 Compare July 22, 2022 15:40
@albertvaka
albertvaka merged commit 613d418 into master Jul 22, 2022
@albertvaka
albertvaka deleted the albertvaka/add-tags branch July 22, 2022 18:20

@AdrianLC AdrianLC left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@albertvaka speaking only from the screenshot, this is wrong.

ddsource and ddtags are not supposed to be displayed there. They are extracted to the Source facet and log tags.

I think this was already broken for ddtags, and it's related to unallowed characters. This cannot have whitespace or commas within the values. So either some tag cannot be provided through there or it needs some kind of escaping.

I'm not sure about ddsource maybe renaming it to just source works. Otherwise maybe this is different for public and internal requests.

@albertvaka

Copy link
Copy Markdown
Collaborator Author

We should look into it but I think this was already broken before this PR. If not feel free to revert.

@AdrianLC

Copy link
Copy Markdown

yes it was already wrong 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/Added Added features results into a minor version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants