divi 0.0.1.dev11__py3-none-macosx_11_0_arm64.whl → 0.0.1.dev13__py3-none-macosx_11_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. divi/__init__.py +5 -4
  2. divi/bin/core +0 -0
  3. divi/decorators/__init__.py +4 -0
  4. divi/decorators/obs_openai.py +33 -0
  5. divi/decorators/observable.py +108 -0
  6. divi/proto/common/v1/common.proto +63 -0
  7. divi/proto/common/v1/common_pb2.py +45 -0
  8. divi/proto/common/v1/common_pb2.pyi +56 -0
  9. divi/proto/core/health/v1/health_service.proto +17 -0
  10. divi/proto/{health_pb2.py → core/health/v1/health_service_pb2.py} +10 -8
  11. divi/proto/{core_pb2_grpc.py → core/health/v1/health_service_pb2_grpc.py} +19 -19
  12. divi/proto/metric/v1/metric.proto +29 -0
  13. divi/proto/metric/v1/metric_pb2.py +40 -0
  14. divi/proto/metric/v1/metric_pb2.pyi +27 -0
  15. divi/proto/run/v1/run.proto +38 -0
  16. divi/proto/{core_pb2.py → run/v1/run_pb2.py} +9 -7
  17. divi/proto/run/v1/run_pb2.pyi +34 -0
  18. divi/proto/trace/v1/trace.proto +50 -0
  19. divi/proto/trace/v1/trace_pb2.py +42 -0
  20. divi/proto/trace/v1/trace_pb2.pyi +42 -0
  21. divi/run/__init__.py +3 -0
  22. divi/run/run.py +24 -0
  23. divi/run/setup.py +50 -0
  24. divi/run/teardown.py +7 -0
  25. divi/services/auth/init.py +2 -5
  26. divi/services/core/core.py +3 -3
  27. divi/services/core/init.py +5 -12
  28. divi/services/datapark/__init__.py +2 -1
  29. divi/services/datapark/init.py +2 -6
  30. divi/services/finish.py +4 -0
  31. divi/services/init.py +8 -2
  32. divi/signals/__init__.py +3 -0
  33. divi/signals/trace/__init__.py +3 -0
  34. divi/signals/trace/trace.py +81 -0
  35. divi/utils.py +8 -0
  36. {divi-0.0.1.dev11.dist-info → divi-0.0.1.dev13.dist-info}/METADATA +1 -1
  37. divi-0.0.1.dev13.dist-info/RECORD +49 -0
  38. divi/proto/core.proto +0 -12
  39. divi/proto/core_pb2.pyi +0 -5
  40. divi/proto/health.proto +0 -12
  41. divi-0.0.1.dev11.dist-info/RECORD +0 -30
  42. /divi/proto/{health_pb2.pyi → core/health/v1/health_service_pb2.pyi} +0 -0
  43. {divi-0.0.1.dev11.dist-info → divi-0.0.1.dev13.dist-info}/WHEEL +0 -0
  44. {divi-0.0.1.dev11.dist-info → divi-0.0.1.dev13.dist-info}/licenses/LICENSE +0 -0
divi/__init__.py CHANGED
@@ -1,15 +1,16 @@
1
1
  from typing import Optional
2
2
 
3
3
  from . import proto
4
+ from .decorators import obs_openai, observable
5
+ from .run import Run
4
6
  from .services import Auth, Core, DataPark
5
7
 
6
8
  name: str = "divi"
7
9
 
8
-
9
- name: str = "divi"
10
+ _run: Optional[Run] = None
10
11
  _core: Optional[Core] = None
11
12
  _auth: Optional[Auth] = None
12
13
  _datapark: Optional[DataPark] = None
13
14
 
