odigos-opentelemetry-python 1.0.86__tar.gz → 1.0.88__tar.gz

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 (37) hide show
  1. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/PKG-INFO +2 -2
  2. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/initializer/__init__.py +5 -4
  3. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/initializer/components.py +8 -7
  4. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/initializer/distro/distro.py +3 -6
  5. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/initializer/distro/instrumentation_registry.py +2 -1
  6. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/initializer/envs.py +2 -1
  7. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/initializer/exit_hook.py +4 -1
  8. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/initializer/lib_handling.py +19 -22
  9. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/initializer/post_instrument.py +1 -0
  10. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/initializer/process_resource.py +24 -18
  11. odigos_opentelemetry_python-1.0.88/initializer/version.py +1 -0
  12. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/odigos_opentelemetry_python.egg-info/PKG-INFO +2 -2
  13. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/odigos_opentelemetry_python.egg-info/requires.txt +1 -1
  14. odigos_opentelemetry_python-1.0.88/opamp/anyvalue_pb2.py +80 -0
  15. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/opamp/health_status.py +1 -0
  16. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/opamp/http_client.py +16 -9
  17. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/opamp/opamp_registry.py +4 -2
  18. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/opamp/utils.py +3 -1
  19. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/pyproject.toml +8 -2
  20. odigos_opentelemetry_python-1.0.86/initializer/version.py +0 -1
  21. odigos_opentelemetry_python-1.0.86/opamp/anyvalue_pb2.py +0 -65
  22. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/LICENSE +0 -0
  23. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/README.md +0 -0
  24. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/initializer/distro/__init__.py +0 -0
  25. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/initializer/odigos_sampler.py +0 -0
  26. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/initializer/odigos_sampler_helpers.py +0 -0
  27. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/initializer/schemas/__init__.py +0 -0
  28. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/initializer/schemas/sampling.py +0 -0
  29. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/odigos_opentelemetry_python.egg-info/SOURCES.txt +0 -0
  30. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/odigos_opentelemetry_python.egg-info/dependency_links.txt +0 -0
  31. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/odigos_opentelemetry_python.egg-info/entry_points.txt +0 -0
  32. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/odigos_opentelemetry_python.egg-info/top_level.txt +0 -0
  33. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/opamp/__init__.py +0 -0
  34. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/opamp/config.py +0 -0
  35. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/opamp/opamp_pb2.py +0 -0
  36. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/opamp/transport.py +0 -0
  37. {odigos_opentelemetry_python-1.0.86 → odigos_opentelemetry_python-1.0.88}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: odigos-opentelemetry-python
3
- Version: 1.0.86
3
+ Version: 1.0.88
4
4
  Summary: Odigos Initializer for Python OpenTelemetry Components
5
5
  Author-email: odigos-io <support@odigos.io>
6
6
  Requires-Python: >=3.9
@@ -36,7 +36,7 @@ Requires-Dist: opentelemetry-instrumentation-botocore==0.61b0
36
36
  Requires-Dist: opentelemetry-instrumentation-cassandra==0.61b0
37
37
  Requires-Dist: opentelemetry-instrumentation-celery==0.61b0
38
38
  Requires-Dist: opentelemetry-instrumentation-click==0.61b0
39
- Requires-Dist: opentelemetry-instrumentation-confluent-kafka==0.61b0
39
+ Requires-Dist: odigos-opentelemetry-instrumentation-confluent-kafka==0.61b0
40
40
  Requires-Dist: opentelemetry-instrumentation-dbapi==0.61b0
41
41
  Requires-Dist: opentelemetry-instrumentation-django==0.61b0
42
42
  Requires-Dist: odigos-opentelemetry-instrumentation-elasticsearch==0.61b0
@@ -1,4 +1,4 @@
1
- import logging
1
+ import logging
2
2
 
3
3
 
4
4
  # This is the main odigos-opentelemetry-python logger setup function.
@@ -10,12 +10,13 @@ def setup_logging():
10
10
  formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
11
11
  handler.setFormatter(formatter)
12
12
  odigos_logger.addHandler(handler)
13
-
13
+
14
14
  odigos_logger.propagate = False # Prevent logs from reaching the root logger
15
15
  odigos_logger.disabled = True # Comment to enable the logger
16
-
16
+
17
17
  # Suppress third-party loggers used by odigos-opentelemetry-python (before they are used)
18
18
  logging.getLogger('urllib3_odigos').setLevel(logging.CRITICAL)
19
19
  logging.getLogger('requests_odigos').setLevel(logging.CRITICAL)
20
20
 
21
- setup_logging()
21
+
22
+ setup_logging()
@@ -1,3 +1,4 @@
1
+ from typing import Union
1
2
  from .lib_handling import reorder_python_path, reload_distro_modules, handle_django_instrumentation, handle_eventlet_instrumentation
2
3
 
3
4
  handle_eventlet_instrumentation()
