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

Feature: AppDynamics data link #558

Merged

Conversation

chrjosep
Copy link
Contributor

@chrjosep chrjosep commented Jan 11, 2025

Feature

  • In order to further integrate AppDynamics with Splunk o11y, we are adding data links that deep link to AppDynamics CSaaS.
  • Add target_appd_url to data link resource
  • Bump signalfx-go version

Usage

  • Run a Terraform file using the new target_appd_url field on a data link resource.

Implementation

  • Conditional check on data link type. Followed style for existing data link types (target_external_url, target_splunk, etc.).
  • URL validation checks for target_appd_url
  • Error handling for URL validation. Returns an error if input URL does not match AppDynamics regex pattern.
    • URL should contain .saas.appdynamics.com, query values component and application. The query values should be positive integers

Testing

  • Manually tested by generating local binary and running Terraform module with development_overrides flag.
  • Acceptance tests:
    • Valid target_appd_url url that should create and destroy a data link without errors
    • A target_appd_url with a missing query parameter component. This should throw an error in the URL validation logic.

@chrjosep chrjosep requested a review from atoulme as a code owner January 11, 2025 20:48
Copy link

github-actions bot commented Jan 11, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@chrjosep
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

Copy link

codecov bot commented Jan 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.87%. Comparing base (2eac7d3) to head (0945251).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #558   +/-   ##
=======================================
  Coverage   94.87%   94.87%           
=======================================
  Files          35       35           
  Lines        2107     2107           
=======================================
  Hits         1999     1999           
  Misses         89       89           
  Partials       19       19           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@MovieStoreGuy MovieStoreGuy left a comment

Choose a reason for hiding this comment

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

Just a comment from me.

appdURLs := val.(*schema.Set).List()

appdUrlPatternRegex := "^https?:\\/\\/[a-zA-Z0-9-]+\\.saas\\.appdynamics\\.com\\/.*application=\\d+.*component=\\d+.*"
re := regexp.MustCompile(appdUrlPatternRegex)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Avoid using MustCompile or Must* methods in general since on error they will panic causing state to be incorrectly set if this was to be in the middle in an apply.

Be sure to use Compile instead and return the error.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you mind expanding on what the regular expression is testing?

Reading it it looks like you can have any wildcard for *.saas.appdynamics.com and expecting to have the query values for application, and component?

Did I miss anything here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes that is correct. The other condition would be that the query values for application and component need to be positive integers.

@MovieStoreGuy MovieStoreGuy merged commit e7a73ea into splunk-terraform:main Jan 14, 2025
1 check passed
@github-actions github-actions bot locked and limited conversation to collaborators Jan 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants