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

Add a conversion function between RawEvent and CollectorPayload #23

Open
chuwy opened this issue Nov 7, 2019 · 4 comments
Open

Add a conversion function between RawEvent and CollectorPayload #23

chuwy opened this issue Nov 7, 2019 · 4 comments

Comments

@chuwy
Copy link
Contributor

chuwy commented Nov 7, 2019

... and CollectorPayload -> List[RawEvent]?

Technically, it should be almost lossless operation. This is out of scope of snowplow-badrows project, but until we have a better place for these payloads, I think we can leave it.

/cc @peel @benjben

@chuwy chuwy added this to the Version 0.1.0 milestone Nov 7, 2019
@benjben
Copy link
Contributor

benjben commented Nov 7, 2019

Is there another place that the recovery job where we would want to do that?

@chuwy
Copy link
Contributor Author

chuwy commented Nov 8, 2019

That's a good question. It feels that we might want to do it in SCE.

@chuwy chuwy closed this as completed Jan 6, 2020
@chuwy chuwy modified the milestones: Version 0.1.0, Version 0.2.0 Jan 17, 2020
@chuwy
Copy link
Contributor Author

chuwy commented Jan 17, 2020

Closed by mistake.

@chuwy chuwy reopened this Jan 17, 2020
@benjben benjben removed this from the Version 0.1.1 milestone Mar 10, 2020
@lukeindykiewicz
Copy link

Some hints from Anton:

case class CollectorPayload(
  vendor: String,                     // +
  version: String,                    // +
  querystring: List[NVP],             // Possibly empty. If not empty, body is `None` (it was GET request)
  contentType: Option[String],        // +
  body: Option[String],               // Possibly `None`. If `Some`, contentType is empty (it was POST request)
  collector: String,                  // +
  encoding: String,                   // +
  hostname: Option[String],           // +
  timestamp: Option[DateTime],        // +
  ipAddress: Option[String],          // +
  useragent: Option[String],          // +
  refererUri: Option[String],         // +
  headers: List[String],              // +
  networkUserId: Option[UUID]         // +
)
case class RawEvent(
  vendor: String,                     // + 
  version: String,                    // +
  parameters: Map[String, String],    // Either querystring.toList or body.flatMap(parseJson).flatMap(_.asObject).getOrElse(Map.empty)
  contentType: Option[String],        // +
  loaderName: String,                 // ???
  encoding: String,                   // +
  hostname: Option[String],           // +
  timestamp: Option[DateTime],        // +
  ipAddress: Option[String],          // +
  useragent: Option[String],          // +
  refererUri: Option[String],         // +
  headers: List[String],              // +
  userId: Option[UUID]                // +
)

Everything with + is just a direct mapping

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

No branches or pull requests

3 participants