@@ -74,7 +75,7 @@ def initialize_components(trace_exporters=False, span_processor=None):
74
75
  # we will use the default value which is enable traces only.
75
76
  if opamp_connection_event.error:
76
77
  container_config = None
77
- supported_signals = {"traceSignal": True}
78
+ supported_signals: dict[str, Union[str, bool]] = {"traceSignal": True}
78
79
  initial_sampler_config = None
79
80
  initial_remote_config = None
80
81
  else:
@@ -109,8 +110,8 @@ def initialize_components(trace_exporters=False, span_processor=None):
109
110
  odigos_sampler = initialize_traces_if_enabled(
110
111
  trace_exporters,
111
112
  resource,
112
- span_processor,
113
113
  supported_signals,
114
+ span_processor,
114
115
  initial_sampler_config,
115
116
  initial_remote_config,
116
117
  )
@@ -132,8 +133,8 @@ def initialize_components(trace_exporters=False, span_processor=None):
132
133
  def initialize_traces_if_enabled(
133
134
  trace_exporters,
134
135
  resource,
136
+ signals: dict[str, Union[str, bool]],
135
137
  span_processor=None,
136
- signals=None,
137
138
  initial_sampler_config=None,
138
139
  initial_remote_config=None,
139
140
  ):
@@ -301,7 +302,7 @@ def update_agent_config(conf: Config):
301
302
  proc.update_config(conf)
302
303
 
303
304
 
304
- def is_supported_python_version():
305
+ def is_supported_python_version() -> bool:
305
306
  return sys.version_info >= MINIMUM_PYTHON_SUPPORTED_VERSION
306
307
 
307
308
 
@@ -374,11 +375,11 @@ class ProxyResource(Resource):
374
375
  @property
375
376
  def attributes(self):
376
377
  self._refresh_if_needed()
377
- return self._cached.attributes
378
+ return self._cached.attributes if self._cached else None
378
379
 
379
380
  def merge(self, other: Resource):
380
381
  self._refresh_if_needed()
381
- return self._cached.merge(other)
382
+ return self._cached.merge(other) if self._cached else None
382
383
 
383
384
 
384
385
  def _after_in_child():
@@ -390,7 +391,7 @@ def _after_in_child():
390
391
  # Without this, the forked client's sampler is None and config updates
391
392
  # from OpAMP heartbeats are silently dropped.
392
393
  provider = get_tracer_provider()
393
- if isinstance(getattr(provider, "resource", None), ProxyResource):
394
+ if isinstance(provider, TracerProvider) and isinstance(provider.resource, ProxyResource):
394
395
  provider.resource._child_refreshed = False
395
396
  client = start_opamp_client(OpampConnectionEvent())
396
397
 
@@ -1,6 +1,6 @@
1
1
  from opentelemetry.instrumentation.distro import BaseDistro
2
2
  from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
3
- from importlib.metadata import EntryPoint
3
+ from opentelemetry.util._importlib_metadata import EntryPoint
4
4
  from .instrumentation_registry import add_instrumented_library
5
5
 
6
6
 
@@ -22,14 +22,11 @@ class OdigosDistro(BaseDistro):
22
22
  pass
23
23
 
24
24
  def load_instrumentor(self, entry_point: EntryPoint, **kwargs) -> None:
25
- instrumentor: BaseInstrumentor = entry_point.load()
25
+ instrumentor: type[BaseInstrumentor] = entry_point.load()
26
26
  instance = instrumentor()
27
27
  instance.instrument(**kwargs)
28
28
 
29
29
  # Later we can add more details here, like the version of the library, etc.
30
- instrumentation_details = {
31
- "is_standard_lib": entry_point.name in STANDARD_LIB_MODULES
32
- }
30
+ instrumentation_details = {"is_standard_lib": entry_point.name in STANDARD_LIB_MODULES}
33
31
 
34
32
  add_instrumented_library(entry_point.name, instrumentation_details)
35
-
@@ -1,8 +1,9 @@
1
-
2
1
  _instrumented = {}
3
2
 
3
+
4
4
  def add_instrumented_library(name, instrumentation_details) -> None:
5
5
  _instrumented[name] = instrumentation_details
6
6
 
7
+
7
8
  def get_instrumented_libraries() -> dict:
8
9
  return _instrumented
@@ -4,6 +4,7 @@ static_env_dict = {
4
4
  "OTEL_PYTHON_LOG_CORRELATION": "true",
5
5
  }
6
6
 
7
+
7
8
  def set_static_otel_env():
8
9
  """
9
10
  Injects environment variables from a dictionary.
@@ -11,4 +12,4 @@ def set_static_otel_env():
11
12
  if not isinstance(static_env_dict, dict):
12
13
  raise TypeError("static_env_dict must be a dictionary")
13
14
 
14
- os.environ.update(static_env_dict)
15
+ os.environ.update(static_env_dict)
@@ -1,9 +1,12 @@
1
1
  import sys
2
+
3
+
2
4
  class ExitHooks(object):
3
5
  """
