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

Skip metrics/traces with refactor #105

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

ryanrolds
Copy link
Contributor

@ryanrolds ryanrolds commented Jan 8, 2025

Here is a purposed implementation of skip metrics/traces with a refactoring of the project structure and introduction of a config package. The refactor made adding the tests easier and will make implementing tests easier in the future.

Please let me know what you think. I'm happy to adjust it.

Major changes

  • Moves most logic under internal.
  • Added intenal/config package to handle configuration
  • Renamed Main to Run
  • Ranamed TestReader to FileReader
  • Fixed an issue with FakeGitRepo that required the samples existing in the same dir as the test and the root of the repo

Copy link
Owner

@mdelapenya mdelapenya left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for this!

I'd have preferred two PRs, one with the refactor and one adding the new config, but I think this is clear enough to be merged as one.

Meter(string) metric.Meter
}

func TransformAndLoadSuites(ctx context.Context, cfg *config.Config, provider OtelProvider,
Copy link
Owner

Choose a reason for hiding this comment

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

nit: is the function name duplicating the package name? Having to use it like this transform.TransformAndLoadSuites seems weird. The natural AndLoadSuites sounds incorrect, although not sure about WithLoadSuites. wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will think about this on my walk and adjust the name when I get back.


import "os"

type FileReader struct {
Copy link
Owner

Choose a reason for hiding this comment

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

question: if this is used only in tests, do we need it to be exposed, even under the internal package?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the future we may use it for more than tests. If a switch is added to take a file path we can use it for that.

@ryanrolds
Copy link
Contributor Author

I'd have preferred two PRs, one with the refactor and one adding the new config, but I think this is clear enough to be merged as one.

I agree. I almost made a separate PR. I wanted to also have the skip metric/trace tests to demonstrate why the Config was needed. Thank you for understanding.

@ryanrolds
Copy link
Contributor Author

ryanrolds commented Jan 9, 2025

At some point I'm going to want to add an interface mocker to improve test coverage. Any objections or preferences on which?

@ryanrolds ryanrolds force-pushed the rolds/refactor_for_better_testing branch from 11567df to 723d5c6 Compare January 9, 2025 18:53
@ryanrolds
Copy link
Contributor Author

I made some adjustments that I think addresses the concerns with the naming.

@ryanrolds ryanrolds requested a review from mdelapenya January 13, 2025 18:07
@mdelapenya
Copy link
Owner

@ryanrolds I've not forgotten this 🙏 I'm at Gophercon SG returning back to Spain next Monday.

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