@@ -248,6 +248,7 @@ func TestLoadMetadata(t *testing.T) {
248248 Enabled : true ,
249249 Description : "Monotonic cumulative sum int metric enabled by default." ,
250250 ExtendedDocumentation : "The metric will be become optional soon." ,
251+ Stability : Stability {Level : component .StabilityLevelDevelopment },
251252 Warnings : Warnings {
252253 IfEnabledNotSet : "This metric will be disabled by default soon." ,
253254 },
@@ -264,6 +265,7 @@ func TestLoadMetadata(t *testing.T) {
264265 Signal : Signal {
265266 Enabled : false ,
266267 Description : "[DEPRECATED] Gauge double metric disabled by default." ,
268+ Stability : Stability {Level : component .StabilityLevelDeprecated },
267269 Warnings : Warnings {
268270 IfConfigured : "This metric is deprecated and will be removed soon." ,
269271 },
@@ -278,6 +280,7 @@ func TestLoadMetadata(t *testing.T) {
278280 Signal : Signal {
279281 Enabled : false ,
280282 Description : "[DEPRECATED] Gauge double metric disabled by default." ,
283+ Stability : Stability {Level : component .StabilityLevelDeprecated },
281284 Warnings : Warnings {
282285 IfConfigured : "This metric is deprecated and will be removed soon." ,
283286 },
@@ -294,6 +297,7 @@ func TestLoadMetadata(t *testing.T) {
294297 Enabled : true ,
295298 Description : "[DEPRECATED] Non-monotonic delta sum double metric enabled by default." ,
296299 ExtendedDocumentation : "The metric will be removed soon." ,
300+ Stability : Stability {Level : component .StabilityLevelDeprecated },
297301 Warnings : Warnings {
298302 IfEnabled : "This metric is deprecated and will be removed soon." ,
299303 },
@@ -309,6 +313,7 @@ func TestLoadMetadata(t *testing.T) {
309313 Signal : Signal {
310314 Enabled : true ,
311315 Description : "Monotonic cumulative sum int metric with string input_type enabled by default." ,
316+ Stability : Stability {Level : component .StabilityLevelDevelopment },
312317 Attributes : []AttributeName {"string_attr" , "overridden_int_attr" , "enum_attr" , "slice_attr" , "map_attr" },
313318 },
314319 Unit : strPtr ("s" ),
@@ -359,7 +364,7 @@ func TestLoadMetadata(t *testing.T) {
359364 "batch_size_trigger_send" : {
360365 Signal : Signal {
361366 Enabled : true ,
362- Stability : Stability {Level : "deprecated" , From : "v0.110.0" },
367+ Stability : Stability {Level : component . StabilityLevelDeprecated , From : "v0.110.0" },
363368 Description : "Number of times the batch was sent due to a size trigger" ,
364369 },
365370 Unit : strPtr ("{times}" ),
@@ -371,7 +376,7 @@ func TestLoadMetadata(t *testing.T) {
371376 "request_duration" : {
372377 Signal : Signal {
373378 Enabled : true ,
374- Stability : Stability {Level : "alpha" },
379+ Stability : Stability {Level : component . StabilityLevelAlpha },
375380 Description : "Duration of request" ,
376381 },
377382 Unit : strPtr ("s" ),
@@ -383,7 +388,7 @@ func TestLoadMetadata(t *testing.T) {
383388 "process_runtime_total_alloc_bytes" : {
384389 Signal : Signal {
385390 Enabled : true ,
386- Stability : Stability {Level : "stable" },
391+ Stability : Stability {Level : component . StabilityLevelStable },
387392 Description : "Cumulative bytes allocated for heap objects (see 'go doc runtime.MemStats.TotalAlloc')" ,
388393 },
389394 Unit : strPtr ("By" ),
@@ -398,7 +403,7 @@ func TestLoadMetadata(t *testing.T) {
398403 "queue_length" : {
399404 Signal : Signal {
400405 Enabled : true ,
401- Stability : Stability {Level : "alpha" },
406+ Stability : Stability {Level : component . StabilityLevelAlpha },
402407 Description : "This metric is optional and therefore not initialized in NewTelemetryBuilder." ,
403408 ExtendedDocumentation : "For example this metric only exists if feature A is enabled." ,
404409 },
@@ -415,6 +420,7 @@ func TestLoadMetadata(t *testing.T) {
415420 Signal : Signal {
416421 Enabled : true ,
417422 Description : "Queue capacity - sync gauge example." ,
423+ Stability : Stability {Level : component .StabilityLevelDevelopment },
418424 },
419425 Unit : strPtr ("{items}" ),
420426 Gauge : & Gauge {
@@ -513,6 +519,16 @@ func TestLoadMetadata(t *testing.T) {
513519 want : Metadata {},
514520 wantErr : "decoding failed due to the following error(s):\n \n 'attributes[used_attr].type' invalid type: \" invalidtype\" " ,
515521 },
522+ {
523+ name : "testdata/invalid_metric_stability.yaml" ,
524+ want : Metadata {},
525+ wantErr : "decoding failed due to the following error(s):\n \n 'metrics[default.metric]' decoding failed due to the following error(s):\n \n 'stability' decoding failed due to the following error(s):\n \n 'level' unsupported stability level: \" development42\" " ,
526+ },
527+ {
528+ name : "testdata/no_metric_stability.yaml" ,
529+ want : Metadata {},
530+ wantErr : "decoding failed due to the following error(s):\n \n 'metrics[default.metric]' decoding failed due to the following error(s):\n \n 'stability' missing required field: `stability.level`" ,
531+ },
516532 {
517533 name : "testdata/~~this file doesn't exist~~.yaml" ,
518534 wantErr : "unable to read the file file:testdata/~~this file doesn't exist~~.yaml" ,
0 commit comments