4
6
  The ExitHooks class intercepts program exits to capture the reason for termination.
5
7
  It hooks into sys.exit to record exit codes
6
8
  """
9
+
7
10
  def __init__(self):
8
11
  self.exit_code = None
9
12
  self.exception = None
@@ -11,7 +14,7 @@ class ExitHooks(object):
11
14
  def hook(self):
12
15
  self._orig_exit = sys.exit
13
16
  self._orig_excepthook = sys.excepthook
14
- sys.exit = self.exit
17
+ sys.exit = self.exit # ty: ignore[invalid-assignment]
15
18
  sys.excepthook = self.exc_handler
16
19
 
17
20
  def exit(self, code=0):
@@ -2,16 +2,17 @@ import sys
2
2
  import importlib
3
3
  import os
4
4
 
5
+
5
6
  def reorder_python_path():
6
7
  # Moves '/var/odigos/' [k8s] and '/etc/odigos-vmagent/' [vmagent] paths to end of sys.path
7
8
  # to prioritize user dependencies over odigos ones
8
9
  paths_to_move = [path for path in sys.path if path.startswith(('/var/odigos/', '/etc/odigos-vmagent/'))]
9
-
10
+
10
11
  for path in paths_to_move:
11
12
  sys.path.remove(path)
12
13
  sys.path.append(path)
13
-
14
-
14
+
15
+
15
16
  def reload_distro_modules() -> None:
16
17
  # Delete distro modules and their sub-modules, as they have been imported before the path was reordered.
17
18
  # The distro modules will be re-imported from the new path.
@@ -30,62 +31,58 @@ def reload_distro_modules() -> None:
30
31
  'uuid_extensions.uuid7',
31
32
  'typing_extensions',
32
33
  ]
33
-
34
- excluded_modules = [
35
- 'urllib3_odigos',
36
- 'requests_odigos'
37
- ]
38
-
34
+
35
+ excluded_modules = ['urllib3_odigos', 'requests_odigos']
36
+
39
37
  for module in list(sys.modules):
40
38
  # Check if the module starts with any of the needed prefixes, but not with any of the excluded prefixes.
41
39
  if any(module.startswith(prefix) for prefix in excluded_modules):
42
40
  continue
43
-
41
+
44
42
  if any(module.startswith(prefix) for prefix in needed_module_prefixes):
45
43
  module_file = getattr(sys.modules[module], '__file__', None) # Safely get __file__
46
44
  if module_file and ('/etc/odigos-vmagent/' in module_file or '/var/odigos/' in module_file):
47
45
  del sys.modules[module]
48
46
 
49
47
 
50
-
51
48
  ### Django
52
49
 
50
+
53
51
  # Disables Django instrumentation if DJANGO_SETTINGS_MODULE is unset and adds the current directory to sys.path for proper Django instrumentation.
54
52
  # These changes address this issue: https://github.com/open-telemetry/opentelemetry-python-contrib/issues/2495.
55
53
  # TODO: Remove once the bug is fixed.
56
54
  def handle_django_instrumentation():
57
55
  # Get the DJANGO_SETTINGS_MODULE environment variable value.
58
56
  django_settings_module = os.getenv('DJANGO_SETTINGS_MODULE', None)
59
-
57
+
60
58
  if django_settings_module is None:
61
59
  os.environ.setdefault("OTEL_PYTHON_DJANGO_INSTRUMENT", 'False')
62
-
60
+
63
61
  else:
64
62
  cwd_path = os.getcwd()
65
63
  if cwd_path not in sys.path:
66
- sys.path.insert(0, cwd_path)
67
-
64
+ sys.path.insert(0, cwd_path)
65
+
68
66
  # As an additional safeguard, we're ensuring that DJANGO_SETTINGS_MODULE is importable.
69
67
  # This is done to prevent instrumentation from being enabled if the Django settings module cannot be imported.
70
68
  try:
71
- importlib.import_module(django_settings_module)
72
- except:
69
+ importlib.import_module(django_settings_module)
70
+ except Exception:
73
71
  os.environ.setdefault("OTEL_PYTHON_DJANGO_INSTRUMENT", 'False')
74
-
72
+
75
73
 
76
74
  def handle_eventlet_instrumentation():
77
75
  """Checks if eventlet is importable and applies eventlet.monkey_patch if available."""
78
76
  # Apply monkey_patch early to enable Eventlet's green threads for non-blocking I/O.
79
77
  # Per Eventlet docs, it must run before imports or class definitions that use patched modules (e.g., socket).
80
78
  # https://eventlet.readthedocs.io/en/v0.35.1/patching.html#monkey-patch
81
-
79
+
82
80
  # Currently should run only if no OPAMP client is running, as tested only for the VM agent.
83
81
  if os.getenv('DISABLE_OPAMP_CLIENT', 'false').strip().lower() == 'true':
84
82
  try:
85
83
  eventlet = importlib.import_module("eventlet")
86
84
  if not getattr(eventlet, "_opamp_patched", False): # Avoid multiple patches
87
85
  eventlet.monkey_patch()
88
- eventlet._opamp_patched = True
86
+ setattr(eventlet, "_opamp_patched", True)
89
87
  except ImportError:
90
- pass
91
-
88
+ pass
@@ -1,6 +1,7 @@
1
1
  from opamp import opamp_registry
2
2
  from .distro import instrumentation_registry
3
3
 
4
+
4
5
  def run_post_hook():
5
6
  client = opamp_registry.get_client()
6
7
 
@@ -1,8 +1,8 @@
1
- # This file contains code inspired by OpenTelemetry's resource detection mechanisms
2
- # (https://opentelemetry.io/). It adapts and extends the logic to include additional
1
+ # This file contains code inspired by OpenTelemetry's resource detection mechanisms
2
+ # (https://opentelemetry.io/). It adapts and extends the logic to include additional
3
3
  # attributes required for our use case.
4
4
  #
5
- # OpenTelemetry is licensed under the Apache License, Version 2.0. This adaptation respects
5
+ # OpenTelemetry is licensed under the Apache License, Version 2.0. This adaptation respects
6
6
  # the original licensing terms and acknowledges OpenTelemetry as a source of reference.
7
7
  #
8
8
  # For OpenTelemetry’s original implementation, see:
@@ -10,20 +10,26 @@
10
10
 
11
11
  import os
12
12
  from opentelemetry.sdk.resources import Resource, ProcessResourceDetector
13
- from opentelemetry.semconv.resource import ResourceAttributes
13
+ from opentelemetry.semconv._incubating.attributes.process_attributes import (
14
+ PROCESS_COMMAND,
15
+ PROCESS_COMMAND_ARGS,
16
+ PROCESS_COMMAND_LINE,
17
+ PROCESS_PID,
18
+ )
14
19
 
15
20
  PROCESS_VPID = "process.vpid"
16
21
 
17
22
  # Custom implementation of ProcessResourceDetector.
18
- #
19
- # This detector is based on OpenTelemetry's resource detection logic but has been
20
- # implemented separately because the standard OpenTelemetry detector does not support
21
- # the "process.vpid" attribute. This attribute is necessary for our use case to track
23
+ #
24
+ # This detector is based on OpenTelemetry's resource detection logic but has been
25
+ # implemented separately because the standard OpenTelemetry detector does not support
26
+ # the "process.vpid" attribute. This attribute is necessary for our use case to track
22
27
  # process-specific information that is not covered by OpenTelemetry’s built-in attributes.
23
28
  #
24
- # By extending the OpenTelemetry approach, we ensure compatibility while adding the
29
+ # By extending the OpenTelemetry approach, we ensure compatibility while adding the
25
30
  # additional attribute we require.
26
31
 
32
+
27
33
  # ProcessResourceDetector
28
34
  class OdigosProcessResourceDetector(ProcessResourceDetector):
29
35
  def __init__(self, pid):
@@ -37,18 +43,18 @@ class OdigosProcessResourceDetector(ProcessResourceDetector):
37
43
  # Extract attributes as a dictionary (resource_info is a Resource object)
38
44
  attributes = dict(resource_info.attributes)
39
45
 
40
- attributes.pop(ResourceAttributes.PROCESS_COMMAND_ARGS, None) # Remove PROCESS_COMMAND_ARGS if exists
41
-
46
+ attributes.pop(PROCESS_COMMAND_ARGS, None) # Remove PROCESS_COMMAND_ARGS if exists
47
+
42
48
  if os.getenv("DISABLE_OPAMP_CLIENT", "false").strip().lower() == "false":
43
- attributes.pop(ResourceAttributes.PROCESS_PID, None) # Remove PROCESS_PID if exists
49
+ attributes.pop(PROCESS_PID, None) # Remove PROCESS_PID if exists
44
50
  attributes[PROCESS_VPID] = self.pid
45
-
51
+
46
52
  # Fix for cases where the app is run via `python -m <module>`:
47
53
  # sys.argv[0] becomes "-m", which leads to wrong process.command attribute.
48
54
  # To get the real command, read from /proc/self/cmdline (Linux only).
49
55
  # Falls back silently if reading fails.
50
56
  # See: https://github.com/open-telemetry/opentelemetry-python/issues/4518
51
- process_command = attributes.get(ResourceAttributes.PROCESS_COMMAND, None)
57
+ process_command = attributes.get(PROCESS_COMMAND, None)
52
58
  if process_command is not None and process_command == '-m':
53
59
  try:
54
60
  with open("/proc/self/cmdline", "rb") as command_file:
@@ -57,12 +63,12 @@ class OdigosProcessResourceDetector(ProcessResourceDetector):
57
63
  if raw_cmdline:
58
64
  command_line = raw_cmdline.decode(errors="ignore").split('\0')
59
65
  if command_line and command_line[0]:
60
- attributes[ResourceAttributes.PROCESS_COMMAND] = command_line[0]
61
- attributes[ResourceAttributes.PROCESS_COMMAND_LINE] = " ".join(command_line)
62
-
66
+ attributes[PROCESS_COMMAND] = command_line[0]
67
+ attributes[PROCESS_COMMAND_LINE] = " ".join(command_line)
68
+
63
69
  # On failure, we retain the default behavior from the base resource detector
64
70
  except Exception:
65
71
  pass
66
72
 
67
73
  # Return a new Resource instance with updated attributes
68
- return Resource.create(attributes)
74
+ return Resource.create(attributes)
@@ -0,0 +1 @@
1
+ VERSION = "1.0.88"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: odigos-opentelemetry-python
3
- Version: 1.0.86
3
+ Version: 1.0.88
4
4
  Summary: Odigos Initializer for Python OpenTelemetry Components
5
5
  Author-email: odigos-io <support@odigos.io>
6
6
  Requires-Python: >=3.9
@@ -36,7 +36,7 @@ Requires-Dist: opentelemetry-instrumentation-botocore==0.61b0
36
36
  Requires-Dist: opentelemetry-instrumentation-cassandra==0.61b0
37
37
  Requires-Dist: opentelemetry-instrumentation-celery==0.61b0
38
38
  Requires-Dist: opentelemetry-instrumentation-click==0.61b0
39
- Requires-Dist: opentelemetry-instrumentation-confluent-kafka==0.61b0
39
+ Requires-Dist: odigos-opentelemetry-instrumentation-confluent-kafka==0.61b0
40
40
  Requires-Dist: opentelemetry-instrumentation-dbapi==0.61b0
41
41
  Requires-Dist: opentelemetry-instrumentation-django==0.61b0
42
42
  Requires-Dist: odigos-opentelemetry-instrumentation-elasticsearch==0.61b0
@@ -29,7 +29,7 @@ opentelemetry-instrumentation-botocore==0.61b0
29
29
  opentelemetry-instrumentation-cassandra==0.61b0
30
30
  opentelemetry-instrumentation-celery==0.61b0
31
31
  opentelemetry-instrumentation-click==0.61b0
32
- opentelemetry-instrumentation-confluent-kafka==0.61b0
32
+ odigos-opentelemetry-instrumentation-confluent-kafka==0.61b0
33
33
  opentelemetry-instrumentation-dbapi==0.61b0
34
34
  opentelemetry-instrumentation-django==0.61b0
35
35
  odigos-opentelemetry-instrumentation-elasticsearch==0.61b0
@@ -0,0 +1,80 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: anyvalue.proto
4
+ """Generated protocol buffer code."""
5
+
6
+ from google.protobuf import descriptor as _descriptor
7
+ from google.protobuf import descriptor_pool as _descriptor_pool
8
+ from google.protobuf import message as _message
9
+ from google.protobuf import reflection as _reflection
10
+ from google.protobuf import symbol_database as _symbol_database
11
+ # @@protoc_insertion_point(imports)
12
+
13
+ _sym_db = _symbol_database.Default()
14
+
15
+
16
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
17
+ b'\n\x0e\x61nyvalue.proto\x12\x0bopamp.proto"\xe8\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.\n\x0b\x61rray_value\x18\x05 \x01(\x0b\x32\x17.opamp.proto.ArrayValueH\x00\x12\x31\n\x0ckvlist_value\x18\x06 \x01(\x0b\x32\x19.opamp.proto.KeyValueListH\x00\x12\x15\n\x0b\x62ytes_value\x18\x07 \x01(\x0cH\x00\x42\x07\n\x05value"3\n\nArrayValue\x12%\n\x06values\x18\x01 \x03(\x0b\x32\x15.opamp.proto.AnyValue"5\n\x0cKeyValueList\x12%\n\x06values\x18\x01 \x03(\x0b\x32\x15.opamp.proto.KeyValue"=\n\x08KeyValue\x12\x0b\n\x03key\x18\x01 \x01(\t\x12$\n\x05value\x18\x02 \x01(\x0b\x32\x15.opamp.proto.AnyValueB.Z,github.com/open-telemetry/opamp-go/protobufsb\x06proto3'
18
+ )
19
+
20
+
21
+ _ANYVALUE = DESCRIPTOR.message_types_by_name['AnyValue']
22
+ _ARRAYVALUE = DESCRIPTOR.message_types_by_name['ArrayValue']
23
+ _KEYVALUELIST = DESCRIPTOR.message_types_by_name['KeyValueList']
24
+ _KEYVALUE = DESCRIPTOR.message_types_by_name['KeyValue']
25
+ AnyValue = _reflection.GeneratedProtocolMessageType(
26
+ 'AnyValue',
27
+ (_message.Message,),
28
+ {
29
+ 'DESCRIPTOR': _ANYVALUE,
30
+ '__module__': 'anyvalue_pb2',
31
+ # @@protoc_insertion_point(class_scope:opamp.proto.AnyValue)
32
+ },
33
+ )
34
+ _sym_db.RegisterMessage(AnyValue)
35
+
36
+ ArrayValue = _reflection.GeneratedProtocolMessageType(
37
+ 'ArrayValue',
38
+ (_message.Message,),
39
+ {
40
+ 'DESCRIPTOR': _ARRAYVALUE,
41
+ '__module__': 'anyvalue_pb2',
42
+ # @@protoc_insertion_point(class_scope:opamp.proto.ArrayValue)
43
+ },
44
+ )
45
+ _sym_db.RegisterMessage(ArrayValue)
46
+
47
+ KeyValueList = _reflection.GeneratedProtocolMessageType(
48
+ 'KeyValueList',
49
+ (_message.Message,),
50
+ {
51
+ 'DESCRIPTOR': _KEYVALUELIST,
52
+ '__module__': 'anyvalue_pb2',
53
+ # @@protoc_insertion_point(class_scope:opamp.proto.KeyValueList)
54
+ },
55
+ )
56
+ _sym_db.RegisterMessage(KeyValueList)
57
+
58
+ KeyValue = _reflection.GeneratedProtocolMessageType(
59
+ 'KeyValue',
60
+ (_message.Message,),
61
+ {
62
+ 'DESCRIPTOR': _KEYVALUE,
63
+ '__module__': 'anyvalue_pb2',
64
+ # @@protoc_insertion_point(class_scope:opamp.proto.KeyValue)
65
+ },
66
+ )
67
+ _sym_db.RegisterMessage(KeyValue)
68
+
69
+ if _descriptor._USE_C_DESCRIPTORS == False:
70
+ DESCRIPTOR._options = None
71
+ DESCRIPTOR._serialized_options = b'Z,github.com/open-telemetry/opamp-go/protobufs'
72
+ _ANYVALUE._serialized_start = 32
73
+ _ANYVALUE._serialized_end = 264
74
+ _ARRAYVALUE._serialized_start = 266
75
+ _ARRAYVALUE._serialized_end = 317
76
+ _KEYVALUELIST._serialized_start = 319
77
+ _KEYVALUELIST._serialized_end = 372
78
+ _KEYVALUE._serialized_start = 374
79
+ _KEYVALUE._serialized_end = 435
80
+ # @@protoc_insertion_point(module_scope)
@@ -1,5 +1,6 @@
1
1
  from enum import Enum
2
2
 
3
+
3
4
  class AgentHealthStatus(str, Enum):
4
5
  HEALTHY = "Healthy"
5
6
  STARTING = "Starting"
@@ -1,3 +1,4 @@
1
+ from typing import Optional, cast
1
2
  import os
2
3
  import sys
3
4
  import json
@@ -6,10 +7,16 @@ import base64
6
7
  import threading
7
8
  import requests_odigos
8
9
  import logging
9
- from typing import Optional
10
10
 
11
11
  from uuid_extensions import uuid7
12
- from opentelemetry.semconv.resource import ResourceAttributes
12
+ from opentelemetry.semconv._incubating.attributes.k8s_attributes import (
13
+ K8S_CONTAINER_NAME,
14
+ K8S_NAMESPACE_NAME,
15
+ K8S_POD_NAME,
16
+ )
17
+ from opentelemetry.semconv._incubating.attributes.process_attributes import PROCESS_PID
18
+ from opentelemetry.semconv.attributes.service_attributes import SERVICE_INSTANCE_ID
19
+ from opentelemetry.semconv.attributes.telemetry_attributes import TELEMETRY_SDK_LANGUAGE
13
20
  from opentelemetry.context import (
14
21
  _SUPPRESS_HTTP_INSTRUMENTATION_KEY,
15
22
  attach,
@@ -32,9 +39,9 @@ opamp_logger = logging.getLogger('odigos')
32
39
  _debugger_instance = None
33
40
 
34
41
  env_var_mappings = {
35
- "ODIGOS_WORKLOAD_NAMESPACE": ResourceAttributes.K8S_NAMESPACE_NAME,
36
- "ODIGOS_CONTAINER_NAME": ResourceAttributes.K8S_CONTAINER_NAME,
37
- "ODIGOS_POD_NAME": ResourceAttributes.K8S_POD_NAME,
42
+ "ODIGOS_WORKLOAD_NAMESPACE": K8S_NAMESPACE_NAME,
43
+ "ODIGOS_CONTAINER_NAME": K8S_CONTAINER_NAME,
44
+ "ODIGOS_POD_NAME": K8S_POD_NAME,
38
45
  }
39
46
 
40
47
 
@@ -306,7 +313,7 @@ class OpAMPHTTPClient:
306
313
  config = Config()
307
314
 
308
315
  # Extract container_config if present
309
- container_config = decoded_map.get("container_config", None)
316
+ container_config: Optional[dict] = cast(Optional[dict], decoded_map.get("container_config"))
310
317
  if container_config is not None:
311
318
  config.container_config = container_config
312
319
 
@@ -344,14 +351,14 @@ class OpAMPHTTPClient:
344
351
  # Add additional attributes from environment variables
345
352
 
346
353
  if os.getenv("DISABLE_OPAMP_CLIENT", "false").strip().lower() == "true":
347
- process_id_key = ResourceAttributes.PROCESS_PID
354
+ process_id_key = PROCESS_PID
348
355
  else:
349
356
  process_id_key = PROCESS_VPID
350
357
 
351
358
  identifying_attributes = [
352
- anyvalue_pb2.KeyValue(key=ResourceAttributes.SERVICE_INSTANCE_ID, value=anyvalue_pb2.AnyValue(string_value=self.instance_uid)),
359
+ anyvalue_pb2.KeyValue(key=SERVICE_INSTANCE_ID, value=anyvalue_pb2.AnyValue(string_value=self.instance_uid)),
353
360
  anyvalue_pb2.KeyValue(key=process_id_key, value=anyvalue_pb2.AnyValue(int_value=self.pid)),
354
- anyvalue_pb2.KeyValue(key=ResourceAttributes.TELEMETRY_SDK_LANGUAGE, value=anyvalue_pb2.AnyValue(string_value="python")),
361
+ anyvalue_pb2.KeyValue(key=TELEMETRY_SDK_LANGUAGE, value=anyvalue_pb2.AnyValue(string_value="python")),
355
362
  ]
356
363
 
357
364
  # Add additional attributes from environment variables
@@ -1,17 +1,19 @@
1
1
  import os
2
-
2
+ from typing import Optional
3
3
  from opamp.http_client import OpAMPHTTPClient
4
4
 
5
5
 
6
6
  _client = None
7
7
  _client_pid = None
8
8
 
9
+
9
10
  def set_client(client) -> None:
10
11
  global _client, _client_pid
11
12
  _client = client
12
13
  _client_pid = os.getpid()
13
14
 
14
- def get_client() -> OpAMPHTTPClient:
15
+
16
+ def get_client() -> Optional[OpAMPHTTPClient]:
15
17
  if _client_pid != os.getpid():
16
18
  return None # Defensive: ensure we don't return a client from a different process
17
19
  return _client
@@ -1,5 +1,7 @@
1
+ from typing import Union
1
2
  import json
2
3
 
4
+
3
5
  def get_container_config(config_map):
4
6
  """
