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

r100-epidaurus #3599

Merged
merged 12 commits into from
Feb 26, 2018
Merged

r100-epidaurus #3599

merged 12 commits into from
Feb 26, 2018

Conversation

knservis
Copy link
Contributor

@knservis knservis commented Jan 29, 2018

TODO:

Known issues:

@knservis knservis added this to the R100 Epidaurus (PII Enrichment phase 1) milestone Jan 29, 2018
@knservis knservis force-pushed the release/gdpr-1 branch 2 times, most recently from 02eeb71 to 95c9e16 Compare January 30, 2018 14:49
@alexanderdean alexanderdean removed their request for review January 30, 2018 22:47
@alexanderdean
Copy link
Member

Hey @knservis - please add me as reviewer only when @chuwy has green-ticked. That will be my cue to get this deployed and tested.

@alexanderdean
Copy link
Member

@chuwy is out today

Copy link
Contributor

@chuwy chuwy left a comment

Choose a reason for hiding this comment

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

Hey @knservis,

So, all good for me. Though I have couple questions about scalafmt-commits.

  1. Was it applied to to your PII Enrichment commit? It doesn't look so. If no then how does it work?
  2. As already mentioned I don't like bringing all these formatting tools straight inside code-base: otherwise we'll end up with ten different tools for linting and formatting, each one is doing some overly automatic job. I'd like to keep those out of working tree and use it rather as "conflict resolver" rather than "chief editor". I'm not going to block on it, but please consider leaving only Scala Common Enrich: apply automated code formatting  #3532

name := "snowplow-common-enrich",
version := "0.31.0-M1",
description := "Common functionality for enriching raw Snowplow events",
scalafmtConfig := file(".scalafmt.conf"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move this to separate set of settings, like BuildSettings.formatting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -1 +1,5 @@
addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0")

addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-RC13")
Copy link
Contributor

Choose a reason for hiding this comment

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

Is coursier a part of scalafmt commit? Is it required?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is some sort of bug in the plugin when using it with ivy. I could only get it to work with coursier.

Copy link
Contributor

Choose a reason for hiding this comment

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

can we use 1.0.1? It's been released since this commit.

EnrichmentRegistry,
EnrichmentManager
}
import adapters.{AdapterRegistry, RawEvent}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm still very hazy on these kind of indentations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. In this instance the alignment is a bit weird. There are three options:

  1. Change settings in scalafmt for all files
  2. Switch off formatting locally there
  3. In this particular case, move the import outputs.EnrichedEvent between the two multi imports so that scalafmt won't try to align them.

Copy link
Contributor

Choose a reason for hiding this comment

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

What implications has first option?

Copy link
Contributor Author

@knservis knservis Feb 5, 2018

Choose a reason for hiding this comment

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

It will affect formatting in all files. If you want to experiment with it, just modify .scalafmt.conf on the root of SCE and run sbt clean compile. Then you can see the changes with git diff.

Copy link
Contributor

Choose a reason for hiding this comment

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

can we fix this in the end?

Copy link
Member

Choose a reason for hiding this comment

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

What is happening with this? I thought R100 was code complete...

Copy link
Contributor

Choose a reason for hiding this comment

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

this was fixed afaict

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey, sorry i did not respond to that comment. I thought that this is all resolved (#3599 (comment)). Yes that was addressed along with all other formatting

trait Enrichment {
val version: DefaultArtifactVersion
}
trait Enrichment
Copy link
Contributor

Choose a reason for hiding this comment

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

So, as we deleted its single member, is there any other justification for its existence left?

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 think it is useful as a "marker trait" enabling things like the EnrichmentMap here:

but I may be wrong

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, it seems to enable some kind of reflection-based machinery, but I don't see why it cannot be implemented in less boilerplate and reflection-less way: https://github.com/snowplow/snowplow/blob/master/3-enrich/scala-common-enrich/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/EnrichmentRegistry.scala#L330. Do you think it is worth to create an issue to explore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any opportunity to remove reflection is worth looking into. I created #3610

@knservis
Copy link
Contributor Author

knservis commented Feb 5, 2018

@chuwy

  1. Yes it was used there.

  2. I thought we wanted a single formatting tool to ensure formatting automatically. Lets talk about it.

Copy link
Contributor

@BenFradet BenFradet left a comment

Choose a reason for hiding this comment

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

Looks good 👍 , however I'm wondering if we couldn't make things more consistent regarding alignment.

Sometimes the formatted version feels weirder than the original.

@@ -1 +1,5 @@
addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0")

addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-RC13")
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use 1.0.1? It's been released since this commit.

EnrichmentRegistry,
EnrichmentManager
}
import adapters.{AdapterRegistry, RawEvent}
Copy link
Contributor

