Skip to content
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 optional display_name tag #17657

Merged
merged 6 commits into from
May 30, 2024
Merged

Conversation

mrafi97
Copy link
Contributor

@mrafi97 mrafi97 commented May 29, 2024

What does this PR do?

Add a new tag to each windows_service service check that includes the Windows Service Display Name as the tag display_name.
Add a collect_display_name_as_tag option to control presence/absence of the tag.

Motivation

Customer Requests: https://datadoghq.atlassian.net/browse/WINA-795

Additional Notes

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Changelog entries must be created for modifications to shipped code
  • Add the qa/skip-qa label if the PR doesn't need to be tested during QA.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

- name: collect_display_name_as_tag
description: |
Whether or not to submit the Windows Service Display Name as the `display_name` tag.
`display_name` will be formatted according to Datadog's tagging requirements:
Copy link
Contributor

Choose a reason for hiding this comment

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

English my second language of course but do you think we can restate it a bit differently for clarity, e.g. Windows Service Display name will be automatically formatted according to Datadog's tagging requirements (https://docs.datadoghq.com/getting_started/tagging/#define-tags) as display_name tag value.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if it worth to describe auto-formatting rules.

@iliakur iliakur merged commit b98b1f0 into master May 30, 2024
35 checks passed
@iliakur iliakur deleted the mrafi/windows_service_display_name branch May 30, 2024 16:02
@@ -314,6 +318,9 @@ def check(self, instance):
if instance.get('windows_service_startup_type_tag', False):
tags.append('windows_service_startup_type:{}'.format(startup_type_string))

if instance.get('collect_display_name_as_tag', False):
tags.append('display_name:{}'.format(display_name))

Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking to replace

        if 'ALL' not in services:
            for service in services_unseen:
                # if a name doesn't match anything (wrong name or no permission to access the service), report UNKNOWN
                status = self.UNKNOWN
                startup_type_string = ServiceView.STARTUP_TYPE_UNKNOWN
                display_name = "Not_Found"

                tags = ['windows_service:{}'.format(service)]

                tags.extend(custom_tags)
                if instance.get('windows_service_startup_type_tag', False):
                    tags.append('windows_service_startup_type:{}'.format(startup_type_string))

                if instance.get('collect_display_name_as_tag', False):
                    tags.append('display_name:{}'.format(display_name))

on something like

        if 'ALL' not in services:
            for service in services_unseen:
                # if a name doesn't match anything (wrong name or no permission to access the service), report UNKNOWN
                status = self.UNKNOWN

                tags = ['windows_service:{}'.format(service)]
                tags.extend(custom_tags)
                if instance.get('windows_service_startup_type_tag', False):
                    tags.append('windows_service_startup_type:{}'.format(ServiceView.STARTUP_TYPE_UNKNOWN))

                if instance.get('collect_display_name_as_tag', False):
                    tags.append('display_name:{}'.format(ServiceView.DISPLAY_NAME_UNKNOWN))

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

Successfully merging this pull request may close these issues.

3 participants