5
7
  Extracts and parses the container configuration from the config map.
@@ -13,7 +15,7 @@ def get_container_config(config_map):
13
15
  return {}
14
16
 
15
17
 
16
- def parse_first_message_signals(container_config): # type: ignore
18
+ def parse_first_message_signals(container_config) -> dict[str, Union[str, bool]]:
17
19
  """
18
20
  Parses the trace, logs, and metrics signals from the container config.
19
21
  Signal is considered enabled if its key exists in the config.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "odigos-opentelemetry-python"
7
- version = "1.0.86"
7
+ version = "1.0.88"
8
8
  description = "Odigos Initializer for Python OpenTelemetry Components"
9
9
  requires-python = ">=3.9"
10
10
  authors = [
@@ -42,7 +42,7 @@ dependencies = [
42
42
  "opentelemetry-instrumentation-cassandra == 0.61b0",
43
43
  "opentelemetry-instrumentation-celery == 0.61b0",
44
44
  "opentelemetry-instrumentation-click == 0.61b0",
45
- "opentelemetry-instrumentation-confluent-kafka == 0.61b0",
45
+ "odigos-opentelemetry-instrumentation-confluent-kafka == 0.61b0",
46
46
  "opentelemetry-instrumentation-dbapi == 0.61b0",
47
47
  "opentelemetry-instrumentation-django == 0.61b0",
48
48
  "odigos-opentelemetry-instrumentation-elasticsearch == 0.61b0",
@@ -108,6 +108,7 @@ odigos = "initializer.distro.distro:OdigosDistro"
108
108
  [tool.uv.sources]
109
109
  odigos-opentelemetry-instrumentation-aiohttp-server = { workspace = true }
110
110
  odigos-opentelemetry-instrumentation-elasticsearch = { workspace = true }
111
+ odigos-opentelemetry-instrumentation-confluent-kafka = { workspace = true }
111
112
  odigos-opentelemetry-instrumentation-openai-v2 = { workspace = true }
112
113
  odigos-opentelemetry-instrumentation-sqlalchemy = { workspace = true }
113
114
 
@@ -139,6 +140,8 @@ extend-exclude = [
139
140
  "build",
140
141
  "*.egg-info",
141
142
  "tests/integration/configurator",
143
+ "instrumentations/",
144
+ "*_pb2.py",
142
145
  ]
143
146
 
144
147
  [tool.ruff.lint]
@@ -161,4 +164,7 @@ exclude = [
161
164
  "dist",
162
165
  "build",
163
166
  "tests/integration/configurator",
167
+ "tests/integration/apps",
168
+ "instrumentations/",
169
+ "opamp/opamp_pb2.py"
164
170
  ]
@@ -1 +0,0 @@
1
- VERSION = "1.0.86"
@@ -1,65 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # Generated by the protocol buffer compiler. DO NOT EDIT!
3
- # source: anyvalue.proto
4
- """Generated protocol buffer code."""
5
- from google.protobuf import descriptor as _descriptor
6
- from google.protobuf import descriptor_pool as _descriptor_pool
7
- from google.protobuf import message as _message
8
- from google.protobuf import reflection as _reflection
9
- from google.protobuf import symbol_database as _symbol_database
10
- # @@protoc_insertion_point(imports)
11
-
12
- _sym_db = _symbol_database.Default()
13
-
14
-
15
-
16
-
17
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0e\x61nyvalue.proto\x12\x0bopamp.proto\"\xe8\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.\n\x0b\x61rray_value\x18\x05 \x01(\x0b\x32\x17.opamp.proto.ArrayValueH\x00\x12\x31\n\x0ckvlist_value\x18\x06 \x01(\x0b\x32\x19.opamp.proto.KeyValueListH\x00\x12\x15\n\x0b\x62ytes_value\x18\x07 \x01(\x0cH\x00\x42\x07\n\x05value\"3\n\nArrayValue\x12%\n\x06values\x18\x01 \x03(\x0b\x32\x15.opamp.proto.AnyValue\"5\n\x0cKeyValueList\x12%\n\x06values\x18\x01 \x03(\x0b\x32\x15.opamp.proto.KeyValue\"=\n\x08KeyValue\x12\x0b\n\x03key\x18\x01 \x01(\t\x12$\n\x05value\x18\x02 \x01(\x0b\x32\x15.opamp.proto.AnyValueB.Z,github.com/open-telemetry/opamp-go/protobufsb\x06proto3')
18
-
19
-
20
-
21
- _ANYVALUE = DESCRIPTOR.message_types_by_name['AnyValue']
22
- _ARRAYVALUE = DESCRIPTOR.message_types_by_name['ArrayValue']
23
- _KEYVALUELIST = DESCRIPTOR.message_types_by_name['KeyValueList']
24
- _KEYVALUE = DESCRIPTOR.message_types_by_name['KeyValue']
25
- AnyValue = _reflection.GeneratedProtocolMessageType('AnyValue', (_message.Message,), {
26
- 'DESCRIPTOR' : _ANYVALUE,
27
- '__module__' : 'anyvalue_pb2'
28
- # @@protoc_insertion_point(class_scope:opamp.proto.AnyValue)
29
- })
30
- _sym_db.RegisterMessage(AnyValue)
31
-
32
- ArrayValue = _reflection.GeneratedProtocolMessageType('ArrayValue', (_message.Message,), {
33
- 'DESCRIPTOR' : _ARRAYVALUE,
34
- '__module__' : 'anyvalue_pb2'
35
- # @@protoc_insertion_point(class_scope:opamp.proto.ArrayValue)
36
- })
37
- _sym_db.RegisterMessage(ArrayValue)
38
-
39
- KeyValueList = _reflection.GeneratedProtocolMessageType('KeyValueList', (_message.Message,), {
40
- 'DESCRIPTOR' : _KEYVALUELIST,
41
- '__module__' : 'anyvalue_pb2'
42
- # @@protoc_insertion_point(class_scope:opamp.proto.KeyValueList)
43
- })
44
- _sym_db.RegisterMessage(KeyValueList)
45
-
46
- KeyValue = _reflection.GeneratedProtocolMessageType('KeyValue', (_message.Message,), {
47
- 'DESCRIPTOR' : _KEYVALUE,
48
- '__module__' : 'anyvalue_pb2'
49
- # @@protoc_insertion_point(class_scope:opamp.proto.KeyValue)
50
- })
51
- _sym_db.RegisterMessage(KeyValue)
52
-
53
- if _descriptor._USE_C_DESCRIPTORS == False:
54
-
55
- DESCRIPTOR._options = None
56
- DESCRIPTOR._serialized_options = b'Z,github.com/open-telemetry/opamp-go/protobufs'
57
- _ANYVALUE._serialized_start=32
58
- _ANYVALUE._serialized_end=264
59
- _ARRAYVALUE._serialized_start=266
60
- _ARRAYVALUE._serialized_end=317
61
- _KEYVALUELIST._serialized_start=319
62
- _KEYVALUELIST._serialized_end=372
63
- _KEYVALUE._serialized_start=374
64
- _KEYVALUE._serialized_end=435
65
- # @@protoc_insertion_point(module_scope)