14
- __version__ = "0.0.1.dev11"
15
- __all__ = ["proto"]
15
+ __version__ = "0.0.1.dev13"
16
+ __all__ = ["proto", "obs_openai", "observable"]
divi/bin/core CHANGED
Binary file
@@ -0,0 +1,4 @@
1
+ from .obs_openai import obs_openai
2
+ from .observable import observable
3
+
4
+ __all__ = ["observable", "obs_openai"]
@@ -0,0 +1,33 @@
1
+ import functools
2
+ from collections.abc import Callable
3
+ from typing import TYPE_CHECKING, TypeVar, Union
4
+
5
+ from divi.decorators.observable import observable
6
+ from divi.utils import is_async
7
+
8
+ if TYPE_CHECKING:
9
+ from openai import AsyncOpenAI, OpenAI
10
+
11
+ C = TypeVar("C", bound=Union["OpenAI", "AsyncOpenAI"])
12
+
13
+
14
+ def _get_observable_create(create: Callable) -> Callable:
15
+ @functools.wraps(create)
16
+ def observable_create(*args, stream: bool = False, **kwargs):
17
+ decorator = observable()
18
+ return decorator(create)(*args, stream=stream, **kwargs)
19
+
20
+ # TODO Async Observable Create
21
+ print("Is async", is_async(create))
22
+ return observable_create if not is_async(create) else create
23
+
24
+
25
+ def obs_openai(client: C) -> C:
26
+ """Make OpenAI client observable."""
27
+ client.chat.completions.create = _get_observable_create(
28
+ client.chat.completions.create
29
+ )
30
+ client.completions.create = _get_observable_create(
31
+ client.completions.create
32
+ )
33
+ return client
@@ -0,0 +1,108 @@
1
+ import contextvars
2
+ import functools
3
+ import inspect
4
+ from typing import (
5
+ Any,
6
+ Callable,
7
+ Generic,
8
+ List,
9
+ Mapping,
10
+ Optional,
11
+ ParamSpec,
12
+ Protocol,
13
+ TypeVar,
14
+ Union,
15
+ overload,
16
+ runtime_checkable,
17
+ )
18
+
19
+ from divi.run import RunExtra
20
+ from divi.run.setup import setup
21
+ from divi.signals.trace import Span
22
+
23
+ R = TypeVar("R", covariant=True)
24
+ P = ParamSpec("P")
25
+
26
+ # ContextVar to store the extra information
27
+ # from the Run and parent Span
28
+ _RUNEXTRA = contextvars.ContextVar[Optional[RunExtra]](
29
+ "_RUNEXTRA", default=None
30
+ )
31
+
32
+
33
+ @runtime_checkable
34
+ class WithRunExtra(Protocol, Generic[P, R]):
35
+ def __call__(
36
+ self,
37
+ *args: P.args,
38
+ run_extra: Optional[RunExtra] = None, # type: ignore[valid-type]
39
+ **kwargs: P.kwargs,
40
+ ) -> R: ...
41
+
42
+
43
+ @overload
44
+ def observable(func: Callable[P, R]) -> WithRunExtra[P, R]: ...
45
+
46
+
47
+ @overload
48
+ def observable(
49
+ kind: str = "function",
50
+ *,
51
+ name: Optional[str] = None,
52
+ metadata: Optional[Mapping[str, Any]] = None,
53
+ ) -> Callable[[Callable[P, R]], WithRunExtra[P, R]]: ...
54
+
55
+
56
+ def observable(
57
+ *args, **kwargs
58
+ ) -> Union[Callable, Callable[[Callable], Callable]]:
59
+ """Observable decorator factory."""
60
+
61
+ kind = kwargs.pop("kind", "function")
62
+ name = kwargs.pop("name", None)
63
+ metadata = kwargs.pop("metadata", None)
64
+
65
+ def decorator(func):
66
+ span = Span(kind=kind, name=name or func.__name__, metadata=metadata)
67
+
68
+ @functools.wraps(func)
69
+ def wrapper(*args, run_extra: Optional[RunExtra] = None, **kwargs):
70
+ run_extra = setup(span, _RUNEXTRA.get() or run_extra)
71
+ # set current context
72
+ token = _RUNEXTRA.set(run_extra)
73
+ # execute the function
74
+ span.start()
75
+ result = func(*args, **kwargs)
76
+ span.end()
77
+ # recover parent context
78
+ _RUNEXTRA.reset(token)
79
+ # TODO: collect result
80
+ return result
81
+
82
+ @functools.wraps(func)
83
+ def generator_wrapper(
84
+ *args, run_extra: Optional[RunExtra] = None, **kwargs
85
+ ):
86
+ run_extra = setup(span, _RUNEXTRA.get() or run_extra)
87
+ # set current context
88
+ token = _RUNEXTRA.set(run_extra)
89
+ # execute the function
90
+ results: List[Any] = []
91
+ span.start()
92
+ for item in func(*args, **kwargs):
93
+ results.append(item)
94
+ yield item
95
+ span.end()
96
+ # recover parent context
97
+ _RUNEXTRA.reset(token)
98
+ # TODO: collect results
99
+
100
+ if inspect.isgeneratorfunction(func):
101
+ return generator_wrapper
102
+ return wrapper
103
+
104
+ # Function Decorator
105
+ if len(args) == 1 and callable(args[0]) and not kwargs:
106
+ return decorator(args[0])
107
+ # Factory Decorator
108
+ return decorator
@@ -0,0 +1,63 @@
1
+ syntax = "proto3";
2
+
3
+ package divi.proto.common.v1;
4
+
5
+ option go_package = "services/proto";
6
+
7
+ // AnyValue is used to represent any type of attribute value. AnyValue may contain a
8
+ // primitive value such as a string or integer or it may contain an arbitrary nested
9
+ // object containing arrays, key-value lists and primitives.
10
+ message AnyValue {
11
+ // The value is one of the listed fields. It is valid for all values to be unspecified
12
+ // in which case this AnyValue is considered to be "empty".
13
+ oneof value {
14
+ string string_value = 1;
15
+ bool bool_value = 2;
16
+ int64 int_value = 3;
17
+ double double_value = 4;
18
+ ArrayValue array_value = 5;
19
+ KeyValueList kvlist_value = 6;
20
+ bytes bytes_value = 7;
21
+ }
22
+ }
23
+
24
+ // ArrayValue is a list of AnyValue messages. We need ArrayValue as a message
25
+ // since oneof in AnyValue does not allow repeated fields.
26
+ message ArrayValue {
27
+ // Array of values. The array may be empty (contain 0 elements).
28
+ repeated AnyValue values = 1;
29
+ }
30
+
31
+ // KeyValueList is a list of KeyValue messages. We need KeyValueList as a message
32
+ // since `oneof` in AnyValue does not allow repeated fields. Everywhere else where we need
33
+ // a list of KeyValue messages (e.g. in Span) we use `repeated KeyValue` directly to
34
+ // avoid unnecessary extra wrapping (which slows down the protocol). The 2 approaches
35
+ // are semantically equivalent.
36
+ message KeyValueList {
37
+ // A collection of key/value pairs of key-value pairs. The list may be empty (may
38
+ // contain 0 elements).
39
+ // The keys MUST be unique (it is not allowed to have more than one
40
+ // value with the same key).
41
+ repeated KeyValue values = 1;
42
+ }
43
+
44
+ // KeyValue is a key-value pair that is used to store Span attributes, Link
45
+ // attributes, etc.
46
+ message KeyValue {
47
+ string key = 1;
48
+ AnyValue value = 2;
49
+ }
50
+
51
+ // RunScope specifies the scope of the message
52
+ message RunScope {
53
+ // The run_id is a unique identifier that represents a run. It is a 16-byte array.
54
+ bytes run_id = 1;
55
+ // The name of the run.
56
+ string run_name = 2;
57
+
58
+ // Additional attributes that describe the scope. [Optional].
59
+ // Attribute keys MUST be unique (it is not allowed to have more than one
60
+ // attribute with the same key).
61
+ repeated KeyValue attributes = 3;
62
+ uint32 dropped_attributes_count = 4;
63
+ }
@@ -0,0 +1,45 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # NO CHECKED-IN PROTOBUF GENCODE
4
+ # source: divi/proto/common/v1/common.proto
5
+ # Protobuf Python Version: 5.29.0
6
+ """Generated protocol buffer code."""
7
+ from google.protobuf import descriptor as _descriptor
8
+ from google.protobuf import descriptor_pool as _descriptor_pool
9
+ from google.protobuf import runtime_version as _runtime_version
10
+ from google.protobuf import symbol_database as _symbol_database
11
+ from google.protobuf.internal import builder as _builder
12
+ _runtime_version.ValidateProtobufRuntimeVersion(
13
+ _runtime_version.Domain.PUBLIC,
14
+ 5,
15
+ 29,
16
+ 0,
17
+ '',
18
+ 'divi/proto/common/v1/common.proto'
19
+ )
20
+ # @@protoc_insertion_point(imports)
21
+
22
+ _sym_db = _symbol_database.Default()
23
+
24
+
25
+
26
+
27
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!divi/proto/common/v1/common.proto\x12\x14\x64ivi.proto.common.v1\"\xfa\x01\n\x08\x41nyValue\x12\x16\n\x0cstring_value\x18\x01 \x01(\tH\x00\x12\x14\n\nbool_value\x18\x02 \x01(\x08H\x00\x12\x13\n\tint_value\x18\x03 \x01(\x03H\x00\x12\x16\n\x0c\x64ouble_value\x18\x04 \x01(\x01H\x00\x12\x37\n\x0b\x61rray_value\x18\x05 \x01(\x0b\x32 .divi.proto.common.v1.ArrayValueH\x00\x12:\n\x0ckvlist_value\x18\x06 \x01(\x0b\x32\".divi.proto.common.v1.KeyValueListH\x00\x12\x15\n\x0b\x62ytes_value\x18\x07 \x01(\x0cH\x00\x42\x07\n\x05value\"<\n\nArrayValue\x12.\n\x06values\x18\x01 \x03(\x0b\x32\x1e.divi.proto.common.v1.AnyValue\">\n\x0cKeyValueList\x12.\n\x06values\x18\x01 \x03(\x0b\x32\x1e.divi.proto.common.v1.KeyValue\"F\n\x08KeyValue\x12\x0b\n\x03key\x18\x01 \x01(\t\x12-\n\x05value\x18\x02 \x01(\x0b\x32\x1e.divi.proto.common.v1.AnyValue\"\x82\x01\n\x08RunScope\x12\x0e\n\x06run_id\x18\x01 \x01(\x0c\x12\x10\n\x08run_name\x18\x02 \x01(\t\x12\x32\n\nattributes\x18\x03 \x03(\x0b\x32\x1e.divi.proto.common.v1.KeyValue\x12 \n\x18\x64ropped_attributes_count\x18\x04 \x01(\rB\x10Z\x0eservices/protob\x06proto3')
28
+
29
+ _globals = globals()
30
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
31
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'divi.proto.common.v1.common_pb2', _globals)
32
+ if not _descriptor._USE_C_DESCRIPTORS:
33
+ _globals['DESCRIPTOR']._loaded_options = None
34
+ _globals['DESCRIPTOR']._serialized_options = b'Z\016services/proto'
35
+ _globals['_ANYVALUE']._serialized_start=60
36
+ _globals['_ANYVALUE']._serialized_end=310
37
+ _globals['_ARRAYVALUE']._serialized_start=312
38
+ _globals['_ARRAYVALUE']._serialized_end=372
39
+ _globals['_KEYVALUELIST']._serialized_start=374
40
+ _globals['_KEYVALUELIST']._serialized_end=436
41
+ _globals['_KEYVALUE']._serialized_start=438
42
+ _globals['_KEYVALUE']._serialized_end=508
43
+ _globals['_RUNSCOPE']._serialized_start=511
44
+ _globals['_RUNSCOPE']._serialized_end=641
45
+ # @@protoc_insertion_point(module_scope)
@@ -0,0 +1,56 @@
1
+ from google.protobuf.internal import containers as _containers
2
+ from google.protobuf import descriptor as _descriptor
3
+ from google.protobuf import message as _message
4
+ from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union
5
+
6
+ DESCRIPTOR: _descriptor.FileDescriptor
7
+
8
+ class AnyValue(_message.Message):
9
+ __slots__ = ("string_value", "bool_value", "int_value", "double_value", "array_value", "kvlist_value", "bytes_value")
10
+ STRING_VALUE_FIELD_NUMBER: _ClassVar[int]
11
+ BOOL_VALUE_FIELD_NUMBER: _ClassVar[int]
12
+ INT_VALUE_FIELD_NUMBER: _ClassVar[int]
13
+ DOUBLE_VALUE_FIELD_NUMBER: _ClassVar[int]
14
+ ARRAY_VALUE_FIELD_NUMBER: _ClassVar[int]
15
+ KVLIST_VALUE_FIELD_NUMBER: _ClassVar[int]
16
+ BYTES_VALUE_FIELD_NUMBER: _ClassVar[int]
17
+ string_value: str
18
+ bool_value: bool
19
+ int_value: int
20
+ double_value: float
21
+ array_value: ArrayValue
22
+ kvlist_value: KeyValueList
23
+ bytes_value: bytes
24
+ def __init__(self, string_value: _Optional[str] = ..., bool_value: bool = ..., int_value: _Optional[int] = ..., double_value: _Optional[float] = ..., array_value: _Optional[_Union[ArrayValue, _Mapping]] = ..., kvlist_value: _Optional[_Union[KeyValueList, _Mapping]] = ..., bytes_value: _Optional[bytes] = ...) -> None: ...
25
+
26
+ class ArrayValue(_message.Message):
27
+ __slots__ = ("values",)
28
+ VALUES_FIELD_NUMBER: _ClassVar[int]
29
+ values: _containers.RepeatedCompositeFieldContainer[AnyValue]
30
+ def __init__(self, values: _Optional[_Iterable[_Union[AnyValue, _Mapping]]] = ...) -> None: ...
31
+
32
+ class KeyValueList(_message.Message):
33
+ __slots__ = ("values",)
34
+ VALUES_FIELD_NUMBER: _ClassVar[int]
35
+ values: _containers.RepeatedCompositeFieldContainer[KeyValue]
36
+ def __init__(self, values: _Optional[_Iterable[_Union[KeyValue, _Mapping]]] = ...) -> None: ...
37
+
38
+ class KeyValue(_message.Message):
39
+ __slots__ = ("key", "value")
40
+ KEY_FIELD_NUMBER: _ClassVar[int]
41
+ VALUE_FIELD_NUMBER: _ClassVar[int]
42
+ key: str
43
+ value: AnyValue
44
+ def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[AnyValue, _Mapping]] = ...) -> None: ...
45
+
46
+ class RunScope(_message.Message):
47
+ __slots__ = ("run_id", "run_name", "attributes", "dropped_attributes_count")
48
+ RUN_ID_FIELD_NUMBER: _ClassVar[int]
49
+ RUN_NAME_FIELD_NUMBER: _ClassVar[int]
50
+ ATTRIBUTES_FIELD_NUMBER: _ClassVar[int]
51
+ DROPPED_ATTRIBUTES_COUNT_FIELD_NUMBER: _ClassVar[int]
52
+ run_id: bytes
53
+ run_name: str
54
+ attributes: _containers.RepeatedCompositeFieldContainer[KeyValue]
55
+ dropped_attributes_count: int
56
+ def __init__(self, run_id: _Optional[bytes] = ..., run_name: _Optional[str] = ..., attributes: _Optional[_Iterable[_Union[KeyValue, _Mapping]]] = ..., dropped_attributes_count: _Optional[int] = ...) -> None: ...
@@ -0,0 +1,17 @@
1
+ syntax = "proto3";
2
+
3
+ package divi.proto.core.health.v1;
4
+
5
+ option go_package = "services/proto";
6
+
7
+ // HealthService is a service that implements health check.
8
+ service HealthService {
9
+ rpc Check(HealthCheckRequest) returns (HealthCheckResponse) {}
10
+ }
11
+
12
+ message HealthCheckRequest { string version = 1; }
13
+
14
+ message HealthCheckResponse {
15
+ bool status = 1;
16
+ string message = 2;
17
+ }
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # Generated by the protocol buffer compiler. DO NOT EDIT!
3
3
  # NO CHECKED-IN PROTOBUF GENCODE
