blob: fd492d3d36c72f97f1cd0c67e5ffa3b5e8cacfe5 [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.metrics.test;
using fuchsia.metrics as metrics;
/// Maximum number of events returned by a query.
const MAX_QUERY_LENGTH uint16 = 64;
/// This is currently not exhaustive.
type LogMethod = strict enum {
/// LoggerQuerier provides a way to query mock metrics services to check that
/// clients of metrics are logging events as expected.
protocol MetricEventLoggerQuerier {
/// Returns the _first_ N events that were logged for the logger with the
/// given `project_id` and a `more` flag indicating whether there were
/// more than N events logged. There is no way to retrieve events logged
/// after the first N events.
/// Will hang until at least one metrics metric is recorded for the given
/// `project_id` and `method`.
/// Repeated calls to WatchLogs for a given LogMethod will block until new
/// events are logged with that method, enabling tests to synchronize
/// without sleeps or timeouts.
WatchLogs(struct {
project_id uint32;
method LogMethod;
}) -> (struct {
events vector<metrics.MetricEvent>:MAX_QUERY_LENGTH;
more bool;
/// Clear all logged events by logging `method` for the logger with the
/// given `project_id`.
/// This is a no-op if a logger for the given `project_id` does not exist.
/// Notably, it does _not_ create a new logger with `project_id` if one
/// does not already exist.
ResetLogger(struct {
project_id uint32;
method LogMethod;