diff --git a/nvml/datadog_checks/nvml/README.md b/nvml/datadog_checks/nvml/README.md new file mode 100644 index 0000000000..55bcb83096 --- /dev/null +++ b/nvml/datadog_checks/nvml/README.md @@ -0,0 +1,15 @@ +# NVML Datadog check + +## Development + +### Regenerate API protobuf code + +```shell +$ python3 -m venv .venv +$ . .venv/bin/activate +(venv) $ python3 -m pip install -r requirements.txt +(venv) $ python3 -m grpc_tools.protoc --python_out=. --proto_path=. api.proto +(venv) $ deactivate +$ +``` + diff --git a/nvml/datadog_checks/nvml/api_pb2.py b/nvml/datadog_checks/nvml/api_pb2.py index 59608e0bbc..657429bd23 100644 --- a/nvml/datadog_checks/nvml/api_pb2.py +++ b/nvml/datadog_checks/nvml/api_pb2.py @@ -1,362 +1,46 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: api.proto -# flake8: noqa - +# Protobuf Python Version: 5.27.2 +"""Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version from google.protobuf import symbol_database as _symbol_database - +from google.protobuf.internal import builder as _builder +_runtime_version.ValidateProtobufRuntimeVersion( + _runtime_version.Domain.PUBLIC, + 5, + 27, + 2, + '', + 'api.proto' +) # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() -DESCRIPTOR = _descriptor.FileDescriptor( - name='api.proto', - package='v1alpha1', - syntax='proto3', - serialized_options=None, - serialized_pb=b'\n\tapi.proto\x12\x08v1alpha1\"\x19\n\x17ListPodResourcesRequest\"I\n\x18ListPodResourcesResponse\x12-\n\rpod_resources\x18\x01 \x03(\x0b\x32\x16.v1alpha1.PodResources\"a\n\x0cPodResources\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x11\n\tnamespace\x18\x02 \x01(\t\x12\x30\n\ncontainers\x18\x03 \x03(\x0b\x32\x1c.v1alpha1.ContainerResources\"O\n\x12\x43ontainerResources\x12\x0c\n\x04name\x18\x01 \x01(\t\x12+\n\x07\x64\x65vices\x18\x02 \x03(\x0b\x32\x1a.v1alpha1.ContainerDevices\"=\n\x10\x43ontainerDevices\x12\x15\n\rresource_name\x18\x01 \x01(\t\x12\x12\n\ndevice_ids\x18\x02 \x03(\t2e\n\x12PodResourcesLister\x12O\n\x04List\x12!.v1alpha1.ListPodResourcesRequest\x1a\".v1alpha1.ListPodResourcesResponse\"\x00\x62\x06proto3', -) - - -_LISTPODRESOURCESREQUEST = _descriptor.Descriptor( - name='ListPodResourcesRequest', - full_name='v1alpha1.ListPodResourcesRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[], - serialized_start=23, - serialized_end=48, -) - - -_LISTPODRESOURCESRESPONSE = _descriptor.Descriptor( - name='ListPodResourcesResponse', - full_name='v1alpha1.ListPodResourcesResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='pod_resources', - full_name='v1alpha1.ListPodResourcesResponse.pod_resources', - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[], - serialized_start=50, - serialized_end=123, -) - - -_PODRESOURCES = _descriptor.Descriptor( - name='PodResources', - full_name='v1alpha1.PodResources', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='name', - full_name='v1alpha1.PodResources.name', - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode('utf-8'), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name='namespace', - full_name='v1alpha1.PodResources.namespace', - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode('utf-8'), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name='containers', - full_name='v1alpha1.PodResources.containers', - index=2, - number=3, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[], - serialized_start=125, - serialized_end=222, -) - - -_CONTAINERRESOURCES = _descriptor.Descriptor( - name='ContainerResources', - full_name='v1alpha1.ContainerResources', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='name', - full_name='v1alpha1.ContainerResources.name', - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode('utf-8'), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name='devices', - full_name='v1alpha1.ContainerResources.devices', - index=1, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[], - serialized_start=224, - serialized_end=303, -) - - -_CONTAINERDEVICES = _descriptor.Descriptor( - name='ContainerDevices', - full_name='v1alpha1.ContainerDevices', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='resource_name', - full_name='v1alpha1.ContainerDevices.resource_name', - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode('utf-8'), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name='device_ids', - full_name='v1alpha1.ContainerDevices.device_ids', - index=1, - number=2, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[], - serialized_start=305, - serialized_end=366, -) - -_LISTPODRESOURCESRESPONSE.fields_by_name['pod_resources'].message_type = _PODRESOURCES -_PODRESOURCES.fields_by_name['containers'].message_type = _CONTAINERRESOURCES -_CONTAINERRESOURCES.fields_by_name['devices'].message_type = _CONTAINERDEVICES -DESCRIPTOR.message_types_by_name['ListPodResourcesRequest'] = _LISTPODRESOURCESREQUEST -DESCRIPTOR.message_types_by_name['ListPodResourcesResponse'] = _LISTPODRESOURCESRESPONSE -DESCRIPTOR.message_types_by_name['PodResources'] = _PODRESOURCES -DESCRIPTOR.message_types_by_name['ContainerResources'] = _CONTAINERRESOURCES -DESCRIPTOR.message_types_by_name['ContainerDevices'] = _CONTAINERDEVICES -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -ListPodResourcesRequest = _reflection.GeneratedProtocolMessageType( - 'ListPodResourcesRequest', - (_message.Message,), - { - 'DESCRIPTOR': _LISTPODRESOURCESREQUEST, - '__module__': 'api_pb2' - # @@protoc_insertion_point(class_scope:v1alpha1.ListPodResourcesRequest) - }, -) -_sym_db.RegisterMessage(ListPodResourcesRequest) - -ListPodResourcesResponse = _reflection.GeneratedProtocolMessageType( - 'ListPodResourcesResponse', - (_message.Message,), - { - 'DESCRIPTOR': _LISTPODRESOURCESRESPONSE, - '__module__': 'api_pb2' - # @@protoc_insertion_point(class_scope:v1alpha1.ListPodResourcesResponse) - }, -) -_sym_db.RegisterMessage(ListPodResourcesResponse) - -PodResources = _reflection.GeneratedProtocolMessageType( - 'PodResources', - (_message.Message,), - { - 'DESCRIPTOR': _PODRESOURCES, - '__module__': 'api_pb2' - # @@protoc_insertion_point(class_scope:v1alpha1.PodResources) - }, -) -_sym_db.RegisterMessage(PodResources) - -ContainerResources = _reflection.GeneratedProtocolMessageType( - 'ContainerResources', - (_message.Message,), - { - 'DESCRIPTOR': _CONTAINERRESOURCES, - '__module__': 'api_pb2' - # @@protoc_insertion_point(class_scope:v1alpha1.ContainerResources) - }, -) -_sym_db.RegisterMessage(ContainerResources) - -ContainerDevices = _reflection.GeneratedProtocolMessageType( - 'ContainerDevices', - (_message.Message,), - { - 'DESCRIPTOR': _CONTAINERDEVICES, - '__module__': 'api_pb2' - # @@protoc_insertion_point(class_scope:v1alpha1.ContainerDevices) - }, -) -_sym_db.RegisterMessage(ContainerDevices) - -_PODRESOURCESLISTER = _descriptor.ServiceDescriptor( - name='PodResourcesLister', - full_name='v1alpha1.PodResourcesLister', - file=DESCRIPTOR, - index=0, - serialized_options=None, - serialized_start=368, - serialized_end=469, - methods=[ - _descriptor.MethodDescriptor( - name='List', - full_name='v1alpha1.PodResourcesLister.List', - index=0, - containing_service=None, - input_type=_LISTPODRESOURCESREQUEST, - output_type=_LISTPODRESOURCESRESPONSE, - serialized_options=None, - ), - ], -) -_sym_db.RegisterServiceDescriptor(_PODRESOURCESLISTER) -DESCRIPTOR.services_by_name['PodResourcesLister'] = _PODRESOURCESLISTER +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\tapi.proto\x12\x08v1alpha1\"\x19\n\x17ListPodResourcesRequest\"I\n\x18ListPodResourcesResponse\x12-\n\rpod_resources\x18\x01 \x03(\x0b\x32\x16.v1alpha1.PodResources\"a\n\x0cPodResources\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x11\n\tnamespace\x18\x02 \x01(\t\x12\x30\n\ncontainers\x18\x03 \x03(\x0b\x32\x1c.v1alpha1.ContainerResources\"O\n\x12\x43ontainerResources\x12\x0c\n\x04name\x18\x01 \x01(\t\x12+\n\x07\x64\x65vices\x18\x02 \x03(\x0b\x32\x1a.v1alpha1.ContainerDevices\"=\n\x10\x43ontainerDevices\x12\x15\n\rresource_name\x18\x01 \x01(\t\x12\x12\n\ndevice_ids\x18\x02 \x03(\t2e\n\x12PodResourcesLister\x12O\n\x04List\x12!.v1alpha1.ListPodResourcesRequest\x1a\".v1alpha1.ListPodResourcesResponse\"\x00\x62\x06proto3') +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'api_pb2', _globals) +if not _descriptor._USE_C_DESCRIPTORS: + DESCRIPTOR._loaded_options = None + _globals['_LISTPODRESOURCESREQUEST']._serialized_start=23 + _globals['_LISTPODRESOURCESREQUEST']._serialized_end=48 + _globals['_LISTPODRESOURCESRESPONSE']._serialized_start=50 + _globals['_LISTPODRESOURCESRESPONSE']._serialized_end=123 + _globals['_PODRESOURCES']._serialized_start=125 + _globals['_PODRESOURCES']._serialized_end=222 + _globals['_CONTAINERRESOURCES']._serialized_start=224 + _globals['_CONTAINERRESOURCES']._serialized_end=303 + _globals['_CONTAINERDEVICES']._serialized_start=305 + _globals['_CONTAINERDEVICES']._serialized_end=366 + _globals['_PODRESOURCESLISTER']._serialized_start=368 + _globals['_PODRESOURCESLISTER']._serialized_end=469 # @@protoc_insertion_point(module_scope) diff --git a/nvml/datadog_checks/nvml/requirements.txt b/nvml/datadog_checks/nvml/requirements.txt new file mode 100644 index 0000000000..67c8a99839 --- /dev/null +++ b/nvml/datadog_checks/nvml/requirements.txt @@ -0,0 +1,4 @@ +grpcio==1.67.1 +grpcio-tools==1.67.1 +protobuf==5.27.3 +setuptools==75.4.0