4
- # source: divi/proto/health.proto
4
+ # source: divi/proto/core/health/v1/health_service.proto
5
5
  # Protobuf Python Version: 5.29.0
6
6
  """Generated protocol buffer code."""
7
7
  from google.protobuf import descriptor as _descriptor
@@ -15,7 +15,7 @@ _runtime_version.ValidateProtobufRuntimeVersion(
15
15
  29,
16
16
  0,
17
17
  '',
18
- 'divi/proto/health.proto'
18
+ 'divi/proto/core/health/v1/health_service.proto'
19
19
  )
20
20
  # @@protoc_insertion_point(imports)
21
21
 
@@ -24,16 +24,18 @@ _sym_db = _symbol_database.Default()
24
24
 
25
25
 
26
26
 
27
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x17\x64ivi/proto/health.proto\x12\x04\x63ore\"%\n\x12HealthCheckRequest\x12\x0f\n\x07version\x18\x01 \x01(\t\"6\n\x13HealthCheckResponse\x12\x0e\n\x06status\x18\x01 \x01(\x08\x12\x0f\n\x07message\x18\x02 \x01(\tB\x10Z\x0eservices/protob\x06proto3')
27
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n.divi/proto/core/health/v1/health_service.proto\x12\x19\x64ivi.proto.core.health.v1\"%\n\x12HealthCheckRequest\x12\x0f\n\x07version\x18\x01 \x01(\t\"6\n\x13HealthCheckResponse\x12\x0e\n\x06status\x18\x01 \x01(\x08\x12\x0f\n\x07message\x18\x02 \x01(\t2y\n\rHealthService\x12h\n\x05\x43heck\x12-.divi.proto.core.health.v1.HealthCheckRequest\x1a..divi.proto.core.health.v1.HealthCheckResponse\"\x00\x42\x10Z\x0eservices/protob\x06proto3')
28
28
 
