@@ -6,11 +6,25 @@ use serde::{Deserialize, Deserializer, Serialize};
66use serde_with:: skip_serializing_none;
77use std:: fmt:: { self , Formatter } ;
88
9- /// Configuration for including dynamically queried tags.
9+ /// Options for dynamic tag indexing applied per metric, such as tags filtered by query usage.
10+ ///
11+ /// Before a tag key is dropped by this rule, two grace period conditions must be met:
12+ ///
13+ /// 1. The metric must be submitted for at least as long as the selected window.
14+ /// 2. A tag key must have been submitted for at least 15 days.
15+ ///
16+ /// Any metric or tag key that does not meet these conditions are excluded from this
17+ /// indexing rule. The `exclude_not_*` fields require `exclude_tags_mode` to be set to `true`.
1018#[ non_exhaustive]
1119#[ skip_serializing_none]
1220#[ derive( Clone , Debug , PartialEq , Serialize ) ]
1321pub struct TagIndexingRuleDynamicTags {
22+ /// Tags that have not been queried within this window are excluded from indexing. Maximum of `7776000` (90 days).
23+ #[ serde( rename = "exclude_not_queried_window_seconds" ) ]
24+ pub exclude_not_queried_window_seconds : Option < i64 > ,
25+ /// Tags not used in any dashboards, monitors, notebooks, or SLOs are excluded from indexing.
26+ #[ serde( rename = "exclude_not_used_in_assets" ) ]
27+ pub exclude_not_used_in_assets : Option < bool > ,
1428 /// Window in seconds for evaluating queried tags.
1529 #[ serde( rename = "queried_tags_window_seconds" ) ]
1630 pub queried_tags_window_seconds : Option < i64 > ,
@@ -27,13 +41,25 @@ pub struct TagIndexingRuleDynamicTags {
2741impl TagIndexingRuleDynamicTags {
2842 pub fn new ( ) -> TagIndexingRuleDynamicTags {
2943 TagIndexingRuleDynamicTags {
44+ exclude_not_queried_window_seconds : None ,
45+ exclude_not_used_in_assets : None ,
3046 queried_tags_window_seconds : None ,
3147 related_asset_tags : None ,
3248 additional_properties : std:: collections:: BTreeMap :: new ( ) ,
3349 _unparsed : false ,
3450 }
3551 }
3652
53+ pub fn exclude_not_queried_window_seconds ( mut self , value : i64 ) -> Self {
54+ self . exclude_not_queried_window_seconds = Some ( value) ;
55+ self
56+ }
57+
58+ pub fn exclude_not_used_in_assets ( mut self , value : bool ) -> Self {
59+ self . exclude_not_used_in_assets = Some ( value) ;
60+ self
61+ }
62+
3763 pub fn queried_tags_window_seconds ( mut self , value : i64 ) -> Self {
3864 self . queried_tags_window_seconds = Some ( value) ;
3965 self
@@ -76,6 +102,8 @@ impl<'de> Deserialize<'de> for TagIndexingRuleDynamicTags {
76102 where
77103 M : MapAccess < ' a > ,
78104 {
105+ let mut exclude_not_queried_window_seconds: Option < i64 > = None ;
106+ let mut exclude_not_used_in_assets: Option < bool > = None ;
79107 let mut queried_tags_window_seconds: Option < i64 > = None ;
80108 let mut related_asset_tags: Option < bool > = None ;
81109 let mut additional_properties: std:: collections:: BTreeMap <
@@ -86,6 +114,20 @@ impl<'de> Deserialize<'de> for TagIndexingRuleDynamicTags {
86114
87115 while let Some ( ( k, v) ) = map. next_entry :: < String , serde_json:: Value > ( ) ? {
88116 match k. as_str ( ) {
117+ "exclude_not_queried_window_seconds" => {
118+ if v. is_null ( ) {
119+ continue ;
120+ }
121+ exclude_not_queried_window_seconds =
122+ Some ( serde_json:: from_value ( v) . map_err ( M :: Error :: custom) ?) ;
123+ }
124+ "exclude_not_used_in_assets" => {
125+ if v. is_null ( ) {
126+ continue ;
127+ }
128+ exclude_not_used_in_assets =
129+ Some ( serde_json:: from_value ( v) . map_err ( M :: Error :: custom) ?) ;
130+ }
89131 "queried_tags_window_seconds" => {
90132 if v. is_null ( ) {
91133 continue ;
@@ -109,6 +151,8 @@ impl<'de> Deserialize<'de> for TagIndexingRuleDynamicTags {
109151 }
110152
111153 let content = TagIndexingRuleDynamicTags {
154+ exclude_not_queried_window_seconds,
155+ exclude_not_used_in_assets,
112156 queried_tags_window_seconds,
113157 related_asset_tags,
114158 additional_properties,
0 commit comments