Skip to content

Commit

Permalink
feat(host-metrics): update host metrics to collect metrics in batch (o…
Browse files Browse the repository at this point in the history
…pen-telemetry#1450)

Co-authored-by: Haddas Bronfman <[email protected]>
  • Loading branch information
legendecas and haddasbronfman authored Apr 6, 2023
1 parent fd5f87e commit 6c708d1
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 268 deletions.
6 changes: 0 additions & 6 deletions packages/opentelemetry-host-metrics/src/BaseMetrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import { VERSION } from './version';
* Metrics Collector Configuration
*/
export interface MetricsCollectorConfig {
// maximum timeout to wait for stats collection default is 500ms
maxTimeoutUpdateMS?: number;
// Meter Provider
meterProvider?: metrics.MeterProvider;
// Character to be used to join metrics - default is "."
Expand All @@ -35,22 +33,18 @@ export interface MetricsCollectorConfig {
url?: string;
}

export const DEFAULT_MAX_TIMEOUT_UPDATE_MS = 500;
const DEFAULT_NAME = 'opentelemetry-host-metrics';

/**
* Base Class for metrics
*/
export abstract class BaseMetrics {
protected _logger = api.diag;
protected _maxTimeoutUpdateMS: number;
protected _meter: api.Meter;
private _name: string;

constructor(config: MetricsCollectorConfig) {
this._name = config.name || DEFAULT_NAME;
this._maxTimeoutUpdateMS =
config.maxTimeoutUpdateMS || DEFAULT_MAX_TIMEOUT_UPDATE_MS;
const meterProvider =
config.meterProvider! || api.metrics.getMeterProvider();
if (!config.meterProvider) {
Expand Down
Loading

0 comments on commit 6c708d1

Please sign in to comment.