Skip to content

Commit 3f06469

Browse files
Add Akri observability metrics operations definition and update project references
1 parent ace2c4d commit 3f06469

File tree

3 files changed

+312
-0
lines changed

3 files changed

+312
-0
lines changed

dotnet/src/Azure.Iot.Operations.Services/Azure.Iot.Operations.Services.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
<Content Include="..\..\..\eng\dtdl\aep-type-based-operations.json">
3232
<Link>AssetAndDeviceRegistry\aep-type-based-operations.json</Link>
3333
</Content>
34+
<Content Include="..\..\..\eng\dtdl\akri-observability-metrics-operations.json">
35+
<Link>Observability\akri-observability-metrics-operations.json</Link>
36+
</Content>
3437
<Content Include="..\..\..\eng\dtdl\device-name-based-operations.json">
3538
<Link>AssetAndDeviceRegistry\device-name-based-operations.json</Link>
3639
</Content>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#rm -rf ./AdrBaseService
2+
#mkdir ./AdrBaseService
3+
#rm -rf ./AepTypeService
4+
#mkdir ./AepTypeService
5+
#rm -rf ./Common
6+
#mkdir ./Common
7+
../../../../codegen/src/Azure.Iot.Operations.ProtocolCompiler/bin/Debug/net9.0/Azure.Iot.Operations.ProtocolCompiler --modelFile ../../../../eng/dtdl/akri-observability-metrics-operations.json --lang csharp --outDir /tmp/Azure.Iot.Operations.Services.Observability
8+
#cp -f /tmp/Azure.Iot.Operations.Services.Observability/AdrBaseService/*.cs AdrBaseService -v
9+
#cp -f /tmp/Azure.Iot.Operations.Services.Observability/*.cs Common -v
10+
#rm -rf /tmp/Azure.Iot.Operations.Services.Observability -v
Lines changed: 299 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,299 @@
1+
[
2+
{
3+
"@context": [
4+
"dtmi:dtdl:context;4",
5+
"dtmi:dtdl:extension:mqtt;2",
6+
"dtmi:dtdl:extension:requirement;1"
7+
],
8+
"@id": "dtmi:com:microsoft:akri:AkriObservabilityService;1",
9+
"description": "Defines the MQTT-based contract for publishing telemetry metrics from Akri component in AIO.",
10+
"@type": ["Interface", "Mqtt"],
11+
"payloadFormat": "Json/ecma/404",
12+
"commandTopic": "akri/observability/{ex:connectorClientId}/metrics",
13+
"schemas": [
14+
{
15+
"@type": "Object",
16+
"@id": "dtmi:com:microsoft:akri:MetricDefinition;1",
17+
"description": "Shared identifying and descriptive properties of a metric.",
18+
"fields": [
19+
{
20+
"@type": ["Field", "Required"],
21+
"name": "name",
22+
"description": "A unique, human-readable name that identifies the metric.",
23+
"schema": "string"
24+
},
25+
{
26+
"@type": ["Field", "Required"],
27+
"name": "labels",
28+
"description": "Key-value pairs that provide dimensional context for the metric.",
29+
"schema": {
30+
"@type": "Map",
31+
"mapKey": {
32+
"name": "labelKey",
33+
"schema": "string"
34+
},
35+
"mapValue": {
36+
"name": "labelValue",
37+
"schema": "string"
38+
}
39+
}
40+
},
41+
{
42+
"@type": "Field",
43+
"name": "unit",
44+
"description": "The unit of measurement associated with the metric (e.g., seconds, bytes).",
45+
"schema": "string"
46+
}
47+
]
48+
},
49+
{
50+
"@type": "Object",
51+
"@id": "dtmi:com:microsoft:akri:CounterMetric;1",
52+
"description": "Defines a Counter metric and its associated Increment operations.",
53+
"fields": [
54+
{
55+
"@type": ["Field", "Required"],
56+
"name": "definition",
57+
"description": "Common identifying properties of the Counter metric.",
58+
"schema": "dtmi:com:microsoft:akri:MetricDefinition;1"
59+
},
60+
{
61+
"@type": ["Field", "Required"],
62+
"name": "operations",
63+
"description": "List of Increment operations for this Counter metric.",
64+
"schema": {
65+
"@type": "Array",
66+
"elementSchema": "dtmi:com:microsoft:akri:IncrementOperation;1"
67+
}
68+
}
69+
]
70+
},
71+
{
72+
"@type": "Object",
73+
"@id": "dtmi:com:microsoft:akri:GaugeMetric;1",
74+
"description": "Defines a Gauge metric and its associated Record operations.",
75+
"fields": [
76+
{
77+
"@type": ["Field", "Required"],
78+
"name": "definition",
79+
"description": "Common identifying properties of the Gauge metric.",
80+
"schema": "dtmi:com:microsoft:akri:MetricDefinition;1"
81+
},
82+
{
83+
"@type": ["Field", "Required"],
84+
"name": "operations",
85+
"description": "List of Record operations for this Gauge metric.",
86+
"schema": {
87+
"@type": "Array",
88+
"elementSchema": "dtmi:com:microsoft:akri:RecordOperation;1"
89+
}
90+
}
91+
]
92+
},
93+
{
94+
"@type": "Object",
95+
"@id": "dtmi:com:microsoft:akri:HistogramMetric;1",
96+
"description": "Defines a Histogram metric and its associated Record operations.",
97+
"fields": [
98+
{
99+
"@type": ["Field", "Required"],
100+
"name": "definition",
101+
"description": "Common identifying properties of the Histogram metric.",
102+
"schema": "dtmi:com:microsoft:akri:MetricDefinition;1"
103+
},
104+
{
105+
"@type": ["Field", "Required"],
106+
"name": "operations",
107+
"description": "List of Record operations for this Histogram metric.",
108+
"schema": {
109+
"@type": "Array",
110+
"elementSchema": "dtmi:com:microsoft:akri:RecordOperation;1"
111+
}
112+
}
113+
]
114+
},
115+
{
116+
"@type": "Object",
117+
"@id": "dtmi:com:microsoft:akri:IncrementOperation;1",
118+
"description": "Represents a Increment operation used by Counter metric.",
119+
"fields": [
120+
{
121+
"@type": ["Field", "Required"],
122+
"name": "operationId",
123+
"description": "Unique identifier for the operation, used to correlate responses.",
124+
"schema": "string"
125+
},
126+
{
127+
"@type": ["Field", "Required"],
128+
"name": "value",
129+
"description": "The numeric value by which the counter will be incremented.",
130+
"schema": "double"
131+
},
132+
{
133+
"@type": ["Field", "Required"],
134+
"name": "timestamp",
135+
"description": "Timestamp indicating when the metric value was incremented.",
136+
"schema": "dateTime"
137+
}
138+
]
139+
},
140+
{
141+
"@type": "Object",
142+
"@id": "dtmi:com:microsoft:akri:RecordOperation;1",
143+
"description": "Represents a Record operation used by Gauge and Histogram metrics.",
144+
"fields": [
145+
{
146+
"@type": ["Field", "Required"],
147+
"name": "operationId",
148+
"description": "Unique identifier for the operation, used to correlate responses.",
149+
"schema": "string"
150+
},
151+
{
152+
"@type": ["Field", "Required"],
153+
"name": "value",
154+
"description": "The numeric value to be recorded by the Gauge or Histogram metric.",
155+
"schema": "double"
156+
},
157+
{
158+
"@type": ["Field", "Required"],
159+
"name": "timestamp",
160+
"description": "Timestamp indicating when the metric value was recorded.",
161+
"schema": "dateTime"
162+
}
163+
]
164+
},
165+
{
166+
"@type": "Object",
167+
"@id": "dtmi:com:microsoft:akri:AkriMetricOperationResponse;2",
168+
"description": "Represents the result of a single metric operation, including structured error information if applicable.",
169+
"fields": [
170+
{
171+
"@type": ["Field", "Required"],
172+
"name": "operationId",
173+
"description": "ID of the operation this response refers to.",
174+
"schema": "string"
175+
},
176+
{
177+
"@type": ["Field", "Required"],
178+
"name": "status",
179+
"description": "Status of the operation: either Success or Error.",
180+
"schema": "dtmi:com:microsoft:akri:AkriMetricOperationResponseStatus;1"
181+
},
182+
{
183+
"@type": "Field",
184+
"name": "errorKind",
185+
"description": "Structured classification of the error type, included only if status is Error.",
186+
"schema": "dtmi:com:microsoft:akri:AkriMetricErrorKind;1"
187+
},
188+
{
189+
"@type": "Field",
190+
"name": "propertyName",
191+
"description": "Optional name of the field or conceptual field associated with the error.",
192+
"schema": "string"
193+
},
194+
{
195+
"@type": "Field",
196+
"name": "errorMessage",
197+
"description": "Optional human-readable description of the error.",
198+
"schema": "string"
199+
}
200+
]
201+
},
202+
{
203+
"@type": "Enum",
204+
"@id": "dtmi:com:microsoft:akri:AkriMetricOperationResponseStatus;1",
205+
"valueSchema": "string",
206+
"description": "Defines possible statuses of a metric operation.",
207+
"enumValues": [
208+
{
209+
"name": "Success",
210+
"enumValue": "Success"
211+
},
212+
{
213+
"name": "Error",
214+
"enumValue": "Error"
215+
}
216+
]
217+
},
218+
{
219+
"@type": "Enum",
220+
"@id": "dtmi:com:microsoft:akri:AkriMetricErrorKind;1",
221+
"valueSchema": "string",
222+
"description": "Enumerates structured error types for failed metric operations.",
223+
"enumValues": [
224+
{
225+
"name": "DuplicateOperationId",
226+
"enumValue": "DuplicateOperationId",
227+
"description": "Duplicate operation ID detected in the same batch of metrics."
228+
},
229+
{
230+
"name": "ConflictingMetricDefinition",
231+
"enumValue": "ConflictingMetricDefinition",
232+
"description": "This error occurs when multiple metric definitions use the same combination of name and labels but differ in their structural characteristics. Common causes include publishing a Counter metric and a Gauge metric with the same name and label set, or attempting to redefine a metric with a different unit or incompatible schema."
233+
},
234+
{
235+
"name": "TooManyUniqueLabelSets",
236+
"enumValue": "TooManyUniqueLabelSets",
237+
"description": "This error occurs when the number of unique combinations of label keys and values for a given metric exceeds the system’s configured or supported limit."
238+
},
239+
{
240+
"name": "InternalError",
241+
"enumValue": "InternalError",
242+
"description": "This error occurs when an unexpected condition was encountered during the processing of a metric operation."
243+
}
244+
]
245+
}
246+
],
247+
"contents": [
248+
{
249+
"@type": "Command",
250+
"name": "publishMetrics",
251+
"description": "Publishes a list of metrics, each of which is a Counter, Gauge, or Histogram.",
252+
"request": {
253+
"name": "metrics",
254+
"description": "List of typed metrics to publish.",
255+
"schema": {
256+
"@type": "Object",
257+
"fields": [
258+
{
259+
"@type": ["Field"],
260+
"name": "counterMetrics",
261+
"description": "List of counter metrics to be published.",
262+
"schema": {
263+
"@type": "Array",
264+
"elementSchema": "dtmi:com:microsoft:akri:CounterMetric;1"
265+
}
266+
},
267+
{
268+
"@type": ["Field"],
269+
"name": "gaugeMetrics",
270+
"description": "List of gauge metrics to be published",
271+
"schema": {
272+
"@type": "Array",
273+
"elementSchema": "dtmi:com:microsoft:akri:GaugeMetric;1"
274+
}
275+
},
276+
{
277+
"@type": ["Field"],
278+
"name": "histogramMetrics",
279+
"description": "List of histogram metrics to be published",
280+
"schema": {
281+
"@type": "Array",
282+
"elementSchema": "dtmi:com:microsoft:akri:HistogramMetric;1"
283+
}
284+
}
285+
]
286+
}
287+
},
288+
"response": {
289+
"name": "publishMetricsResponse",
290+
"description": "Response indicating the success or failure of each operation.",
291+
"schema": {
292+
"@type": "Array",
293+
"elementSchema": "dtmi:com:microsoft:akri:AkriMetricOperationResponse;2"
294+
}
295+
}
296+
}
297+
]
298+
}
299+
]

0 commit comments

Comments
 (0)