29
29
  _globals = globals()
30
30
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
31
- _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'divi.proto.health_pb2', _globals)
31
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'divi.proto.core.health.v1.health_service_pb2', _globals)
32
32
  if not _descriptor._USE_C_DESCRIPTORS:
33
33
  _globals['DESCRIPTOR']._loaded_options = None
34
34
  _globals['DESCRIPTOR']._serialized_options = b'Z\016services/proto'
35
- _globals['_HEALTHCHECKREQUEST']._serialized_start=33
36
- _globals['_HEALTHCHECKREQUEST']._serialized_end=70
37
- _globals['_HEALTHCHECKRESPONSE']._serialized_start=72
38
- _globals['_HEALTHCHECKRESPONSE']._serialized_end=126
35
+ _globals['_HEALTHCHECKREQUEST']._serialized_start=77
36
+ _globals['_HEALTHCHECKREQUEST']._serialized_end=114
37
+ _globals['_HEALTHCHECKRESPONSE']._serialized_start=116
38
+ _globals['_HEALTHCHECKRESPONSE']._serialized_end=170
39
+ _globals['_HEALTHSERVICE']._serialized_start=172
40
+ _globals['_HEALTHSERVICE']._serialized_end=293
39
41
  # @@protoc_insertion_point(module_scope)
