Removed old metric api as they are out of touch with new spec. (#306)

This commit is contained in:
Cijo Thomas 2019-10-23 11:07:02 -07:00 committed by Sergey Kanzhelev
parent 997112b875
commit 83be8c1a24
22 changed files with 4 additions and 1008 deletions

View File

@ -1,287 +0,0 @@
// <copyright file="DefaultMeter.cs" company="OpenTelemetry Authors">
// Copyright 2018, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
using System;
using System.Collections.Generic;
using OpenTelemetry.Metrics.Implementation;
using OpenTelemetry.Tags;
using OpenTelemetry.Trace;
namespace OpenTelemetry.Metrics
{
/// <summary>
/// No-op implementation of a meter interface.
/// </summary>
public class DefaultMeter : IMeter
{
private static readonly CounterDoubleBuilder CounterDoubleBuilderValue = new CounterDoubleBuilder();
private static readonly CounterLongBuilder CounterLongBuilderValue = new CounterLongBuilder();
private static readonly GaugeDoubleBuilder GaugeDoubleBuilderValue = new GaugeDoubleBuilder();
private static readonly GaugeLongBuilder GaugeLongBuilderValue = new GaugeLongBuilder();
private static readonly MeasureBuilder MeasureBuilderValue = new MeasureBuilder();
/// <inheritdoc/>
public ICounterDoubleBuilder GetCounterDoubleBuilder(string name) => CounterDoubleBuilderValue;
/// <inheritdoc/>
public ICounterLongBuilder GetCounterLongBuilder(string name) => CounterLongBuilderValue;
/// <inheritdoc/>
public IGaugeDoubleBuilder GetGaugeDoubleBuilder(string name) => GaugeDoubleBuilderValue;
/// <inheritdoc/>
public IGaugeLongBuilder GetGaugeLongBuilder(string name) => GaugeLongBuilderValue;
/// <inheritdoc/>
public IMeasureBuilder GetMeasureBuilder(string name) => MeasureBuilderValue;
/// <inheritdoc/>
public void Record(IEnumerable<IMeasurement> measurements)
{
}
/// <inheritdoc/>
public void Record(IEnumerable<IMeasurement> measurements, ITagContext tagContext)
{
}
/// <inheritdoc/>
public void Record(IEnumerable<IMeasurement> measurements, ITagContext tagContext, SpanContext spanContext)
{
}
private class CounterDoubleTimeSeries : ICounterDoubleTimeSeries
{
public void Add(double delta)
{
}
public void Set(double val)
{
}
}
private class CounterDouble : ICounterDouble
{
private static readonly CounterDoubleTimeSeries TimeSeries = new CounterDoubleTimeSeries();
public void Clear()
{
}
public ICounterDoubleTimeSeries GetDefaultTimeSeries() => TimeSeries;
public ICounterDoubleTimeSeries GetOrCreateTimeSeries(IEnumerable<string> labelValues) => TimeSeries;
public void RemoveTimeSeries(IEnumerable<string> labelValues)
{
}
public void SetCallback(Action metricUpdater)
{
}
}
private class CounterDoubleBuilder : ICounterDoubleBuilder
{
private static readonly CounterDouble CounterDouble = new CounterDouble();
public IMetric<ICounterDoubleTimeSeries> Build() => CounterDouble;
public IMetricBuilder<ICounterDoubleTimeSeries> SetComponent(string component) => this;
public IMetricBuilder<ICounterDoubleTimeSeries> SetConstantLabels(IDictionary<LabelKey, string> constantLabels) => this;
public IMetricBuilder<ICounterDoubleTimeSeries> SetDescription(string description) => this;
public IMetricBuilder<ICounterDoubleTimeSeries> SetLabelKeys(IEnumerable<LabelKey> labelKeys) => this;
public IMetricBuilder<ICounterDoubleTimeSeries> SetUnit(string unit) => this;
}
private class CounterLongTimeSeries : ICounterLongTimeSeries
{
public void Add(long delta)
{
}
public void Set(long val)
{
}
}
private class CounterLong : ICounterLong
{
private static readonly CounterLongTimeSeries TimeSeries = new CounterLongTimeSeries();
public void Clear()
{
}
public ICounterLongTimeSeries GetDefaultTimeSeries() => TimeSeries;
public ICounterLongTimeSeries GetOrCreateTimeSeries(IEnumerable<string> labelValues) => TimeSeries;
public void RemoveTimeSeries(IEnumerable<string> labelValues)
{
}
public void SetCallback(Action metricUpdater)
{
}
}
private class CounterLongBuilder : ICounterLongBuilder
{
private static readonly CounterLong CounterLong = new CounterLong();
public IMetric<ICounterLongTimeSeries> Build() => CounterLong;
public IMetricBuilder<ICounterLongTimeSeries> SetComponent(string component) => this;
public IMetricBuilder<ICounterLongTimeSeries> SetConstantLabels(IDictionary<LabelKey, string> constantLabels) => this;
public IMetricBuilder<ICounterLongTimeSeries> SetDescription(string description) => this;
public IMetricBuilder<ICounterLongTimeSeries> SetLabelKeys(IEnumerable<LabelKey> labelKeys) => this;
public IMetricBuilder<ICounterLongTimeSeries> SetUnit(string unit) => this;
}
private class GaugeDoubleTimeSeries : IGaugeDoubleTimeSeries
{
public void Add(double delta)
{
}
public void Set(double val)
{
}
}
private class GaugeDouble : IGaugeDouble
{
private static readonly GaugeDoubleTimeSeries TimeSeries = new GaugeDoubleTimeSeries();
public void Clear()
{
}
public IGaugeDoubleTimeSeries GetDefaultTimeSeries() => TimeSeries;
public IGaugeDoubleTimeSeries GetOrCreateTimeSeries(IEnumerable<string> labelValues) => TimeSeries;
public void RemoveTimeSeries(IEnumerable<string> labelValues)
{
}
public void SetCallback(Action metricUpdater)
{
}
}
private class GaugeDoubleBuilder : IGaugeDoubleBuilder
{
private static readonly GaugeDouble GaugeDouble = new GaugeDouble();
public IMetric<IGaugeDoubleTimeSeries> Build() => GaugeDouble;
public IMetricBuilder<IGaugeDoubleTimeSeries> SetComponent(string component) => this;
public IMetricBuilder<IGaugeDoubleTimeSeries> SetConstantLabels(IDictionary<LabelKey, string> constantLabels) => this;
public IMetricBuilder<IGaugeDoubleTimeSeries> SetDescription(string description) => this;
public IMetricBuilder<IGaugeDoubleTimeSeries> SetLabelKeys(IEnumerable<LabelKey> labelKeys) => this;
public IMetricBuilder<IGaugeDoubleTimeSeries> SetUnit(string unit) => this;
}
private class GaugeLongTimeSeries : IGaugeLongTimeSeries
{
public void Add(long delta)
{
}
public void Set(long val)
{
}
}
private class GaugeLong : IGaugeLong
{
private static readonly GaugeLongTimeSeries TimeSeries = new GaugeLongTimeSeries();
public void Clear()
{
}
public IGaugeLongTimeSeries GetDefaultTimeSeries() => TimeSeries;
public IGaugeLongTimeSeries GetOrCreateTimeSeries(IEnumerable<string> labelValues) => TimeSeries;
public void RemoveTimeSeries(IEnumerable<string> labelValues)
{
}
public void SetCallback(Action metricUpdater)
{
}
}
private class GaugeLongBuilder : IGaugeLongBuilder
{
private static readonly GaugeLong CounterLong = new GaugeLong();
public IMetric<IGaugeLongTimeSeries> Build() => CounterLong;
public IMetricBuilder<IGaugeLongTimeSeries> SetComponent(string component) => this;
public IMetricBuilder<IGaugeLongTimeSeries> SetConstantLabels(IDictionary<LabelKey, string> constantLabels) => this;
public IMetricBuilder<IGaugeLongTimeSeries> SetDescription(string description) => this;
public IMetricBuilder<IGaugeLongTimeSeries> SetLabelKeys(IEnumerable<LabelKey> labelKeys) => this;
public IMetricBuilder<IGaugeLongTimeSeries> SetUnit(string unit) => this;
}
private class Measurement : IMeasurement
{
}
private class Measure : IMeasure
{
private static readonly IMeasurement Measurement = new Measurement();
public IMeasurement CreateDoubleMeasurement(double value) => Measurement;
public IMeasurement CreateLongMeasurement(long value) => Measurement;
}
private class MeasureBuilder : IMeasureBuilder
{
private static readonly Measure Measure = new Measure();
public IMeasure Build() => Measure;
public IMeasureBuilder SetDescription(string description) => this;
public IMeasureBuilder SetType(MeasureType type) => this;
public IMeasureBuilder SetUnit(string unit) => this;
}
}
}

View File

@ -1,27 +0,0 @@
// <copyright file="ICounterDouble.cs" company="OpenTelemetry Authors">
// Copyright 2018, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
using OpenTelemetry.Metrics.Implementation;
namespace OpenTelemetry.Metrics
{
/// <summary>
/// Counter metric, to report instantaneous measurement of a double value. Cumulative values can go
/// up or stay the same, but can never go down.Cumulative values cannot be negative.
/// </summary>
public interface ICounterDouble : IMetric<ICounterDoubleTimeSeries>
{
}
}

View File

@ -1,27 +0,0 @@
// <copyright file="ICounterLong.cs" company="OpenTelemetry Authors">
// Copyright 2018, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
using OpenTelemetry.Metrics.Implementation;
namespace OpenTelemetry.Metrics
{
/// <summary>
/// Counter metric, to report instantaneous measurement of a double value. Cumulative values can go
/// up or stay the same, but can never go down.Cumulative values cannot be negative.
/// </summary>
public interface ICounterLong : IMetric<ICounterLongTimeSeries>
{
}
}

View File

@ -1,27 +0,0 @@
// <copyright file="IGaugeDouble.cs" company="OpenTelemetry Authors">
// Copyright 2018, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
using OpenTelemetry.Metrics.Implementation;
namespace OpenTelemetry.Metrics
{
/// <summary>
/// Gauge metric, to report instantaneous measurement of a double value. Cumulative values can go
/// up or down.
/// </summary>
public interface IGaugeDouble : IMetric<IGaugeDoubleTimeSeries>
{
}
}

View File

@ -1,27 +0,0 @@
// <copyright file="IGaugeLong.cs" company="OpenTelemetry Authors">
// Copyright 2018, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
using OpenTelemetry.Metrics.Implementation;
namespace OpenTelemetry.Metrics
{
/// <summary>
/// Gauge metric, to report instantaneous measurement of a double value. Cumulative values can go
/// up or stay the same, but can never go down.Cumulative values cannot be negative.
/// </summary>
public interface IGaugeLong : IMetric<IGaugeLongTimeSeries>
{
}
}

View File

@ -1,35 +0,0 @@
// <copyright file="IMeasure.cs" company="OpenTelemetry Authors">
// Copyright 2018, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
namespace OpenTelemetry.Metrics
{
public interface IMeasure
{
/// <summary>
/// Records the measurement of this <see cref="IMeasure"/>.
/// </summary>
/// <param name="value">Value to be recorded.</param>
/// <returns>Measurement representing this value.</returns>
IMeasurement CreateDoubleMeasurement(double value);
/// <summary>
/// Records the measurement of this <see cref="IMeasure"/>.
/// </summary>
/// <param name="value">Value to be recorded.</param>
/// <returns>Measurement representing this value.</returns>
IMeasurement CreateLongMeasurement(long value);
}
}

View File

@ -1,25 +0,0 @@
// <copyright file="IMeasurement.cs" company="OpenTelemetry Authors">
// Copyright 2018, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
namespace OpenTelemetry.Metrics
{
/// <summary>
/// Immutable representation of a measurement.
/// </summary>
public interface IMeasurement
{
}
}

View File

@ -1,69 +0,0 @@
// <copyright file="IMeter.cs" company="OpenTelemetry Authors">
// Copyright 2018, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
using System.Collections.Generic;
using OpenTelemetry.Metrics.Implementation;
using OpenTelemetry.Tags;
using OpenTelemetry.Trace;
namespace OpenTelemetry.Metrics
{
/// <summary>
/// Returns a builder for <see cref="ICounterDouble"/>.
/// </summary>
public interface IMeter
{
/// <summary>
/// Gets the builder for <see cref="ICounterDouble"/>.
/// </summary>
/// <param name="name">Name of the counter.</param>
/// <returns>The builder for the <see cref="ICounterDouble"/>.</returns>
ICounterDoubleBuilder GetCounterDoubleBuilder(string name);
/// <summary>
/// Gets the builder for <see cref="ICounterLong"/>.
/// </summary>
/// <param name="name">Name of the counter.</param>
/// <returns>The builder for the <see cref="ICounterLong"/>.</returns>
ICounterLongBuilder GetCounterLongBuilder(string name);
/// <summary>
/// Gets the builder for <see cref="IGaugeDouble"/>.
/// </summary>
/// <param name="name">Name of the counter.</param>
/// <returns>The builder for the <see cref="IGaugeDouble"/>.</returns>
IGaugeDoubleBuilder GetGaugeDoubleBuilder(string name);
/// <summary>
/// Gets the builder for <see cref="IGaugeLong"/>.
/// </summary>
/// <param name="name">Name of the counter.</param>
/// <returns>The builder for the <see cref="IGaugeLong"/>.</returns>
IGaugeLongBuilder GetGaugeLongBuilder(string name);
/// <summary>
/// Gets the builder for the <see cref="IMeasure"/>.
/// </summary>
/// <param name="name">The name of the <see cref="IMeasure"/>.</param>
/// <returns>The <see cref="IMeasureBuilder"/> to build the <see cref="IMeasure"/>.</returns>
IMeasureBuilder GetMeasureBuilder(string name);
void Record(IEnumerable<IMeasurement> measurements);
void Record(IEnumerable<IMeasurement> measurements, ITagContext tagContext);
void Record(IEnumerable<IMeasurement> measurements, ITagContext tagContext, SpanContext spanContext);
}
}

View File

@ -1,70 +0,0 @@
// <copyright file="IMetric{T}.cs" company="OpenTelemetry Authors">
// Copyright 2018, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
using System;
using System.Collections.Generic;
namespace OpenTelemetry.Metrics
{
/// <summary>
/// Base interface for all metrics defined in this package.
/// </summary>
/// <typeparam name="T">Type of the time series of the metric.</typeparam>
public interface IMetric<T>
{
/// <summary>
/// Creates a time series and returns a time series if the specified labelValues
/// is not already associated with this metric, else returns an existing time series.
///
/// It is recommended to keep a reference to the time series instead of always calling this
/// method for every operations.
/// </summary>
/// <param name="labelValues">
/// The list of label values. The number of label values must be the same to
/// that of the label keys passed to.
/// </param>
/// <returns>A time series the value of single metric.</returns>
T GetOrCreateTimeSeries(IEnumerable<string> labelValues);
/// <summary>
/// Returns a time series for a metric with all labels not set (default label values).
/// </summary>
/// <returns>A time series for a metric with all labels not set (default label values).</returns>
T GetDefaultTimeSeries();
/// <summary>
/// Sets a callback that gets executed every time before exporting this metric. Used to
/// implement pull-based metric.
///
/// Evaluation is deferred until needed, if this <see cref="IMetric{T}"/> is not exported then it will never be called.
/// </summary>
/// <param name="metricUpdater">The callback to be executed before export.</param>
void SetCallback(Action metricUpdater);
/// <summary>
/// Removes the time series from the metric, if it is present. i.e. references to previous time series
/// are invalid (not part of the metric).
///
/// If value is missing for one of the predefined keys null must be used for that value.
/// </summary>
/// <param name="labelValues">The list of label values.</param>
void RemoveTimeSeries(IEnumerable<string> labelValues);
/// <summary>
/// Removes all time series from the metric. i.e. references to all previous time series are invalid (not part of the metric).
/// </summary>
void Clear();
}
}

View File

@ -1,25 +0,0 @@
// <copyright file="ICounterDoubleBuilder.cs" company="OpenTelemetry Authors">
// Copyright 2018, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
namespace OpenTelemetry.Metrics.Implementation
{
/// <summary>
/// The builder for the <see cref="ICounterDouble"/>.
/// </summary>
public interface ICounterDoubleBuilder : IMetricBuilder<ICounterDoubleTimeSeries>
{
}
}

View File

@ -1,28 +0,0 @@
// <copyright file="ICounterDoubleTimeSeries.cs" company="OpenTelemetry Authors">
// Copyright 2018, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
namespace OpenTelemetry.Metrics.Implementation
{
/// <summary>
/// Time series type for <see cref="ICounterDouble"/>.
/// </summary>
public interface ICounterDoubleTimeSeries
{
void Add(double delta);
void Set(double val);
}
}

View File

@ -1,25 +0,0 @@
// <copyright file="ICounterLongBuilder.cs" company="OpenTelemetry Authors">
// Copyright 2018, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
namespace OpenTelemetry.Metrics.Implementation
{
/// <summary>
/// The builder for the <see cref="ICounterLong"/>.
/// </summary>
public interface ICounterLongBuilder : IMetricBuilder<ICounterLongTimeSeries>
{
}
}

View File

@ -1,28 +0,0 @@
// <copyright file="ICounterLongTimeSeries.cs" company="OpenTelemetry Authors">
// Copyright 2018, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
namespace OpenTelemetry.Metrics.Implementation
{
/// <summary>
/// Time series type for <see cref="ICounterDouble"/>.
/// </summary>
public interface ICounterLongTimeSeries
{
void Add(long delta);
void Set(long val);
}
}

View File

@ -1,25 +0,0 @@
// <copyright file="IGaugeDoubleBuilder.cs" company="OpenTelemetry Authors">
// Copyright 2018, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
namespace OpenTelemetry.Metrics.Implementation
{
/// <summary>
/// The builder for the <see cref="IGaugeDouble"/>.
/// </summary>
public interface IGaugeDoubleBuilder : IMetricBuilder<IGaugeDoubleTimeSeries>
{
}
}

View File

@ -1,28 +0,0 @@
// <copyright file="IGaugeDoubleTimeSeries.cs" company="OpenTelemetry Authors">
// Copyright 2018, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
namespace OpenTelemetry.Metrics.Implementation
{
/// <summary>
/// Time series type for <see cref="IGaugeDouble"/>.
/// </summary>
public interface IGaugeDoubleTimeSeries
{
void Add(double delta);
void Set(double val);
}
}

View File

@ -1,25 +0,0 @@
// <copyright file="IGaugeLongBuilder.cs" company="OpenTelemetry Authors">
// Copyright 2018, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
namespace OpenTelemetry.Metrics.Implementation
{
/// <summary>
/// The builder for the <see cref="IGaugeLong"/>.
/// </summary>
public interface IGaugeLongBuilder : IMetricBuilder<IGaugeLongTimeSeries>
{
}
}

View File

@ -1,28 +0,0 @@
// <copyright file="IGaugeLongTimeSeries.cs" company="OpenTelemetry Authors">
// Copyright 2018, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
namespace OpenTelemetry.Metrics.Implementation
{
/// <summary>
/// Time series type for <see cref="IGaugeLong"/>.
/// </summary>
public interface IGaugeLongTimeSeries
{
void Add(long delta);
void Set(long val);
}
}

View File

@ -1,51 +0,0 @@
// <copyright file="IMeasureBuilder.cs" company="OpenTelemetry Authors">
// Copyright 2018, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
namespace OpenTelemetry.Metrics.Implementation
{
/// <summary>
/// Builder for the <see cref="IMeasure"/>.
/// </summary>
public interface IMeasureBuilder
{
/// <summary>
/// Sets the description of the <see cref="IMeasure"/>.
/// </summary>
/// <param name="description">The detailed description of the <see cref="IMeasure"/>.</param>
/// <returns>This builder object.</returns>
IMeasureBuilder SetDescription(string description);
/// <summary>
/// Sets the description of the <see cref="IMeasure"/>.
/// </summary>
/// <param name="unit">The detailed description of the <see cref="IMeasure"/>.</param>
/// <returns>This builder object.</returns>
IMeasureBuilder SetUnit(string unit);
/// <summary>
/// Sets the corresponding to the underlying value of the <see cref="IMeasure"/>.
/// </summary>
/// <param name="type">The detailed description of the <see cref="IMeasure"/>.</param>
/// <returns>This builder object.</returns>
IMeasureBuilder SetType(MeasureType type);
/// <summary>
/// Builds the <see cref="IMeasure"/>.
/// </summary>
/// <returns>The <see cref="IMeasure"/> object.</returns>
IMeasure Build();
}
}

View File

@ -1,67 +0,0 @@
// <copyright file="IMetricBuilder{T}.cs" company="OpenTelemetry Authors">
// Copyright 2018, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
using System.Collections.Generic;
namespace OpenTelemetry.Metrics.Implementation
{
/// <summary>
/// Metric builder interface.
/// </summary>
/// <typeparam name="T">Type of time series in metric.</typeparam>
public interface IMetricBuilder<T>
{
/// <summary>
/// Sets the description of the <see cref="IMetric{T}"/>.
/// </summary>
/// <param name="description">Description of the metric.</param>
/// <returns>This builder instance.</returns>
IMetricBuilder<T> SetDescription(string description);
/// <summary>
/// Sets the description of the <see cref="IMetric{T}"/>.
/// </summary>
/// <param name="unit">Unit of the metric.</param>
/// <returns>This builder instance.</returns>
IMetricBuilder<T> SetUnit(string unit);
/// <summary>
/// Sets the description of the <see cref="IMetric{T}"/>.
/// </summary>
/// <param name="labelKeys">List of keys for dynamic labels.</param>
/// <returns>This builder instance.</returns>
IMetricBuilder<T> SetLabelKeys(IEnumerable<LabelKey> labelKeys);
/// <summary>
/// Sets the description of the <see cref="IMetric{T}"/>.
/// </summary>
/// <param name="constantLabels">Set of labels with values.</param>
/// <returns>This builder instance.</returns>
IMetricBuilder<T> SetConstantLabels(IDictionary<LabelKey, string> constantLabels);
/// <summary>
/// Sets the description of the <see cref="IMetric{T}"/>.
/// </summary>
/// <param name="component">Component reporting this metric.</param>
/// <returns>This builder instance.</returns>
IMetricBuilder<T> SetComponent(string component);
/// <summary>
/// Builds the <see cref="IMetric{T}"/>.
/// </summary>
/// <returns>The new instance of <see cref="IMetric{T}"/>.</returns>
IMetric<T> Build();
}
}

View File

@ -1,31 +0,0 @@
// <copyright file="MeasureType.cs" company="OpenTelemetry Authors">
// Copyright 2018, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
namespace OpenTelemetry.Metrics.Implementation
{
public enum MeasureType
{
/// <summary>
/// Long type values.
/// </summary>
Long,
/// <summary>
/// Double type values.
/// </summary>
Double,
}
}

View File

@ -1,53 +0,0 @@
// <copyright file="LabelKey.cs" company="OpenTelemetry Authors">
// Copyright 2018, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
namespace OpenTelemetry.Metrics
{
/// <summary>
/// The key of a label associated with a <see cref="IMetric{T}"/>.
/// </summary>
public sealed class LabelKey
{
private LabelKey()
{
}
/// <summary>
/// Gets a key of the label.
/// </summary>
public string Key { get; private set; }
/// <summary>
/// Gets a human-readable description of what this label key represents.
/// </summary>
public string Description { get; private set; }
/// <summary>
/// Creates a new instance of a <see cref="LabelKey"/>.
/// </summary>
/// <param name="key">The key of the label.</param>
/// <param name="description">A human-readable description of what this label key represents.</param>
/// <returns>A new instance of <see cref="LabelKey"/>.</returns>
public static LabelKey Create(string key, string description)
{
return new LabelKey()
{
Key = key,
Description = description,
};
}
}
}

View File

@ -14,4 +14,8 @@
<ItemGroup>
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.6.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Metrics\" />
</ItemGroup>
</Project>