diff --git a/src/spaceone/inventory_v2/interface/grpc/__init__.py b/src/spaceone/inventory_v2/interface/grpc/__init__.py index cf0f475..3585b9f 100644 --- a/src/spaceone/inventory_v2/interface/grpc/__init__.py +++ b/src/spaceone/inventory_v2/interface/grpc/__init__.py @@ -4,9 +4,11 @@ from .job import Job from .job_task import JobTask from .metric import Metric -from .namespace_group import NamespaceGroup -from .namespace import Namespace -from .metric import Metric + +# from .namespace_group import NamespaceGroup +# from .namespace import Namespace +from .metric_data import MetricData +from .metric_example import MetricExample _all_ = ["app"] @@ -15,6 +17,8 @@ app.add_service(Collector) app.add_service(Job) app.add_service(JobTask) -app.add_service(NamespaceGroup) -app.add_service(Namespace) -app.add_service(Metric) \ No newline at end of file +# app.add_service(NamespaceGroup) +# app.add_service(Namespace) +app.add_service(Metric) +app.add_service(MetricData) +app.add_service(MetricExample) diff --git a/src/spaceone/inventory_v2/interface/grpc/metric_data.py b/src/spaceone/inventory_v2/interface/grpc/metric_data.py index e8d06cf..d9859bc 100644 --- a/src/spaceone/inventory_v2/interface/grpc/metric_data.py +++ b/src/spaceone/inventory_v2/interface/grpc/metric_data.py @@ -1,6 +1,6 @@ from spaceone.core.pygrpc import BaseAPI from spaceone.api.inventory_v2.v1 import metric_data_pb2, metric_data_pb2_grpc -from spaceone.inventory.service.metric_data_service import MetricDataService +from spaceone.inventory_v2.service.metric_data_service import MetricDataService class MetricData(BaseAPI, metric_data_pb2_grpc.MetricDataServicer): diff --git a/src/spaceone/inventory_v2/interface/grpc/metric_example.py b/src/spaceone/inventory_v2/interface/grpc/metric_example.py index f39d65d..fbffec8 100644 --- a/src/spaceone/inventory_v2/interface/grpc/metric_example.py +++ b/src/spaceone/inventory_v2/interface/grpc/metric_example.py @@ -1,6 +1,6 @@ from spaceone.core.pygrpc import BaseAPI from spaceone.api.inventory_v2.v1 import metric_example_pb2, metric_example_pb2_grpc -from spaceone.inventory.service.metric_example_service import MetricExampleService +from spaceone.inventory_v2.service.metric_example_service import MetricExampleService class MetricExample(BaseAPI, metric_example_pb2_grpc.MetricExampleServicer): diff --git a/src/spaceone/inventory_v2/managed_resource/metric/created_count.yaml b/src/spaceone/inventory_v2/managed_resource/metric/created_count.yaml new file mode 100644 index 0000000..2cad4e7 --- /dev/null +++ b/src/spaceone/inventory_v2/managed_resource/metric/created_count.yaml @@ -0,0 +1,37 @@ +--- +metric_id: metric-managed-created-count +name: Created Count +metric_type: COUNTER +resource_type: inventory.Asset +query_options: + group_by: + - key: provider + name: Provider + reference: + resource_type: identity.Provider + reference_key: provider + default: true + - key: asset_group_id + name: Asset Group + default: true + - key: asset_type_id + name: Asset Type + default: true + - key: region_code + name: Region + reference: + resource_type: inventory.Region + reference_key: region_code + - key: account + name: Cloud Account ID + - key: resource_id + name: Resource ID + - key: name + name: Resource Name + fields: + value: + operator: count +date_field: created_at +unit: Count +namespace_id: ns-managed-asset-change-history +version: '1.0' \ No newline at end of file diff --git a/src/spaceone/inventory_v2/managed_resource/metric/total_count.yaml b/src/spaceone/inventory_v2/managed_resource/metric/total_count.yaml new file mode 100644 index 0000000..27519da --- /dev/null +++ b/src/spaceone/inventory_v2/managed_resource/metric/total_count.yaml @@ -0,0 +1,29 @@ +--- +metric_id: metric-managed-total-count +name: Total Count +metric_type: GAUGE +resource_type: inventory.Asset +query_options: + group_by: + - key: provider + name: Provider + reference: + resource_type: identity.Provider + reference_key: provider + default: true + - key: asset_type_id + name: Asset Type + default: true + - key: region_id + name: Region + reference: + resource_type: inventory.Region + reference_key: region_code + - key: account + name: Cloud Account ID + fields: + value: + operator: count +unit: Count +namespace_id: ns-managed-asset-summary +version: '1.0' \ No newline at end of file diff --git a/src/spaceone/inventory_v2/manager/metric_example_manager.py b/src/spaceone/inventory_v2/manager/metric_example_manager.py index 7cfce50..fd455c6 100644 --- a/src/spaceone/inventory_v2/manager/metric_example_manager.py +++ b/src/spaceone/inventory_v2/manager/metric_example_manager.py @@ -3,7 +3,7 @@ from spaceone.core.model.mongo_model import QuerySet from spaceone.core.manager import BaseManager -from spaceone.inventory.model.metric_example.database import MetricExample +from spaceone.inventory_v2.model.metric_example.database import MetricExample _LOGGER = logging.getLogger(__name__) diff --git a/src/spaceone/inventory_v2/model/metric/request.py b/src/spaceone/inventory_v2/model/metric/request.py index 747cd22..e0d7097 100644 --- a/src/spaceone/inventory_v2/model/metric/request.py +++ b/src/spaceone/inventory_v2/model/metric/request.py @@ -77,7 +77,7 @@ class MetricSearchQueryRequest(BaseModel): is_managed: Union[bool, None] = None exists_only: Union[bool, None] = None namespace_id: Union[str, None] = None - workspace_id: Union[str, list, None] = None + workspace_id: Union[list, str, None] = None domain_id: str