@@ -3,7 +3,7 @@
3
3
  import grpc
4
4
  import warnings
5
5
 
6
- from divi.proto import health_pb2 as divi_dot_proto_dot_health__pb2
6
+ from divi.proto.core.health.v1 import health_service_pb2 as divi_dot_proto_dot_core_dot_health_dot_v1_dot_health__service__pb2
7
7
 
8
8
  GRPC_GENERATED_VERSION = '1.69.0'
9
9
  GRPC_VERSION = grpc.__version__
@@ -18,15 +18,15 @@ except ImportError:
18
18
  if _version_not_supported:
19
19
  raise RuntimeError(
20
20
  f'The grpc package installed is at version {GRPC_VERSION},'
21
- + f' but the generated code in divi/proto/core_pb2_grpc.py depends on'
21
+ + f' but the generated code in divi/proto/core/health/v1/health_service_pb2_grpc.py depends on'
22
22
  + f' grpcio>={GRPC_GENERATED_VERSION}.'
23
23
  + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
24
24
  + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
25
25
  )
26
26
 
27
27
 
28
- class CoreStub(object):
29
- """Health is a service that implements health check.
28
+ class HealthServiceStub(object):
29
+ """HealthService is a service that implements health check.
30
30
  """
31
31
 
32
32
  def __init__(self, channel):
@@ -36,14 +36,14 @@ class CoreStub(object):
36
36
  channel: A grpc.Channel.
37
37
  """
