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

feat: add metrics enablement #319

Merged
merged 8 commits into from
Nov 12, 2024
Merged

Conversation

kccox
Copy link
Contributor

@kccox kccox commented Oct 21, 2024

Event Streams allows enablement of enhanced customer metrics using the provision parameters. Add the metrics enablement to the main module, and to examples/complete, modules/fscloud, and solutions/quickstart. Update READMEs.

Description

Add metrics enablement to the module. This is a customer-requested feature.

Metrics enablement is already a provision parameter, so no update to the terraform provider version is needed.

Release required?

  • No release
  • Patch release (x.x.X)
  • Minor release (x.X.x)
  • Major release (X.x.x)

Run the pipeline

Run the CI pipeline when the PR is ready for review and you expect tests to pass. Add a comment to the PR with the following text:

/run pipeline

Checklist for reviewers

  • If relevant, a test for the change is included or updated with this PR.
  • If relevant, documentation for the change is included or updated with this PR.

For mergers

  • Use a conventional commit message to set the release level. Follow the guidelines.
  • Include information that users need to know about the PR in the commit message. The commit message becomes part of the GitHub release notes.
  • Use the Squash and merge option.

@kccox kccox requested review from Ak-sky and akocbek as code owners October 21, 2024 16:38
@kccox
Copy link
Contributor Author

kccox commented Oct 21, 2024

/run pipeline

Copy link

@kccox you must be in the team github-collaborators in order to trigger the pipeline.

@Ak-sky
Copy link
Member

Ak-sky commented Oct 21, 2024

/run pipeline

1 similar comment
@Ak-sky
Copy link
Member

Ak-sky commented Oct 22, 2024

/run pipeline

@kccox
Copy link
Contributor Author

kccox commented Oct 22, 2024

@Ak-sky The CI failure was from invalid credentials while creating the topics:

kafka server: SASL Authentication failed: Authentication failed, invalid credentials

This is odd, since the same credentials were used to create the Event Streams service instance and that worked. Topic creation also worked in the previous CI run.

I looked at the logging from the kafka servers, but unfortunately Cloud Logs is having problems in us-south and they're unavailable. I also notice terraform created the testacc-subnet and VPC in eu-de, but the Event Streams instance in us-south - I don't know if that might be the cause.

Could you re-run the pipeline to see if the same error happens again?

@Ak-sky Ak-sky changed the title chore: add metrics enablement feat: add metrics enablement Oct 22, 2024
@Ak-sky
Copy link
Member

Ak-sky commented Oct 22, 2024

/run pipeline

1 similar comment
@Ak-sky
Copy link
Member

Ak-sky commented Oct 23, 2024

/run pipeline

@Ak-sky
Copy link
Member

Ak-sky commented Oct 23, 2024

@kccox, can you please point me to the terraform provider doc URL to support metrics?

@kccox
Copy link
Contributor Author

kccox commented Oct 23, 2024

@Ak-sky https://github.com/IBM-Cloud/terraform-provider-ibm/blob/master/examples/ibm-event-streams/README.md shows use of "metrics". We have tested provisioning with metrics using the terraform provider and it works.

The metrics are one of the provision parameters, so are in the "parameters" or "parameters_json" property of the ibm_resource_instance terraform resource.

However I don't think it's these code changes that are causing the problem. The infrastructure test for #321 failed in the same way, with SASL Authentication failed: Authentication failed, invalid credentials responses from the servers. This indicates that the API key used by terraform doesn't have admin authorization for the Event Streams service instance. Has the key, or any related policies, changed lately?

EDIT: I see that pull 321 is to fix https://github.ibm.com/GoldenEye/issues/issues/11171, reporting that the main module tests started failing a week ago. Unfortunately I don't have access to that pipeline instance or the COS bucket with the logs.

@kccox kccox marked this pull request as draft October 23, 2024 21:19
@kccox
Copy link
Contributor Author

