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

Exporter refresh #20

Merged
merged 22 commits into from
Dec 2, 2022
Merged

Exporter refresh #20

merged 22 commits into from
Dec 2, 2022

Conversation

chelnak
Copy link
Owner

@chelnak chelnak commented Nov 13, 2022

Prior to this change many elements of the exporter were outdated, along with the development methods being used.

The new app uses poetry for dependency management, includes type hints and is now running on a modern python version. In addition the app now users typer instead of ConfigArgParse to provide a consistent cli ux.

From the next release, the exporter will also be published as a wheel so that it can be installed with pip, poetry or another tool of choice.

This change also includes a refresh to the apps logic.

Moving forward, we will be using the python SDK provided by status cake.

The SDK has been abstracted away in to a new internal class so that we have control over the interface exposed to the collector.

Namely, we can gracefully handle things like forbidden access to paid features or the issues surrounding the maintenance window api without polluting the logic of the collector.

While this change will aim to be as non-destructive as possible it will be a breaking release given that we cannot guarantee that everything will work as it did before.

Outstanding actions:

  • Calls to the status cake api should properly handle pagination
  • Calls to the status cake api should properly respect rate limits
  • Need to validate how the exporter handles errors, along with exit codes etc
  • Docker image update
  • Refresh CI workflows
  • Support uptime test tags
  • Handle legacy maintenance window API calls

To test this PR you will need to install poetry and run poetry install to download dependencies.

To run the app use poetry run status-cake-exporter

@chelnak chelnak force-pushed the exporter_refresh branch 3 times, most recently from fcf722e to 26751ea Compare November 14, 2022 17:19
@chelnak chelnak force-pushed the exporter_refresh branch 12 times, most recently from 0b3caeb to 018b3ac Compare November 15, 2022 19:03
@chelnak
Copy link
Owner Author

chelnak commented Nov 15, 2022

@jack-cloud-platform I think this is ready for testing now.

The only outstanding question is how we catch calls that are supposed to hit the legacy maintenance window api:

# TODO: Handle pre v1 maintenance api accounts gracefully

Given that the new StatusCake SDK implementations are well documented
and follow a set standard, we can assume that the pagination
requirements do not differ between endpoint calls.

This means that we can refactor the code so that pagination is handled
by a single private method.

The method will take a function definition and a set of args, perform
the required pagination and return a response to the caller.
Copy link
Collaborator

@CloudPlatformer CloudPlatformer left a comment

Choose a reason for hiding this comment

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

Great refresh @chelnak!

@chelnak chelnak merged commit 047789e into main Dec 2, 2022
@chelnak chelnak deleted the exporter_refresh branch December 2, 2022 14:35
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.

2 participants