38
38
  self.Check = channel.unary_unary(
39
- '/core.Core/Check',
40
- request_serializer=divi_dot_proto_dot_health__pb2.HealthCheckRequest.SerializeToString,
41
- response_deserializer=divi_dot_proto_dot_health__pb2.HealthCheckResponse.FromString,
39
+ '/divi.proto.core.health.v1.HealthService/Check',
40
+ request_serializer=divi_dot_proto_dot_core_dot_health_dot_v1_dot_health__service__pb2.HealthCheckRequest.SerializeToString,
41
+ response_deserializer=divi_dot_proto_dot_core_dot_health_dot_v1_dot_health__service__pb2.HealthCheckResponse.FromString,
42
42
  _registered_method=True)
43
43
 
44
44
 
45
- class CoreServicer(object):
46
- """Health is a service that implements health check.
45
+ class HealthServiceServicer(object):
46
+ """HealthService is a service that implements health check.
47
47
  """
48
48
 
49
49
  def Check(self, request, context):
@@ -53,23 +53,23 @@ class CoreServicer(object):
53
53
  raise NotImplementedError('Method not implemented!')
54
54
 
55
55
 
56
- def add_CoreServicer_to_server(servicer, server):
56
+ def add_HealthServiceServicer_to_server(servicer, server):
57
57
  rpc_method_handlers = {
58
58
  'Check': grpc.unary_unary_rpc_method_handler(
59
59
  servicer.Check,
60
- request_deserializer=divi_dot_proto_dot_health__pb2.HealthCheckRequest.FromString,
61
- response_serializer=divi_dot_proto_dot_health__pb2.HealthCheckResponse.SerializeToString,
60
+ request_deserializer=divi_dot_proto_dot_core_dot_health_dot_v1_dot_health__service__pb2.HealthCheckRequest.FromString,
61
+ response_serializer=divi_dot_proto_dot_core_dot_health_dot_v1_dot_health__service__pb2.HealthCheckResponse.SerializeToString,
62
62
  ),
63
63
  }
64
64
  generic_handler = grpc.method_handlers_generic_handler(
65
- 'core.Core', rpc_method_handlers)
65
+ 'divi.proto.core.health.v1.HealthService', rpc_method_handlers)
66
66
  server.add_generic_rpc_handlers((generic_handler,))
67
- server.add_registered_method_handlers('core.Core', rpc_method_handlers)
67
+ server.add_registered_method_handlers('divi.proto.core.health.v1.HealthService', rpc_method_handlers)
68
68
 
69
69
 
70
70
  # This class is part of an EXPERIMENTAL API.
71
- class Core(object):
72
- """Health is a service that implements health check.
71
+ class HealthService(object):
72
+ """HealthService is a service that implements health check.
73
73
  """
