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

Enable CI Visibility UI #221

Merged
merged 19 commits into from
Jun 29, 2021
Merged

Enable CI Visibility UI #221

merged 19 commits into from
Jun 29, 2021

Conversation

drodriguezhdez
Copy link
Collaborator

@drodriguezhdez drodriguezhdez commented Jun 22, 2021

Requirements for Contributing to this repository

  • Fill out the template below. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • The pull request must only fix one issue at the time.
  • The pull request must update the test suite to demonstrate the changed functionality.
  • After you create the pull request, all status checks must be pass before a maintainer reviews your contribution. For more details, please see CONTRIBUTING.

What does this PR do?

This PR enables the configuration for CI Visibility via UI and environment variables:

  • DATADOG_JENKINS_PLUGIN_TARGET_TRACE_COLLECTION_PORT
  • DATADOG_JENKINS_PLUGIN_ENABLE_CI_VISIBILITY
  • DATADOG_JENKINS_PLUGIN_CI_VISIBILITY_CI_INSTANCE_NAME.

Additionally, the PR adds some changes to the current UI to accommodate the CI Visibility feature in a coherent way for the user.

  • Enable Log Collection is now visible.
  • CI Visibility can only be enabled if Datadog Agent mode is used.
  • Use Datadog Agent instead of DogStatsD in the applicable context.
  • Use help HTML for textboxes in Datadog Agent mode.

Finally, this PR modifies the README.md document to include the new configuration setup for CI Visibility.

Description of the Change

Alternate Designs

Possible Drawbacks

Verification Process

Additional Notes

Release Notes

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.

@github-actions github-actions bot added the documentation Documentation related changes label Jun 22, 2021
@drodriguezhdez drodriguezhdez added the changelog/Added Added features results into a minor version bump label Jun 22, 2021
@drodriguezhdez drodriguezhdez marked this pull request as ready for review June 22, 2021 15:33
Copy link

@fermayo fermayo left a comment

Choose a reason for hiding this comment

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

Reviewed README

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
drodriguezhdez and others added 2 commits June 23, 2021 08:52
Co-authored-by: Fernando Mayo <fermayo@gmail.com>
Co-authored-by: Fernando Mayo <fermayo@gmail.com>
Copy link
Collaborator

@AdrianLC AdrianLC left a comment

Choose a reason for hiding this comment

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

I think I found some mistake on logging otherwise looks good.
It'd be good to have some tests for the logic in the form.

if(!enableCiVisibility || DatadogClient.ClientType.DSD.name().equals(this.reportWith)) {
this.collectBuildTraces = enableCiVisibility;
} else {
logger.warning("CI Visibility can only be enabled using Datadog Agent mode.");
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems this would warn if users set the env var DATADOG_JENKINS_PLUGIN_ENABLE_CI_VISIBILITY to False? Is that a bug?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hummm, no... The warning is shown when:

  • enableCiVisibility == true && DatadogClient.ClientType.HTTP.name().equals(this.reportWith)

I'm going to change the condition to be clearer.

// NOTE: Change this when APM Traces was released as public feature.
this.setTraceServiceName(DEFAULT_TRACES_SERVICE_NAME);
this.setEnableCiVisibility(ciVisibilityData != null && !ciVisibilityData.isNullObject());
} catch (Exception ex) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

would this log a severe error when you raise throw new FormException("CI Visibility can only be enabled using Datadog Agent mode.", "collectBuildTraces")? that seems like a mistake

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If we cannot parse the configuration, it's an error and we should log it as an error IMHO. If we cannot parse the configuration is not an expected behaviour

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes but you're also throwing a validation exception in this block and that's not an error in parsing

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, you're totally right. Good catch.

drodriguezhdez and others added 2 commits June 23, 2021 16:40
Co-authored-by: Adrián López Calvo <adrianlopezcalvo@gmail.com>
README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
drodriguezhdez and others added 3 commits June 24, 2021 08:59
Co-authored-by: Fernando Mayo <fermayo@gmail.com>
Co-authored-by: Fernando Mayo <fermayo@gmail.com>
@drodriguezhdez
Copy link
Collaborator Author

It'd be good to have some tests for the logic in the form.

Yeah, I agree. However, I think we cannot execute unit tests with this logic, but integration tests. We'd need to take a deeper look at how to do it because this configuration does not have any tests yet (even before CI Visibility).

I've tested these changes in real Jenkins instances, so I think we can go forward, unblock the UI, and then we can invest some time into automatize these integration tests.

AdrianLC
AdrianLC previously approved these changes Jun 24, 2021
fermayo
fermayo previously approved these changes Jun 24, 2021
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
@drodriguezhdez drodriguezhdez dismissed stale reviews from fermayo and AdrianLC via b9fd634 June 25, 2021 07:19
Co-authored-by: Fernando Mayo <fermayo@gmail.com>
| Global tag file | The path to a workspace file containing a comma separated list of tags (not compatible with pipeline jobs). | `DATADOG_JENKINS_PLUGIN_GLOBAL_TAG_FILE` |
| Global tags | A comma-separated list of tags to apply to all metrics, events, and service checks. Tags can include environment variables that are defined in the master jenkins instance. | `DATADOG_JENKINS_PLUGIN_GLOBAL_TAGS` |
| Global job tags | A comma separated list of regex to match a job and a list of tags to apply to that job. Tags can include environment variables that are defined in the master jenkins instance. **Note**: Tags can reference match groups in the regex using the `$` symbol, for example: `(.*?)_job_(*?)_release, owner:$1, release_env:$2, optional:Tag3` | `DATADOG_JENKINS_PLUGIN_GLOBAL_JOB_TAGS` |
| Send security audit events | Submits the `Security Events Type` of events and metrics (enabled by default). | `DATADOG_JENKINS_PLUGIN_EMIT_SECURITY_EVENTS` |
| Send system events | Submits the `System Events Type` of events and metrics (enabled by default). | `DATADOG_JENKINS_PLUGIN_EMIT_SYSTEM_EVENTS` |
| Enable Log Collection | Collect and Submit build logs (disabled by default). | `DATADOG_JENKINS_PLUGIN_COLLECT_BUILD_LOGS` |
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you removing this ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We're not removing this, but moving to another place in the README. These envvars are related to the Advanced tab, where the "Enable Log Collection" is not there anymore.

hithwen
hithwen previously approved these changes Jun 25, 2021
sarina-dd
sarina-dd previously approved these changes Jun 25, 2021
@drodriguezhdez drodriguezhdez dismissed stale reviews from sarina-dd and hithwen via 70dbf6a June 28, 2021 13:08
@drodriguezhdez drodriguezhdez merged commit d38e759 into master Jun 29, 2021
@drodriguezhdez drodriguezhdez deleted the drodriguezhdez/show_ciapp_UI branch June 29, 2021 07:45
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 documentation Documentation related changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants