1
1
/*
2
2
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- *
3
+ *
4
4
* Licensed under the Apache License, Version 2.0 (the "License").
5
5
* You may not use this file except in compliance with the License.
6
6
* A copy of the License is located at
7
- *
7
+ *
8
8
* http://aws.amazon.com/apache2.0
9
- *
9
+ *
10
10
* or in the "license" file accompanying this file. This file is distributed
11
11
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12
12
* express or implied. See the License for the specific language governing
13
13
* permissions and limitations under the License.
14
14
*/
15
15
16
- using System ;
17
16
using System . Collections . Generic ;
18
17
19
18
namespace AWS . Lambda . Powertools . Metrics ;
20
19
21
20
/// <summary>
22
- /// Interface IMetrics
23
- /// Implements the <see cref="System.IDisposable" />
21
+ /// Interface for metrics operations.
24
22
/// </summary>
25
23
/// <seealso cref="System.IDisposable" />
26
- public interface IMetrics
24
+ public interface IMetrics
27
25
{
28
26
/// <summary>
29
- /// Adds metric
27
+ /// Adds a metric to the collection.
30
28
/// </summary>
31
- /// <param name="key">Metric key</param>
32
- /// <param name="value">Metric value</param>
33
- /// <param name="unit">Metric unit</param>
34
- /// <param name="metricResolution"></param>
35
- void AddMetric ( string key , double value , MetricUnit unit , MetricResolution metricResolution ) ;
29
+ /// <param name="key">The metric key.</param>
30
+ /// <param name="value">The metric value.</param>
31
+ /// <param name="unit">The metric unit.</param>
32
+ /// <param name="resolution">The metric resolution.</param>
33
+ void AddMetric ( string key , double value , MetricUnit unit = MetricUnit . None ,
34
+ MetricResolution resolution = MetricResolution . Default ) ;
36
35
37
36
/// <summary>
38
- /// Adds a dimension
37
+ /// Adds a dimension to the collection.
39
38
/// </summary>
40
- /// <param name="key">Dimension key</param>
41
- /// <param name="value">Dimension value</param>
39
+ /// <param name="key">The dimension key. </param>
40
+ /// <param name="value">The dimension value. </param>
42
41
void AddDimension ( string key , string value ) ;
43
42
44
43
/// <summary>
45
- /// Sets the default dimensions
44
+ /// Adds metadata to the collection.
46
45
/// </summary>
47
- /// <param name="defaultDimension">Default dimensions</param>
48
- void SetDefaultDimensions ( Dictionary < string , string > defaultDimension ) ;
46
+ /// <param name="key">The metadata key.</param>
47
+ /// <param name="value">The metadata value.</param>
48
+ void AddMetadata ( string key , object value ) ;
49
49
50
50
/// <summary>
51
- /// Adds metadata
51
+ /// Sets the default dimensions.
52
52
/// </summary>
53
- /// <param name="key">Metadata key</param>
54
- /// <param name="value">Metadata value</param>
55
- void AddMetadata ( string key , object value ) ;
53
+ /// <param name="defaultDimensions">The default dimensions.</param>
54
+ void SetDefaultDimensions ( Dictionary < string , string > defaultDimensions ) ;
56
55
57
56
/// <summary>
58
- /// Pushes a single metric with custom namespace, service and dimensions .
57
+ /// Sets the namespace for the metrics .
59
58
/// </summary>
60
- /// <param name="metricName">Name of the metric</param>
61
- /// <param name="value">Metric value</param>
62
- /// <param name="unit">Metric unit</param>
63
- /// <param name="nameSpace">Metric namespace</param>
64
- /// <param name="service">Metric service</param>
65
- /// <param name="defaultDimensions">Metric default dimensions</param>
66
- /// <param name="metricResolution">Metrics resolution</param>
67
- void PushSingleMetric ( string metricName , double value , MetricUnit unit , string nameSpace = null ,
68
- string service = null , Dictionary < string , string > defaultDimensions = null , MetricResolution metricResolution = MetricResolution . Default ) ;
59
+ /// <param name="nameSpace">The namespace.</param>
60
+ void SetNamespace ( string nameSpace ) ;
69
61
70
62
/// <summary>
71
- /// Sets the namespace
63
+ /// Sets the service name for the metrics.
72
64
/// </summary>
73
- /// <param name="nameSpace">Metrics namespace</param>
74
- void SetNamespace ( string nameSpace ) ;
65
+ /// <param name="service">The service name.</param>
66
+ void SetService ( string service ) ;
67
+
68
+ /// <summary>
69
+ /// Sets whether to raise an event on empty metrics.
70
+ /// </summary>
71
+ /// <param name="raiseOnEmptyMetrics">If set to <c>true</c>, raises an event on empty metrics.</param>
72
+ void SetRaiseOnEmptyMetrics ( bool raiseOnEmptyMetrics ) ;
75
73
76
74
/// <summary>
77
- /// Gets the namespace
75
+ /// Sets whether to capture cold start metrics.
78
76
/// </summary>
79
- /// <returns>System.String.</returns >
80
- string GetNamespace ( ) ;
77
+ /// <param name="captureColdStart">If set to <c>true</c>, captures cold start metrics.</param >
78
+ void SetCaptureColdStart ( bool captureColdStart ) ;
81
79
82
80
/// <summary>
83
- /// Gets the service
81
+ /// Pushes a single metric to the collection.
84
82
/// </summary>
85
- /// <returns>System.String.</returns>
86
- string GetService ( ) ;
83
+ /// <param name="name">The metric name.</param>
84
+ /// <param name="value">The metric value.</param>
85
+ /// <param name="unit">The metric unit.</param>
86
+ /// <param name="nameSpace">The namespace.</param>
87
+ /// <param name="service">The service name.</param>
88
+ /// <param name="defaultDimensions">The default dimensions.</param>
89
+ /// <param name="resolution">The metric resolution.</param>
90
+ void PushSingleMetric ( string name , double value , MetricUnit unit , string nameSpace = null , string service = null ,
91
+ Dictionary < string , string > defaultDimensions = null , MetricResolution resolution = MetricResolution . Default ) ;
87
92
88
93
/// <summary>
89
- /// Serializes metrics instance
94
+ /// Clears the default dimensions.
90
95
/// </summary>
91
- /// <returns>System.String.</returns>
92
- string Serialize ( ) ;
96
+ void ClearDefaultDimensions ( ) ;
93
97
94
98
/// <summary>
95
- /// Flushes metrics to CloudWatch
99
+ /// Flushes the metrics.
96
100
/// </summary>
97
- /// <param name="metricsOverflow">if set to <c>true</c> [ metrics overflow] .</param>
101
+ /// <param name="metricsOverflow">If set to <c>true</c>, indicates a metrics overflow.</param>
98
102
void Flush ( bool metricsOverflow = false ) ;
99
-
103
+
100
104
/// <summary>
101
- /// Clears both default dimensions and dimensions lists
105
+ /// Gets the metrics options.
102
106
/// </summary>
103
- void ClearDefaultDimensions ( ) ;
104
- }
107
+ /// <value>The metrics options.</value>
108
+ public MetricsOptions Options { get ; }
109
+ }
0 commit comments