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

Add library for converting prometheus/alertmanager configurations to Chronosphere entities #47

Merged
merged 1 commit into from
Jan 8, 2025

Conversation

bbarnes52
Copy link
Contributor

@bbarnes52 bbarnes52 commented Jan 6, 2025

This PR open sources the core logic used by chronoctl convert/sync prometheus to convert prometheus and alertmanager configurations to Chronosphere entities. In chronoctl v1, conversion will be performed on the client-side, as opposed to v0, which performs conversion on the server-side.

This approach has the following benefits:

  • Given a version of chronoctl and a prometheus/alertmanager configuration, the outputs of chronoctl convert are deterministic.
  • chronoctl convert will not require authenticating to Chronosphere
  • Allows conversion library to be used in custom workflows

@bbarnes52 bbarnes52 force-pushed the bgb/prometheusconversion branch 8 times, most recently from cf2f8c8 to 24bc525 Compare January 6, 2025 23:09
@bbarnes52 bbarnes52 marked this pull request as ready for review January 6, 2025 23:15
@bbarnes52 bbarnes52 requested a review from a team as a code owner January 6, 2025 23:15
@bbarnes52 bbarnes52 force-pushed the bgb/prometheusconversion branch 3 times, most recently from fd395bd to 386e99a Compare January 7, 2025 14:15
@@ -60,13 +60,11 @@ func TestListRuleEvaluations(t *testing.T) {
},
expected: `rule_slug: slug-one
rule_type: MONITOR
detected_at: "1970-01-01T00:00:00.000Z"
Copy link
Contributor

Choose a reason for hiding this comment

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

is this change related?

Copy link
Contributor Author

@bbarnes52 bbarnes52 Jan 8, 2025

Choose a reason for hiding this comment

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

discussed offline, and addressed by pinning strfmt in go.mod. Bug is described in a comment in go.mod, summarizing here for posterity:

// Required to avoid picking up https://github.com/go-openapi/strfmt/commit/b36a4901fcb51dbf4300a5a6b60b4335440aa208
// which causes strfmt.DateTime values to be incorrectly omitted from yaml output due to a bug in the yaml library
// where the IsZero method on pointers that implement the IsZeroer interface is not invoked.

@bbarnes52 bbarnes52 force-pushed the bgb/prometheusconversion branch from 386e99a to 2ebbe43 Compare January 8, 2025 22:34
@bbarnes52 bbarnes52 merged commit a1b83d6 into main Jan 8, 2025
1 check passed
@bbarnes52 bbarnes52 deleted the bgb/prometheusconversion branch January 8, 2025 23:03
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.

2 participants