kccox commented Oct 23, 2024

I have converted this to draft because we would prefer to implement #322 first. That will allow the metrics variable to be list(string) and validated.

@ocofaigh
Copy link
Member

@kccox FYI, looks like a PR has been raised for migrating to parameters_json -> #325

@ocofaigh
Copy link
Member

@kccox #325 is merged now so you should be good to proceed to use parameters_json to add this support

@kccox kccox marked this pull request as ready for review October 30, 2024 18:52
@kccox
Copy link
Contributor Author

kccox commented Oct 30, 2024

/run pipeline

@kccox
Copy link
Contributor Author

kccox commented Oct 30, 2024

@ocofaigh This is ready for review

@@ -105,3 +105,9 @@ variable "topics" {
}
]
}

variable "metrics" {
Copy link
Member

Choose a reason for hiding this comment

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

please don'e expose this as a variable in the example. We don't wan't to make examples flexible solutions for people to use. Instead I suggest you hard code metrics in the example main.tf and add all the allowed values so our our tests test the feature

Copy link
Contributor Author

Choose a reason for hiding this comment

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

examples/complete is using the default standard plan, and the enhanced metrics are only available for enterprise (https://cloud.ibm.com/docs/EventStreams?topic=EventStreams-metrics). However I will hard-code metrics: [] in the main.tf and remove it from the variables.tf.

Copy link
Contributor Author

@kccox kccox Nov 4, 2024

Choose a reason for hiding this comment

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

Editing examples/complete/variables.tf, I am now confused. There are variables for several other module properties (resource tags, access tags, schemas, topics) which are used in main.tf. Why would metrics be treated differently?

  schemas           = var.schemas
  tags              = var.resource_tags
  access_tags       = var.access_tags
  topics            = var.topics

Copy link
Member

Choose a reason for hiding this comment

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

ah they should not be exposed in the example. I'll create a separate issue for the core team to clean that up, We don't want people to start consuming the examples, as they not intended to be consumable solutions - just reference on how the module can be used.

Copy link
Member

Choose a reason for hiding this comment

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

created tracking issue #331

ibm_catalog.json Outdated Show resolved Hide resolved
Copy link
Member

@ocofaigh ocofaigh left a comment

Choose a reason for hiding this comment

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

See comments

@@ -62,6 +62,7 @@ module "event_streams" {
tags = var.resource_tags
topics = var.topics
existing_kms_instance_guid = var.existing_kms_instance_guid
metrics = []
Copy link
Member

Choose a reason for hiding this comment

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

can you add the allowed values here so they get tested in the tests we run?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

examples/fscloud doesn't set the plan to enterprise-3nodes-2tb, so is using a standard plan, and these options are not available for standard. Checking our provision code, I see that they're just ignored, and don't cause an error - but I can't promise it will always work that way.

So I could include the allowed values, but it would only be a test of the terraform validator, and might break in the future if we improve the parameters checking.

Copy link
Member

Choose a reason for hiding this comment

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

The fscloud example is calling the modules/fscloud submodule, and this is hard code to use the "enterprise-3nodes-2tb" plan

@kccox
Copy link
Contributor Author

kccox commented Nov 7, 2024

@ocofaigh Added the metrics to examples/fscloud

Copy link
Member

@ocofaigh ocofaigh left a comment

Choose a reason for hiding this comment

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

see remaining comments

variables.tf Outdated Show resolved Hide resolved
solutions/quickstart/variables.tf Outdated Show resolved Hide resolved
ibm_catalog.json Outdated Show resolved Hide resolved
@ocofaigh
Copy link
Member

/run pipeline

@ocofaigh ocofaigh merged commit 097ca90 into terraform-ibm-modules:main Nov 12, 2024
2 checks passed
@terraform-ibm-modules-ops
Copy link
Contributor

🎉 This PR is included in version 2.8.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@kccox kccox deleted the add-metrics branch November 15, 2024 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants