Search in sources :

Example 1 with SelfDescribingJson

use of com.snowplowanalytics.snowplow.tracker.payload.SelfDescribingJson in project Terasology by MovingBlocks.

the class Metric method getUnstructuredMetric.

/**
 * Generates a snowplow unstructured event.
 * This method helps to implement abstract getUnstructuredMetric method.
 * You can find example in {@link org.terasology.telemetry.metrics.ModulesMetric} and {@link org.terasology.telemetry.metrics.SystemContextMetric}
 * @param schema the snowplow event register schema.
 * @param mapSentToServer the map that contains the data sent to the server.
 * @return Null option if the mapSentToServer doesn't contain data.
 */
public Optional<Unstructured> getUnstructuredMetric(String schema, Map<String, Object> mapSentToServer) {
    Optional<Unstructured> optional = Optional.empty();
    if (!isEmpty()) {
        SelfDescribingJson modulesData = new SelfDescribingJson(schema, mapSentToServer);
        Unstructured unstructured = Unstructured.builder().eventData(modulesData).build();
        optional = Optional.of(unstructured);
    }
    return optional;
}
Also used : Unstructured(com.snowplowanalytics.snowplow.tracker.events.Unstructured) SelfDescribingJson(com.snowplowanalytics.snowplow.tracker.payload.SelfDescribingJson)

Aggregations

Unstructured (com.snowplowanalytics.snowplow.tracker.events.Unstructured)1 SelfDescribingJson (com.snowplowanalytics.snowplow.tracker.payload.SelfDescribingJson)1