User:Phuedx/Metrics Platform/Getting Started/Creating An Instrument

From Wikitech

What Question Are You Trying to Answer?

We create instruments to help answer questions and (in)validate predictions.

statsd

If you only have one or two metrics that you want to measure, then you should consider sending your measurements to statsd. Quoting statsd:

This is useful when you only require one or more values to be aggregated, without needing the overhead of an EventLogging schema or storing each entry in a relational database.

Event though the Metrics Platform aims to reduce friction when creating instruments, statsd is essentially frictionless. You can read more about how to send data to statsd here.

Create a Stream

$wgEventStreams, defined in the EventStreamConfigs extension, is a map of stream name to stream configuration. To create a stream, you must add an entry to the map. The stream must specify at least a schema_title but you must also specify a metrics_platform_client producer configuration in order for the Metrics Platform Clients to dispatch events to the stream , e.g.

<?php

$wgEventStream = [
    'my.instrument' => [
        'producers' => [
            'metrics_platform_client' => [
                'events' => [

                    // Matches my.instrument.event_1, .event_2, etc.
                    'my.instrument.event_',
                ],
            ],
        ],
    ],
];

See Event Platform/Stream Configuration for additional detail about stream configuration.

Create an Instrument

JS

PHP

Java

FIXME: The Java Metrics Platform Client is not production ready yet.

Swift

FIXME: The Swift Metrics Platform Client is not production ready yet.