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

New Metrics V2 resource which uses V2 endpoints #720

Merged
merged 5 commits into from
Jan 30, 2025

Conversation

sukhhanda1
Copy link
Collaborator

@sukhhanda1 sukhhanda1 commented Jan 27, 2025

Why this change?
Fixes issue: #713

The current metrics search resource is not compatible with V2 metrics searches. The UI has completely migrated to V2 metrics searches and resources created with v1 APIs are not compatible.
In order to fix this, we have provided support for metrics_searches_v2 which uses V2 endpoints for metrics searches resource creation.

API for reference:
https://help.sumologic.com/docs/api/metrics-searches-v2/

Testing performed:
The test cases sumologic/resource_sumologic_metrics_search_v2_test.go are run with one of the sumologic enviroments and I was able to verify the newly created resource is visible in the personal folder in the library. On opening the resource, all the details are correctly set.

@sukhhanda1 sukhhanda1 requested a review from a team as a code owner January 27, 2025 14:08
@sjain05
Copy link
Collaborator

sjain05 commented Jan 27, 2025

the new test is failing

=== RUN   TestAccSumologicMetricsSearchV2_create
    testing.go:766: Error destroying resource! WARNING: Dangling resources
        may exist. The full state and error is shown below.
        
        Error: errors during apply: ***"id":"SSKT8-FDO0Y-E83H8","errors":[***"code":"user:not_found","message":"Object Not Found."***]***
        
        State: data.sumologic_personal_folder.personalFolder:
          ID = 0000000001DECB7A
          provider = provider.sumologic
          description = My saved searches and dashboards
          name = Personal
        sumologic_metrics_search_v2.tf_create_metrics_search_v2_test:
          ID = XGfbqDHqlXJh5586KsQ1JHSNdFF6a9p2qZWO3zskG1v092GmrDhsIDlErIRE
          provider = provider.sumologic
          description = Test metrics search v2 description
          folder_id = 0000000001DECB7A
          queries.# = 1
          queries.0.metrics_query_mode = Advanced
          queries.0.query_key = A
          queries.0.query_string = metric=cpu_idle | avg
          queries.0.query_type = Metrics
          time_range.# = 1
          time_range.0.begin_bounded_time_range.# = 1
          time_range.0.begin_bounded_time_range.0.from.# = 1
          time_range.0.begin_bounded_time_range.0.from.0.epoch_time_range.# = 0
          time_range.0.begin_bounded_time_range.0.from.0.iso8601_time_range.# = 0
          time_range.0.begin_bounded_time_range.0.from.0.literal_time_range.# = 1
          time_range.0.begin_bounded_time_range.0.from.0.literal_time_range.0.range_name = today
          time_range.0.begin_bounded_time_range.0.from.0.relative_time_range.# = 0
          time_range.0.begin_bounded_time_range.0.to.# = 0
          time_range.0.complete_literal_time_range.# = 0
          title = terraform_test_metrics_search_v2_ujovh3m0gdo9q64q
          visual_settings =
--- FAIL: TestAccSumologicMetricsSearchV2_create (34.83s)

@sukhhanda1
Copy link
Collaborator Author

@sjain05 It is working fine when I am running the tests on my local. Do we know which enviroment do we use to run tests on PR builder? I would like to see what this error code says SSKT8-FDO0Y-E83H8.

@sukhhanda1
Copy link
Collaborator Author

@sjain05 Might have been some intermittent issue. Passed on Retry.

@sukhhanda1 sukhhanda1 requested a review from sjain05 January 28, 2025 09:34
Copy link
Collaborator

@sjain05 sjain05 left a comment

Choose a reason for hiding this comment

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

lgtm, but please address the comments

@sjain05
Copy link
Collaborator

sjain05 commented Jan 28, 2025

couple of things -

  1. you need to add the resource reference here https://github.com/SumoLogic/terraform-provider-sumologic/blob/master/sumologic/provider.go#L45
  2. you need to add documentation here https://github.com/SumoLogic/terraform-provider-sumologic/tree/master/website/docs/r for this new resource

@sukhhanda1
Copy link
Collaborator Author

sukhhanda1 commented Jan 30, 2025

couple of things -

  1. you need to add the resource reference here https://github.com/SumoLogic/terraform-provider-sumologic/blob/master/sumologic/provider.go#L45
  2. you need to add documentation here https://github.com/SumoLogic/terraform-provider-sumologic/tree/master/website/docs/r for this new resource
  1. The reference is already added here.
  2. I have added the docs with a message about deprecation of metrics_search resource.

@sukhhanda1 sukhhanda1 merged commit 328f50d into master Jan 30, 2025
7 checks passed
@sukhhanda1 sukhhanda1 deleted the sukhdeep-MET-21556-newMetricsV2Resouce branch January 30, 2025 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants