blob: b6185cb2e5d7e25e1b6cc574a4054b953143c104 [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.
@available(added=7)
library fuchsia.metricbroker;
using fuchsia.mem;
using zx;
// Provides a service for components to register themselves as metric providers.
// When the Broker service comes up(if it comes up), it will request the
// provider's info.
@discoverable
protocol Registry {
// Register `provider` with the metric registry. If and when the Registry service comes up,
// will perform IPC to request the provider's `ProjectInfo`.
RegisterMetricProvider(resource struct {
provider client_end:Provider;
}) -> (struct {
status zx.status;
});
};
// Represents a service that is interested in providing metrics to the Registry,
// such that at a later stage these will be mapped to consuming services based
// on the project configuration.
protocol Provider {
// Returns a `ProjectInfo` with enough information for the metrics to be processed.
GetProviderInfo() -> (resource struct {
info ProviderInfo;
}) error zx.status;
};
// Describes a collection of Inspect metrics, both where to read them from, and how to export them.
type InspectCollectionConfig = resource struct {
inspect_config InspectConfig;
inspect_source InspectSource;
};
// Information for identifying a metric provider and how should it be
// handled by the broker.
type ProviderInfo = resource struct {
// Configuration data for connecting to the Cobalt service.
// If empty, defaults are used from the calling program *somehow*.
// TODO(gevalentino): fxbug.dev/4556
cobalt_configuration box<CobaltProjectConfig>;
// Configuration data for reading inspect data and passing it along over Cobalt.
// May be empty, in which case no inspect data is collected.
inspect_configuration box<InspectCollectionConfig>;
};
// Data needed for forwarding cobalt metrics.
type CobaltProjectConfig = resource struct {
// Serialized cobalt project configuration.
// If this is set, it will override the usage of project name.
cobalt_configuration box<fuchsia.mem.Buffer>;
// Project Name as expected by Cobalt Service.
project_name string:<100, optional>;
};
type InspectSource = resource struct {
// Inspection data served over a VMO.
vmo zx.handle:VMO;
};
// The configuration that actually describes where to find data in the InspectSource and turn it
// into Cobalt metrics
type InspectConfig = flexible resource union {
// Inline configuration information.
1: buffer fuchsia.mem.Buffer;
// Reference to a broker built-in project ID that contains the config data. This is useful
// for components that do not have access to filesystems.
2: project_name string:100;
};