Skip to content

Modify advisor metric data #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions src/plugin/manager/advisor/recommendation_reliability_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ def create_cloud_service(self, options: dict, secret_data: dict, schema: str):
recommendation_filter = "Category eq 'HighAvailability'"
recommendations = advisor_conn.list_recommendations(recommendation_filter=recommendation_filter)

# metadata = advisor_conn.list_metadata()
# print("metadata start")
# for meta in metadata:
# meta_info = self.convert_nested_dictionary(meta)
# print(meta_info)
# print("===========================")
#
# print("metadata end")
for recommendation in recommendations:
try:
recommendation_info = self.convert_nested_dictionary(recommendation)
Expand All @@ -45,8 +37,7 @@ def create_cloud_service(self, options: dict, secret_data: dict, schema: str):
"subscription_name": subscription_info.get("display_name"),
})

recommendation_info["impacted_value_display"] = recommendation_info.get("impacted_value",
"subscription_name")
recommendation_info["impacted_value_display"] = recommendation_info.get("impacted_value", )
short_description = recommendation_info.get("short_description")
extended_properties = recommendation_info.get("extended_properties", {}) or {}

Expand Down Expand Up @@ -108,4 +99,8 @@ def _get_name_from_short_description(short_description: dict) -> str:

@staticmethod
def _get_region_from_extended_properties(extended_properties: dict) -> Union[str, None]:
return extended_properties.get("region", None)
if region := extended_properties.get("region"):
return region
elif region := extended_properties.get("Location"):
return region
return region
1 change: 0 additions & 1 deletion src/plugin/metadata/advisor/cost.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ table:
desc: false
fields:
- Impact: data.impact
- Description: data.short_description.problem
- Category: data.category
- Potential yearly savings based on retail pricing: data.potential_yearly_savings_based_on_retail_pricing_display
- Currency: data.extended_properties.savingsCurrency
Expand Down
13 changes: 10 additions & 3 deletions src/plugin/metadata/advisor/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ table:
- Impact: data.impact
- Description: data.short_description.problem
- Category: data.category
- Impacted resource name: data.impacted_value_display
- Impacted resource name: data.extended_properties.assessmentKey
- Impacted resource: data.impacted_field
- Last updated at: data.last_updated

Expand All @@ -30,8 +30,15 @@ tabs.0:
- Tenant ID: data.tenant_id
- Subscription Name: data.subscription_name
- Subscription ID: data.subscription_id
- Name: name
- Recommendation name: data.name
- Impact: data.impact
- Category: data.category
- End time: data.impact_mitigation_time
- Last update time: data.last_update_time
- Last update time: data.last_updated

tabs.1:
name: Extended Properties
type: item
fields:
- Score: data.extended_properties.score
- AssessmentKey: data.extended_properties.assessmentKey
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ query_options:
reference:
resource_type: inventory.Region
reference_key: region_code
- key: data.impacted_services_display
name: Impacted Service
- key: data.tenant_id
name: Tenant ID
- key: data.subscription_name
Expand Down
Loading