Search in sources :

Example 6 with Unstructured

use of com.snowplowanalytics.snowplow.tracker.events.Unstructured in project Terasology by MovingBlocks.

the class TelemetryUtils method fetchMetricAndSend.

/**
 * fetch metric in {@link org.terasology.engine.telemetry.Metrics} and send to the server.
 * @param metrics Metrics class in the game context.
 * @param metricClass The class of metric.
 * @param emitter Emitter sending telemetry to the server.
 * @param nameSpace The name the class tracking this metric.
 * @param bindingMap the binding map contains fields who has user's permission.
 */
public static void fetchMetricAndSend(Metrics metrics, Class metricClass, Emitter emitter, String nameSpace, Map<String, Boolean> bindingMap) {
    Optional<Metric> optional = metrics.getMetric(metricClass);
    if (optional.isPresent()) {
        Metric metric = optional.get();
        Optional<Unstructured> unstructuredOptional = metric.getUnstructuredMetric();
        if (unstructuredOptional.isPresent()) {
            Unstructured unstructured = unstructuredOptional.get();
            trackMetric(emitter, nameSpace, unstructured, metric, bindingMap);
        }
    }
}
Also used : Unstructured(com.snowplowanalytics.snowplow.tracker.events.Unstructured) Metric(org.terasology.engine.telemetry.metrics.Metric)

Aggregations

Unstructured (com.snowplowanalytics.snowplow.tracker.events.Unstructured)6 Emitter (com.snowplowanalytics.snowplow.tracker.emitter.Emitter)2 SelfDescribingJson (com.snowplowanalytics.snowplow.tracker.payload.SelfDescribingJson)2 Metric (org.terasology.engine.telemetry.metrics.Metric)2 Metric (org.terasology.telemetry.metrics.Metric)2 TelemetryConfiguration (org.terasology.config.facade.TelemetryConfiguration)1 TelemetryConfiguration (org.terasology.engine.config.facade.TelemetryConfiguration)1