74
74
 
75
75
  @staticmethod
@@ -86,9 +86,9 @@ class Core(object):
86
86
  return grpc.experimental.unary_unary(
87
87
  request,
88
88
  target,
89
- '/core.Core/Check',
90
- divi_dot_proto_dot_health__pb2.HealthCheckRequest.SerializeToString,
91
- divi_dot_proto_dot_health__pb2.HealthCheckResponse.FromString,
89
+ '/divi.proto.core.health.v1.HealthService/Check',
90
+ divi_dot_proto_dot_core_dot_health_dot_v1_dot_health__service__pb2.HealthCheckRequest.SerializeToString,
91
+ divi_dot_proto_dot_core_dot_health_dot_v1_dot_health__service__pb2.HealthCheckResponse.FromString,
92
92
  options,
93
93
  channel_credentials,
94
94
  insecure,
@@ -0,0 +1,29 @@
1
+ syntax = "proto3";
2
+
3
+ package divi.proto.metric.v1;
4
+
5
+ import "divi/proto/common/v1/common.proto";
6
+
7
+ option go_package = "services/proto";
8
+
9
+ message ScopeMetrics {
10
+ // The scope of the message
11
+ divi.proto.common.v1.RunScope scope = 1;
12
+
13
+ // A list of spans that originate from a resource.
14
+ repeated Metric metrics = 2;
15
+ }
16
+
17
+ message Metric {
18
+ // The name of the metric.
19
+ string name = 1;
20
+
21
+ // The description of the metric.
22
+ string description = 2;
23
+
24
+ // The data of the metric.
25
+ divi.proto.common.v1.AnyValue data = 3;
26
+
27
+ // The metadata is a set of attributes that describe the span.
28
+ repeated divi.proto.common.v1.KeyValue metadata = 4;
29
+ }
@@ -0,0 +1,40 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # NO CHECKED-IN PROTOBUF GENCODE
4
+ # source: divi/proto/metric/v1/metric.proto
5
+ # Protobuf Python Version: 5.29.0
6
+ """Generated protocol buffer code."""
7
+ from google.protobuf import descriptor as _descriptor
8
+ from google.protobuf import descriptor_pool as _descriptor_pool
9
+ from google.protobuf import runtime_version as _runtime_version
10
+ from google.protobuf import symbol_database as _symbol_database
11
+ from google.protobuf.internal import builder as _builder
12
+ _runtime_version.ValidateProtobufRuntimeVersion(
13
+ _runtime_version.Domain.PUBLIC,
14
+ 5,
15
+ 29,
16
+ 0,
17
+ '',
18
+ 'divi/proto/metric/v1/metric.proto'
19
+ )
20
+ # @@protoc_insertion_point(imports)
21
+
22
+ _sym_db = _symbol_database.Default()
23
+
24
+
25
+ from divi.proto.common.v1 import common_pb2 as divi_dot_proto_dot_common_dot_v1_dot_common__pb2
26
+
27
+
28
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!divi/proto/metric/v1/metric.proto\x12\x14\x64ivi.proto.metric.v1\x1a!divi/proto/common/v1/common.proto\"l\n\x0cScopeMetrics\x12-\n\x05scope\x18\x01 \x01(\x0b\x32\x1e.divi.proto.common.v1.RunScope\x12-\n\x07metrics\x18\x02 \x03(\x0b\x32\x1c.divi.proto.metric.v1.Metric\"\x8b\x01\n\x06Metric\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12,\n\x04\x64\x61ta\x18\x03 \x01(\x0b\x32\x1e.divi.proto.common.v1.AnyValue\x12\x30\n\x08metadata\x18\x04 \x03(\x0b\x32\x1e.divi.proto.common.v1.KeyValueB\x10Z\x0eservices/protob\x06proto3')
29
+
30
+ _globals = globals()
31
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
32
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'divi.proto.metric.v1.metric_pb2', _globals)
33
+ if not _descriptor._USE_C_DESCRIPTORS:
34
+ _globals['DESCRIPTOR']._loaded_options = None
35
+ _globals['DESCRIPTOR']._serialized_options = b'Z\016services/proto'
36
+ _globals['_SCOPEMETRICS']._serialized_start=94
37
+ _globals['_SCOPEMETRICS']._serialized_end=202
38
+ _globals['_METRIC']._serialized_start=205
39
+ _globals['_METRIC']._serialized_end=344
40
+ # @@protoc_insertion_point(module_scope)
@@ -0,0 +1,27 @@
1
+ from divi.proto.common.v1 import common_pb2 as _common_pb2
2
+ from google.protobuf.internal import containers as _containers
3
+ from google.protobuf import descriptor as _descriptor
4
+ from google.protobuf import message as _message
5
+ from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union
6
+
7
+ DESCRIPTOR: _descriptor.FileDescriptor
8
+
9
+ class ScopeMetrics(_message.Message):
10
+ __slots__ = ("scope", "metrics")
11
+ SCOPE_FIELD_NUMBER: _ClassVar[int]
12
+ METRICS_FIELD_NUMBER: _ClassVar[int]
13
+ scope: _common_pb2.RunScope
14
+ metrics: _containers.RepeatedCompositeFieldContainer[Metric]
15
+ def __init__(self, scope: _Optional[_Union[_common_pb2.RunScope, _Mapping]] = ..., metrics: _Optional[_Iterable[_Union[Metric, _Mapping]]] = ...) -> None: ...
16
+
17
+ class Metric(_message.Message):
18
+ __slots__ = ("name", "description", "data", "metadata")
19
+ NAME_FIELD_NUMBER: _ClassVar[int]
20
+ DESCRIPTION_FIELD_NUMBER: _ClassVar[int]
21
+ DATA_FIELD_NUMBER: _ClassVar[int]
22
+ METADATA_FIELD_NUMBER: _ClassVar[int]
23
+ name: str
24
+ description: str
25
+ data: _common_pb2.AnyValue
26
+ metadata: _containers.RepeatedCompositeFieldContainer[_common_pb2.KeyValue]
27
+ def __init__(self, name: _Optional[str] = ..., description: _Optional[str] = ..., data: _Optional[_Union[_common_pb2.AnyValue, _Mapping]] = ..., metadata: _Optional[_Iterable[_Union[_common_pb2.KeyValue, _Mapping]]] = ...) -> None: ...
@@ -0,0 +1,38 @@
1
+ syntax = "proto3";
2
+
3
+ package divi.proto.run.v1;
4
+
5
+ import "divi/proto/common/v1/common.proto";
6
+
7
+ option go_package = "services/proto";
8
+
9
+ message Run {
10
+ // The run_id is the unique identifier of the run. It is a 16-byte array.
11
+ bytes run_id = 1;
12
+
13
+ // The name of the run.
14
+ string name = 2;
15
+
16
+ enum RunKind {
17
+ // Observation represents a run that is used for observation.
18
+ Observation = 0;
19
+
20
+ // Evaluation represents a run that is used for evaluation.
21
+ Evaluation = 1;
22
+
23
+ // Dataset represents a run that is used for creating a dataset.
24
+ Dataset = 2;
25
+ }
26
+
27
+ // The kind of the run.
28
+ RunKind kind = 3;
29
+
30
+ // The start_time_unix_nano is the start time of the run in Unix nanoseconds.
31
+ fixed64 start_time_unix_nano = 4;
32
+
33
+ // The end_time_unix_nano is the end time of the run in Unix nanoseconds.
34
+ fixed64 end_time_unix_nano = 5;
35
+
36
+ // The metadata is a set of attributes that describe the run.
37
+ repeated divi.proto.common.v1.KeyValue metadata = 6;
38
+ }