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

Upgrade targeting-client #24833

Merged
merged 4 commits into from
Apr 5, 2022
Merged

Upgrade targeting-client #24833

merged 4 commits into from
Apr 5, 2022

Conversation

ioannakok
Copy link
Contributor

@ioannakok ioannakok commented Mar 30, 2022

What does this change?

In advance of updating the Scala version we want to update as many dependencies as possible to be compatible with both 2.12 and 2.13.

This change bumps targeting-client to the latest version which is compatible with both 2.12 and 2.13.

As part of this PR aws-java-sdk-kinesis and aws-java-sdk-ec2 had also to change from 1.11.26 to 1.11.240.

Does this change need to be reproduced in dotcom-rendering ?

  • No
  • Yes (please indicate your plans for DCR Implementation)

Screenshots

What is the value of this and can you measure success?

Checklist

Does this affect other platforms?

  • AMP
  • Apps
  • Other (please specify)

Does this affect GLabs Paid Content Pages? Should it have support for Paid Content?

  • No
  • Yes (please give details)

Does this change break ad-free?

  • No
  • It did, but tests caught it and I fixed it
  • It did, but there was no test coverage so I added that then fixed it

Does this change update the version of CAPI we're using?

Accessibility test checklist

Tested

  • Locally
  • On CODE (optional)

@@ -12,6 +12,7 @@ val common = library("common")
awsCore,
awsCloudwatch,
awsDynamodb,
awsKinesis,
Copy link
Contributor

Choose a reason for hiding this comment

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

NB: I think we'll also need to explicitly define the dependency for ec2 now as well. It's required here https://github.com/guardian/frontend/blob/main/admin/app/controllers/admin/TroubleshooterController.scala#L3, so we need to add val awsEc2 = "com.amazonaws" % "aws-java-sdk-ec2" % awsVersion to Dependencies.scala

@DavidLawes
Copy link
Contributor

We were seeing a deprecation warning when directly instantiating the AmazonKinesisAsyncClient class. The class was being instantiated inside KinesisAdapter's create method.

  • The create method overrides the sdk kinesis appender create method
  • Kinesis appender create method only accepts type AmazonKinesisAsyncClient
  • We override the create method so we can define custom retry policies
  • We instantiate SafeBlockingKinesisAppender and then create the client in LogbackConfig

The docs suggest alternative approaches to creating service clients, specifically using a client builder. However, the resulting type of the client builder is a different type to what we need (i.e. we get AmazonKinesisAsync as opposed to AmazonKinesisAsyncClient.

From the sdk we can see that, after creating and updating the client builder, we can call the build() method to give us a new client:
protected AmazonKinesisAsync build(AwsAsyncClientParams params) { return new AmazonKinesisAsyncClient(params); }
But I couldn't understand why the type returned did not match what I thought we'd get.

DavidLawes added a commit to guardian/targeting-client that referenced this pull request Apr 1, 2022
guardian/frontend#24833
Scalactic version conflicts were causing compilation failures when compiling tests in frontend

```
java.lang.NoSuchMethodError: 'void org.scalactic.BooleanMacro.<init>(scala.reflect.macros.whitebox.Context, java.lang.String)'
```
@DavidLawes
Copy link
Contributor

We were seeing a failing build in team city, eg https://teamcity.gutools.co.uk/viewLog.html?buildId=756934&buildTypeId=dotcom_master&tab=buildLog, due to an error during test compilation.

The error was a result of incompatible versions of scalactic. A version of scalactic was being defined in targeting-client, however that dependency did not need to be defined (it wasn't being directly used anywhere in the project).

Scalactic was removed from targeting-client and a new version of the library was published (1.1.2 - note that the deploy of 1.1.1 failed because I didn't have a valid setup, so we moved straight to publishing 1.1.2 in case there was a conflict from the partly-failed publishing of 1.1.1).

Hopefully now we have a working build - we may still want to look at removing the deprecated function.

@rtyley
Copy link
Member

rtyley commented Apr 1, 2022

Hi @DavidLawes ! I notice that the build didn't quite pass, but if you rebase on top of main to get #24845, then this error will go away:

[15:20:23][Step 7/9] [info] - should be deleted once expired *** FAILED ***
[15:20:23][Step 7/9] [info]   true was not equal to false (switch: 'puzzles-banner') (SwitchesTest.scala:76)

@ioannakok ioannakok changed the title WIP: Upgrade targeting-client Upgrade targeting-client Apr 4, 2022
@ioannakok ioannakok added the Scala 2.13 See https://github.com/guardian/maintaining-scala-projects/issues/2 label Apr 4, 2022
@@ -30,6 +31,7 @@ class SafeBlockingKinesisAppender(logbackOperations: LogbackOperationsPool) exte
resetTimeout = 10.seconds,
)(logbackOperations.logbackOperations)

@nowarn
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR changes aws-java-sdk-kinesis from 1.11.26 to 1.11.240. In this version AmazonKinesisAsyncClient is deprecated. A separate ticket has been created to refactor KinesisAdapter.scala and get rid of the deprecated class and the @nowarn annotation: #24846

@ioannakok ioannakok marked this pull request as ready for review April 4, 2022 10:45
@ioannakok ioannakok requested a review from a team as a code owner April 4, 2022 10:45
Copy link
Contributor

@OllysCoding OllysCoding left a comment

Choose a reason for hiding this comment

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

+1 Looks good to me!

@ioannakok ioannakok merged commit 1385182 into main Apr 5, 2022
@ioannakok ioannakok deleted the update-targeting-client branch April 5, 2022 08:11
@prout-bot prout-bot added Pending-on-PROD Seen-on-PROD and removed Scala 2.13 See https://github.com/guardian/maintaining-scala-projects/issues/2 Pending-on-PROD labels Apr 5, 2022
@prout-bot
Copy link
Collaborator

Seen on PROD (merged by @ioannakok 14 minutes and 52 seconds ago)

@ioannakok ioannakok mentioned this pull request Apr 5, 2022
@ioannakok ioannakok mentioned this pull request Aug 23, 2022
2 tasks
@rtyley rtyley added the Scala 2.13 See https://github.com/guardian/maintaining-scala-projects/issues/2 label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scala 2.13 See https://github.com/guardian/maintaining-scala-projects/issues/2 Seen-on-PROD
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants