Validate entity fields using Snowplow Micro

According to this Snowplow Micro blog post, you can validate:

  • The value of specific fields sent with specific events is as expected
  • The correct contexts / entities are sent with the appropriate events

However, it doesn’t look like it is possible to see any detail about what values were passed for the attached entities .

This means that Micro is good for validating certain events were logged and that entities were attached, but we can’t verify anything about the attached entities beyond their existence. If, as part of an automated QA process, we want to validate that when an entity has a particular property set another property is also set, how should we go about achieving that?

Hi @Michael_Bailey Welcome to the Snowplow Discourse!

When you make the GET request to http://localhost:9090/micro/good you should get a response that resembles something like…

[
  {
    "event": {
      "api": {
        "vendor": "com.snowplowanalytics.snowplow",
        "version": "tp2"
      },
      "parameters": {
        "e": "pv",
        "duid": "4372af2f-a867-433c-a4da-8cc0814ce241",
        "vid": "1",
        "eid": "2146f4ed-3cc4-4aef-b9ab-54c3f7ef25ba",
        "url": "www.example.com",
        "aid": "paul-test",
        "cx": "eyJzY2hlbWEiOiJpZ2x1OmNvbS5zbm93cGxvd2FuYWx5dGljcy5zbm93cGxvdy9jb250ZXh0cy9qc29uc2NoZW1hLzEtMC0wIiwiZGF0YSI6W3sic2NoZW1hIjoiaWdsdTpjb20uc25vd3Bsb3dhbmFseXRpY3Muc25vd3Bsb3cvd2ViX3BhZ2UvanNvbnNjaGVtYS8xLTAtMCIsImRhdGEiOnsiaWQiOiIyYjU2NTJiYi1iOTYzLTQzNzItYWYwNy1iNTQ5ODE3MTJkMGEifX1dfQ",
        "tna": "sp",
        "cs": "UTF-8",
        "cd": "24",
        "stm": "1592390105256",
        "tz": "Europe/London",
        "tv": "js-2.13.0",
...

In the parameters object, the cx property represents the contexts but they are Base64 encoded.
If you you decode this you will get another JSON object containing the entities:

{
  "schema": "iglu:com.snowplowanalytics.snowplow/contexts/jsonschema/1-0-0",
  "data": [
    {
      "schema": "iglu:com.snowplowanalytics.snowplow/web_page/jsonschema/1-0-0",
      "data": {
        "id": "2b5652bb-b963-4372-af07-b54981712d0a"
      }
    }
  ]
}

We currently working on an update to Snowplow Micro which will make this a little easier by providing these already decoded (along with some other tasty features) but I don’t yet have an ETA on when this will be released :slight_smile: