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

Transformer configuration UX changes #421

Merged

Conversation

gregschohn
Copy link
Collaborator

Description

Transformation improvements.
I've added all of the transformer jars to the runtime closure of the replayer since it's going to be a challenge for users using a cloud-deployment shrink-wrap solution to add addition jarfiles.
Change the syntax/rules for Transformer configs.

  • If no argument was specified for the transformer config, no transformer used, regardless of what's in the classpath.
  • To use multiple transformers, you’ll need to specify the transformer-config as a json array (of json transformer configs)
  • To use one transformer with default settings, you can JUST put the name of the transformer in the arg. e.g. --transformer-config JsonTransformerForOpenSearch23PlusTargetTransformerProvider.

I've also updated the key name to only use the short, simple name of a class rather than the fully qualified one with the namespace.
Add a NoopTransformer, which makes unit and sanity testing a lot simpler.

Issues Resolved

https://opensearch.atlassian.net/browse/MIGRATIONS-1429

Testing

gradle build

Check List

  • New functionality includes testing
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

I've added all of the transformer jars to the runtime closure of the replayer since it's going to be a challenge for users using a cloud-deployment shrink-wrap solution to add addition jarfiles.
Change the syntax/rules for Transformer configs.
* If no argument was specified for the transformer config, no transformer used, regardless of what's in the classpath.
* To use multiple transformers, you’ll need to specify the transformer-config as a json array (of json transformer configs)
* To use one transformer with default settings, you can JUST put the name of the transformer in the arg.  e.g. --transformer-config JsonTransformerForOpenSearch23PlusTargetTransformerProvider.

I've also updated the key name to only use the short, simple name of a class rather than the fully qualified one with the namespace.
Add a NoopTransformer, which makes unit and sanity testing a lot simpler.

Signed-off-by: Greg Schohn <greg.schohn@gmail.com>
# Conflicts:
#	TrafficCapture/trafficReplayer/build.gradle
(repeated)
I've added all of the transformer jars to the runtime closure of the replayer since it's going to be a challenge for users using a cloud-deployment shrink-wrap solution to add addition jarfiles.
Change the syntax/rules for Transformer configs.
* If no argument was specified for the transformer config, no transformer used, regardless of what's in the classpath.
* To use multiple transformers, you’ll need to specify the transformer-config as a json array (of json transformer configs)
* To use one transformer with default settings, you can JUST put the name of the transformer in the arg. e.g. --transformer-config JsonTransformerForOpenSearch23PlusTargetTransformerProvider.

I've also updated the key name to only use the short, simple name of a class rather than the fully qualified one with the namespace.
Add a NoopTransformer, which makes unit and sanity testing a lot simpler.

Signed-off-by: Greg Schohn <greg.schohn@gmail.com>
@gregschohn gregschohn force-pushed the EnableUserAgentTweakViaJolt branch from 13eb329 to f0dcc00 Compare November 14, 2023 04:16
Copy link

codecov bot commented Nov 14, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (7c561b6) 62.67% compared to head (13eb329) 62.86%.
Report is 3 commits behind head on main.

❗ Current head 13eb329 differs from pull request most recent head f0dcc00. Consider uploading reports for the commit f0dcc00 to get more accurate results

Files Patch % Lines
...search/migrations/replay/TransformationLoader.java 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #421      +/-   ##
============================================
+ Coverage     62.67%   62.86%   +0.19%     
- Complexity      869      871       +2     
============================================
  Files           100      100              
  Lines          4343     4341       -2     
  Branches        412      410       -2     
============================================
+ Hits           2722     2729       +7     
+ Misses         1348     1341       -7     
+ Partials        273      271       -2     
Flag Coverage Δ
unittests 62.86% <85.71%> (+0.19%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gregschohn gregschohn changed the title Enable user agent tweak via jolt Transformer tweaks Nov 14, 2023
@gregschohn gregschohn changed the title Transformer tweaks Transformer configuration UX changes Nov 14, 2023
@gregschohn gregschohn mentioned this pull request Nov 14, 2023
4 tasks
@Test
public void testThatSimpleNoopTransformerLoads() throws Exception {
var noopTransformer = new TransformationLoader()
.getTransformerFactoryLoader("localhost", "NoopTransformerProvider");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we currently have any other existing transformation providers besides "NoopTransformerProvider" ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In the base package, no. In TrafficReplayer, there's a HostTransformer & soon a UserAgentTransformer. Transformers exist for Jolt and JMESPath in separate packages.

@gregschohn gregschohn merged commit 9eed2d7 into opensearch-project:main Nov 14, 2023
7 checks passed
@gregschohn gregschohn deleted the EnableUserAgentTweakViaJolt branch November 30, 2023 15: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