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: configurable mock destination for pipeline testing #2012

Merged
merged 7 commits into from
Dec 16, 2024

Conversation

blumamir
Copy link
Collaborator

This new exporter mocks a destination, and allows one to simulate various back-pressure scenarios, like long time to get a response for the export, and simulating some export requests being rejected.

It is useful for pipeline development and testing

@blumamir blumamir requested a review from RonFed December 16, 2024 11:29
Copy link
Collaborator

@RonFed RonFed left a comment

Choose a reason for hiding this comment

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

Very cool


func NewMockDestinationExporter(config *Config,
params exporter.Settings) (*MockDestinationExporter, error) {

Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: maybe worth to add small config validation ?
ResponseDuration > 0
1 > RejectFraction > 0

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added in config.go under Validate function

@blumamir blumamir merged commit 793e2c9 into odigos-io:main Dec 16, 2024
29 of 32 checks passed

func (e *MockDestinationExporter) mockExport(context.Context) error {
// not taking care of ctx cancel and shutdown as this is a dummy exporter and not used in production
<-time.After(e.config.ResponseDuration)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I think time.Sleep is better as time.After create goroutine every time it is called so this has the potential to blow up CPU according to the number of parallel invocation to this function

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.

4 participants