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

SLO chart type support #549

Merged

Conversation

lukasz-picur-signalfx
Copy link
Contributor

No description provided.

Copy link

github-actions bot commented Nov 20, 2024

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

@lukasz-picur-signalfx
Copy link
Contributor Author

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

Copy link

codecov bot commented Nov 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.87%. Comparing base (3f55b51) to head (073dca6).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #549   +/-   ##
=======================================
  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.


🚨 Try these New Features:

@lukasz-picur-signalfx
Copy link
Contributor Author

recheck

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.

I've added comments where i think things could be improved, mostly as nits.

However, I do think adopting the Operation Context methods should be done since it they also provide the ability to gracefully stop resources being created/destroyed during the provider shutdown.

Comment on lines 30 to 33
Create: slochartCreate,
Read: slochartRead,
Update: slochartUpdate,
Delete: slochartDelete,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please us the <Operation>Context methods since these methods are deprecated by the API.

Read: slochartRead,
Update: slochartUpdate,
Delete: slochartDelete,
Exists: chartExists,
Copy link
Collaborator

Choose a reason for hiding this comment

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

The API mentions that this is deprecated and not required if Read is implemented.

Comment on lines 54 to 55
debugOutput, _ := json.Marshal(payload)
log.Printf("[DEBUG] SignalFx: Create SLO Chart Payload: %s", string(debugOutput))
Copy link
Collaborator

Choose a reason for hiding this comment

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

For this, you could do:

tflog.Debug(ctx, "Created SLO chart", tfext.NewLogFields().JSON("payload", payload))

This would keep the code more concise.

return err
}
// Since things worked, set the URL and move on
appURL, err := buildAppURL(config.CustomAppURL, CHART_APP_PATH+sloChart.Id)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can use the following method to make sure this uri is correctly built.

pmeta.LoadApplicationURL(ctx, meta, ChartAppPath, slochart.Id)

Comment on lines 77 to 81
if err := d.Set("slo_id", c.SloId); err != nil {
return err
}

return nil
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can just be:

Suggested change
if err := d.Set("slo_id", c.SloId); err != nil {
return err
}
return nil
return d.Set("slo_id", c.SloId)

Comment on lines 74 to 75
debugOutput, _ := json.Marshal(c)
log.Printf("[DEBUG] SignalFx: Got SLO Chart to enState: %s", string(debugOutput))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Considering there is only one field being set, I don't believe this is needed.

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.

I suggest doing the fixes in a follow up PR thinking about it.

@lukasz-picur-signalfx
Copy link
Contributor Author

All of the suggestions are addressed.

@MovieStoreGuy MovieStoreGuy merged commit 338a555 into splunk-terraform:main Nov 25, 2024
8 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Nov 25, 2024
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