Choose a reason for hiding this comment

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

can we fix this in the end?

@@ -0,0 +1,14 @@
style = default
align = some
maxColumn = 140
Copy link
Contributor

Choose a reason for hiding this comment

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

can we reduce this so that it at least fits github number of columns (I believe it's 120) or even lower? that will ease reviews

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@BenFradet I am not sure what the GH recommended max width is. 120 sounds good to me, although it will cause some reformatting (e.g. 3-enrich/scala-common-enrich/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/UrbanAirshipAdapter.scala L53)

@@ -494,7 +512,7 @@ object GoogleAnalyticsAdapter extends Adapter {
* @return a translated params
*/
private def translatePayload(
originalParams: Map[String, String],
originalParams: Map[String, String],
Copy link
Contributor

Choose a reason for hiding this comment

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

can we exclude this type of alignment? doesn't make a lot of sense to me, if we can't that's fine...

case (None, _) => s"Request body is empty: no ${VendorName} event to process".failNel
case (_, None) => s"Request body provided but content type empty, expected ${ContentType} for ${VendorName}".failNel
case (_, Some(ct)) if ct != ContentType => s"Content type of ${ct} provided, expected ${ContentType} for ${VendorName}".failNel
case (Some(body), _) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand why sometime => are aligned and sometimes members of the patmat are aligned, can we prioritize one over the others?

@BenFradet
Copy link
Contributor

fomatting looks nice 👍

@knservis knservis force-pushed the release/gdpr-1 branch 2 times, most recently from ff0e03f to 5224015 Compare February 15, 2018 08:41
@BenFradet
Copy link
Contributor

@knservis afaict #3598 is missing from the commits and #3604 is missing from the changelog entries

@knservis
Copy link
Contributor Author

@BenFradet Fixed both

@knservis knservis force-pushed the release/gdpr-1 branch 3 times, most recently from 65e7e25 to 15138ab Compare February 21, 2018 14:56
override def scramble(clearText: String): String = hash(clearText)
def hash(text: String): String = {
val bytes = hashFunction.digest(text.getBytes(TextEncoding))
String.format("%0" + bytes.size*2 + "x", new java.math.BigInteger(1, bytes))
Copy link
Contributor Author

@knservis knservis Feb 21, 2018

Choose a reason for hiding this comment

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

@chuwy What do you think about this formatting string? The objective is to keep the output at constant length. The byte array should have always the same length for the same algorithm.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it looks good to me. Though I don't think I'm aware of all implications it has.

@BenFradet
Copy link
Contributor

@knservis can you add an example pii enrichment in https://github.com/snowplow/snowplow/tree/master/3-enrich/config/enrichments as part of #3472 ?

@BenFradet
Copy link
Contributor

and also reorder the commits so that Prepare for release is last both in order and chronologically.

@knservis knservis force-pushed the release/gdpr-1 branch 2 times, most recently from daaa656 to 354e8a3 Compare February 22, 2018 13:35
@BenFradet
Copy link
Contributor

it's because gh orders commits according to their timestamps

@knservis knservis force-pushed the release/gdpr-1 branch 2 times, most recently from e16671a to 082ee77 Compare February 22, 2018 14:58
@BenFradet
Copy link
Contributor

Also how do we deal with:

For a specific invalid configuration scenario the code may create a new key pointing to an empty object. See: json-path/JsonPath#438

@knservis
Copy link
Contributor Author

@BenFradet According to @alexanderdean this is not a showstopper and a very unlikely case. I could fix it on jayway probably.

@alexanderdean
Copy link
Member

Let's create a bug issue to track this edge case

@BenFradet
Copy link
Contributor

created #3636

@knservis knservis force-pushed the release/gdpr-1 branch 2 times, most recently from 39e352b to 4af8550 Compare February 23, 2018 16:38
@knservis knservis force-pushed the release/gdpr-1 branch 2 times, most recently from fe750c1 to 9c8b5c3 Compare February 26, 2018 12:05
@BenFradet BenFradet merged commit a1bf092 into master Feb 26, 2018
@alexanderdean
Copy link
Member

Exciting!

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.

None yet

4 participants