public static void stripPayloadMetadataToAttributes()

in ingestion-core/src/main/java/com/mozilla/telemetry/ingestion/core/transform/NestedMetadata.java [139:166]


  public static void stripPayloadMetadataToAttributes(Map<String, String> attributes,
      ObjectNode payload) {
    Optional //
        .ofNullable(payload) //
        .map(p -> p.remove(FieldName.METADATA)) //
        .filter(JsonNode::isObject) //
        .map(ObjectNode.class::cast) //
        .ifPresent(metadata -> {
          putGeoAttributes(attributes, metadata);
          putIspAttributes(attributes, metadata);
          putUserAgentAttributes(attributes, metadata);
          putHeaderAttributes(attributes, metadata);
          putUriAttributes(attributes, metadata);
          IDENTIFYING_FIELDS.forEach(name -> Optional.of(metadata) //
              .map(p -> metadata.remove(name)) //
              .filter(JsonNode::isTextual) //
              .ifPresent(value -> attributes.put(name, value.textValue())));
        });
    TOP_LEVEL_STRING_FIELDS.forEach(name -> Optional //
        .ofNullable(payload) //
        .map(p -> p.remove(name)) //
        .filter(JsonNode::isTextual) //
        .ifPresent(value -> attributes.put(name, value.textValue())));
    TOP_LEVEL_INT_FIELDS.forEach(name -> Optional //
        .ofNullable(payload) //
        .map(p -> p.remove(name)) //
        .ifPresent(value -> attributes.put(name, value.asText())));
  }