chalk-remote-call-python 1.10.5__tar.gz → 1.10.7__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 (73) hide show
  1. {chalk_remote_call_python-1.10.5/chalk_remote_call_python.egg-info → chalk_remote_call_python-1.10.7}/PKG-INFO +2 -2
  2. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk-remote-call-rs/chalk-remote-call-server/src/metrics.rs +10 -1
  3. chalk_remote_call_python-1.10.7/chalk_remote_call/_version.py +1 -0
  4. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/tracing.py +61 -65
  5. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7/chalk_remote_call_python.egg-info}/PKG-INFO +2 -2
  6. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call_python.egg-info/requires.txt +1 -1
  7. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/pyproject.toml +2 -1
  8. chalk_remote_call_python-1.10.5/chalk_remote_call/_version.py +0 -1
  9. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/MANIFEST.in +0 -0
  10. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/README.md +0 -0
  11. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk-remote-call-rs/Cargo.lock +0 -0
  12. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk-remote-call-rs/Cargo.toml +0 -0
  13. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk-remote-call-rs/chalk-remote-call-proto/Cargo.toml +0 -0
  14. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.auth.v1.rs +0 -0
  15. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.common.v1.rs +0 -0
  16. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.runtime.v1.rs +0 -0
  17. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.runtime.v1.tonic.rs +0 -0
  18. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.utils.v1.rs +0 -0
  19. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/descriptor.bin +0 -0
  20. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk-remote-call-rs/chalk-remote-call-proto/src/lib.rs +0 -0
  21. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk-remote-call-rs/chalk-remote-call-server/Cargo.toml +0 -0
  22. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk-remote-call-rs/chalk-remote-call-server/src/async_service.rs +0 -0
  23. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk-remote-call-rs/chalk-remote-call-server/src/coalesce.rs +0 -0
  24. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk-remote-call-rs/chalk-remote-call-server/src/fnq_client.rs +0 -0
  25. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk-remote-call-rs/chalk-remote-call-server/src/lib.rs +0 -0
  26. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk-remote-call-rs/chalk-remote-call-server/src/python_bridge.rs +0 -0
  27. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk-remote-call-rs/chalk-remote-call-server/src/self_consumer.rs +0 -0
  28. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk-remote-call-rs/chalk-remote-call-server/src/server.rs +0 -0
  29. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk-remote-call-rs/chalk-remote-call-server/src/service.rs +0 -0
  30. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk-remote-call-rs/rust-toolchain.toml +0 -0
  31. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/__init__.py +0 -0
  32. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/__main__.py +0 -0
  33. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/__init__.py +0 -0
  34. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/__init__.py +0 -0
  35. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/auth/__init__.py +0 -0
  36. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/auth/v1/__init__.py +0 -0
  37. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/auth/v1/permissions_pb2.py +0 -0
  38. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/auth/v1/permissions_pb2_grpc.py +0 -0
  39. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/common/__init__.py +0 -0
  40. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/common/v1/__init__.py +0 -0
  41. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/common/v1/chalk_error_pb2.py +0 -0
  42. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/common/v1/chalk_error_pb2_grpc.py +0 -0
  43. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/runtime/__init__.py +0 -0
  44. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/runtime/v1/__init__.py +0 -0
  45. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/runtime/v1/fnq_consumer_pb2.py +0 -0
  46. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/runtime/v1/fnq_consumer_pb2_grpc.py +0 -0
  47. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/runtime/v1/remote_python_call_pb2.py +0 -0
  48. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/runtime/v1/remote_python_call_pb2_grpc.py +0 -0
  49. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/utils/__init__.py +0 -0
  50. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/utils/v1/__init__.py +0 -0
  51. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/utils/v1/encoding_pb2.py +0 -0
  52. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/utils/v1/encoding_pb2_grpc.py +0 -0
  53. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/utils/v1/field_change_pb2.py +0 -0
  54. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/utils/v1/field_change_pb2_grpc.py +0 -0
  55. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/utils/v1/large_pb2.py +0 -0
  56. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/utils/v1/large_pb2_grpc.py +0 -0
  57. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/utils/v1/sensitive_pb2.py +0 -0
  58. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_gen/chalk/utils/v1/sensitive_pb2_grpc.py +0 -0
  59. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/_native.pyi +0 -0
  60. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/arrow_utils.py +0 -0
  61. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/cli.py +0 -0
  62. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/errors.py +0 -0
  63. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/handler_loader.py +0 -0
  64. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/input_transform.py +0 -0
  65. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/logging.py +0 -0
  66. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/server.py +0 -0
  67. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call/servicer.py +0 -0
  68. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call_python.egg-info/SOURCES.txt +0 -0
  69. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call_python.egg-info/dependency_links.txt +0 -0
  70. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call_python.egg-info/entry_points.txt +0 -0
  71. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/chalk_remote_call_python.egg-info/top_level.txt +0 -0
  72. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/setup.cfg +0 -0
  73. {chalk_remote_call_python-1.10.5 → chalk_remote_call_python-1.10.7}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chalk-remote-call-python
3
- Version: 1.10.5
3
+ Version: 1.10.7
4
4
  Summary: Chalk remote call Python runtime interface client
5
5
  Author: Chalk AI, Inc.
6
6
  Project-URL: Homepage, https://chalk.ai
@@ -35,7 +35,7 @@ Requires-Dist: grpcio-tools>=1.60.0; extra == "dev"
35
35
  Provides-Extra: tracing
36
36
  Requires-Dist: opentelemetry-api>=1.20.0; extra == "tracing"
37
37
  Requires-Dist: opentelemetry-sdk>=1.20.0; extra == "tracing"
38
- Requires-Dist: opentelemetry-exporter-otlp-proto-grpc>=1.20.0; extra == "tracing"
38
+ Requires-Dist: opentelemetry-exporter-otlp-proto-grpc>=1.35.0; extra == "tracing"
39
39
 
40
40
  # chalk-remote-call-python
41
41
 
@@ -185,11 +185,19 @@ fn metric_function_name(function_name: &str) -> String {
185
185
  non_empty_env("CHALK_FNQ_FUNCTION_NAME").unwrap_or_else(|| function_name.to_string())
186
186
  }
187
187
 
188
- fn call_tags(function_name: &str, success: bool, mode: Mode) -> [String; 3] {
188
+ fn resource_kind() -> &'static str {
189
+ match non_empty_env("CHALK_FNQ_RESOURCE_KIND").as_deref() {
190
+ Some("model") => "model",
191
+ _ => "function",
192
+ }
193
+ }
194
+
195
+ fn call_tags(function_name: &str, success: bool, mode: Mode) -> [String; 4] {
189
196
  [
190
197
  format!("function_name:{function_name}"),
191
198
  format!("status:{}", if success { "success" } else { "failure" }),
192
199
  format!("mode:{}", mode.as_str()),
200
+ format!("kind:{}", resource_kind()),
193
201
  ]
194
202
  }
195
203
 
@@ -329,6 +337,7 @@ mod tests {
329
337
  assert!(seen.contains("function_name:fn_a"), "{seen}");
330
338
  assert!(seen.contains("status:success"), "{seen}");
331
339
  assert!(seen.contains("mode:sync"), "{seen}");
340
+ assert!(seen.contains("kind:function"), "{seen}");
332
341
  }
333
342
 
334
343
  fn call_metrics(pipeline: &Arc<PublishingMetricsPipeline>) -> Arc<CallMetrics> {
@@ -0,0 +1 @@
1
+ __version__ = "1.10.7"
@@ -7,6 +7,7 @@ import logging
7
7
  import os
8
8
  import threading
9
9
  from collections.abc import Callable, Iterator, Mapping, Sequence
10
+ from dataclasses import dataclass, replace
10
11
  from typing import Any, cast
11
12
 
12
13
  _TRACER_NAME = "chalk_remote_call"
@@ -39,6 +40,37 @@ _SPAN_FLUSH_TIMEOUT_MILLIS = 5000
39
40
  _logger = logging.getLogger(__name__)
40
41
 
41
42
 
43
+ @dataclass(frozen=True)
44
+ class _TracingConfig:
45
+ policy: str | None
46
+ sample_rate: float | None
47
+ otlp_endpoint: str
48
+ service_name: str
49
+ environment_id: str | None
50
+
51
+
52
+ def _load_tracing_config() -> _TracingConfig:
53
+ """Read and normalize the tracing environment once for an invocation."""
54
+ raw_policy = os.environ.get(_REMOTE_FUNCTION_TRACE_POLICY_ENV_VAR, "")
55
+ policy = raw_policy.strip().lower()
56
+ raw_rate = os.environ.get(_REMOTE_FUNCTION_TRACE_SAMPLE_RATE_ENV_VAR)
57
+ sample_rate = None
58
+ if raw_rate is not None:
59
+ with contextlib.suppress(ValueError):
60
+ sample_rate = float(raw_rate)
61
+ if sample_rate is not None and (sample_rate < 0.0 or sample_rate > 1.0):
62
+ sample_rate = None
63
+
64
+ return _TracingConfig(
65
+ policy=policy if policy in _TRACE_POLICIES else None,
66
+ sample_rate=sample_rate,
67
+ otlp_endpoint=os.environ.get("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT")
68
+ or os.environ.get("OTEL_EXPORTER_OTLP_ENDPOINT", ""),
69
+ service_name=os.environ.get("CHALK_SERVICE") or _TRACER_NAME,
70
+ environment_id=os.environ.get("CHALK_ENVIRONMENT_ID") or None,
71
+ )
72
+
73
+
42
74
  class _BackgroundSpanFlusher:
43
75
  """Runs a tracer provider's ``force_flush`` on one daemon thread, off the request path.
44
76
 
@@ -139,46 +171,14 @@ def _collect_trace_metadata(
139
171
  return first, None
140
172
 
141
173
 
142
- def _trace_policy() -> str | None:
143
- raw_policy = os.environ.get(_REMOTE_FUNCTION_TRACE_POLICY_ENV_VAR)
144
- if raw_policy is None:
145
- return None
146
-
147
- policy = raw_policy.strip().lower()
148
- if policy in _TRACE_POLICIES:
149
- return policy
150
- return None
151
-
152
-
153
- def _trace_sample_rate(force_trace: bool) -> float | None:
154
- if force_trace:
155
- return 1.0
156
- raw_rate = os.environ.get(_REMOTE_FUNCTION_TRACE_SAMPLE_RATE_ENV_VAR)
157
- if raw_rate is None:
158
- return None
159
-
160
- try:
161
- rate = float(raw_rate)
162
- except ValueError:
163
- return None
164
-
165
- if rate < 0.0 or rate > 1.0:
166
- return None
167
- return rate
168
-
169
-
170
- def _otel_exporter_configured() -> bool:
171
- return bool(os.environ.get("OTEL_EXPORTER_OTLP_ENDPOINT") or os.environ.get("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT"))
172
-
173
-
174
- def _runtime_resource_attributes() -> dict[str, str]:
175
- attributes = {"service.name": os.environ.get("CHALK_SERVICE") or _TRACER_NAME}
176
- if environment_id := os.environ.get("CHALK_ENVIRONMENT_ID"):
177
- attributes["chalk.environment_id"] = environment_id
174
+ def _runtime_resource_attributes(config: _TracingConfig) -> dict[str, str]:
175
+ attributes = {"service.name": config.service_name}
176
+ if config.environment_id:
177
+ attributes["chalk.environment_id"] = config.environment_id
178
178
  return attributes
179
179
 
180
180
 
181
- def _configure_runtime_tracing(sample_rate: float) -> None:
181
+ def _configure_runtime_tracing(config: _TracingConfig, sample_rate: float) -> None:
182
182
  global _runtime_tracing_configured, _runtime_tracer_provider, _runtime_span_flusher
183
183
  if _runtime_tracing_configured:
184
184
  return
@@ -194,15 +194,22 @@ def _configure_runtime_tracing(sample_rate: float) -> None:
194
194
 
195
195
  try:
196
196
  provider = sdk_trace.TracerProvider(
197
- resource=resources.Resource.create(_runtime_resource_attributes()),
197
+ resource=resources.Resource.create(_runtime_resource_attributes(config)),
198
198
  sampler=sdk_sampling.ParentBased(sdk_sampling.TraceIdRatioBased(sample_rate)),
199
199
  )
200
200
 
201
- if _otel_exporter_configured():
201
+ if config.otlp_endpoint:
202
202
  try:
203
203
  otlp_exporter = importlib.import_module("opentelemetry.exporter.otlp.proto.grpc.trace_exporter")
204
204
  sdk_export = importlib.import_module("opentelemetry.sdk.trace.export")
205
- provider.add_span_processor(sdk_export.BatchSpanProcessor(otlp_exporter.OTLPSpanExporter()))
205
+ # gRPC otherwise derives an invalid HTTP/2 authority from the Unix socket path.
206
+ channel_options = (
207
+ (("grpc.default_authority", "localhost"),) if config.otlp_endpoint.startswith("unix:") else None
208
+ )
209
+ exporter = otlp_exporter.OTLPSpanExporter(
210
+ endpoint=config.otlp_endpoint, channel_options=channel_options
211
+ )
212
+ provider.add_span_processor(sdk_export.BatchSpanProcessor(exporter))
206
213
  _runtime_span_flusher = _BackgroundSpanFlusher(provider.force_flush, _SPAN_FLUSH_TIMEOUT_MILLIS)
207
214
  except Exception:
208
215
  pass
@@ -215,19 +222,10 @@ def _configure_runtime_tracing(sample_rate: float) -> None:
215
222
  _runtime_tracing_configured = True
216
223
 
217
224
 
218
- def _sample_rate_for_inherited_parent(policy: str, force_trace: bool) -> float | None:
219
- if policy == _TRACE_POLICY_PARENT_BASED_ALWAYS_OFF:
220
- return 0.0
221
- if policy == _TRACE_POLICY_PARENT_BASED_TRACE_ID_RATIO:
222
- return _trace_sample_rate(force_trace)
223
- return None
224
-
225
-
226
225
  def _span_metadata(
227
226
  first_metadata: Mapping[str, Any] | None,
228
227
  traceparent_metadata: Mapping[str, Any] | None,
229
- policy: str,
230
- force_trace: bool,
228
+ config: _TracingConfig,
231
229
  ) -> tuple[Mapping[str, Any] | None, Any | None, Any]:
232
230
  if traceparent_metadata is not None:
233
231
  carrier = _trace_carrier(traceparent_metadata)
@@ -244,20 +242,20 @@ def _span_metadata(
244
242
  if not parent_span_context.is_valid:
245
243
  return None, None, None
246
244
 
247
- sample_rate = _sample_rate_for_inherited_parent(policy, force_trace)
245
+ sample_rate = 0.0 if config.policy == _TRACE_POLICY_PARENT_BASED_ALWAYS_OFF else config.sample_rate
248
246
  if sample_rate is None:
249
247
  return None, None, None
250
- _configure_runtime_tracing(sample_rate)
248
+ _configure_runtime_tracing(config, sample_rate)
251
249
  return traceparent_metadata, parent_context, otel_modules
252
250
 
253
- if policy != _TRACE_POLICY_PARENT_BASED_TRACE_ID_RATIO:
251
+ if config.policy != _TRACE_POLICY_PARENT_BASED_TRACE_ID_RATIO:
254
252
  return None, None, None
255
253
 
256
- sample_rate = _trace_sample_rate(force_trace)
254
+ sample_rate = config.sample_rate
257
255
  if sample_rate is None:
258
256
  return None, None, None
259
257
 
260
- _configure_runtime_tracing(sample_rate)
258
+ _configure_runtime_tracing(config, sample_rate)
261
259
  otel_modules = _get_otel_modules()
262
260
  if otel_modules is None:
263
261
  return None, None, None
@@ -366,26 +364,25 @@ def remote_function_invocation_span(
366
364
  context_metadata: Any,
367
365
  coalesced_count: int | None = None,
368
366
  ) -> Iterator[None]:
367
+ config = _load_tracing_config()
369
368
  first_metadata, traceparent_metadata = _collect_trace_metadata(context_metadata)
370
369
  override = str((first_metadata or {}).get(_REMOTE_FUNCTION_TRACE_OVERRIDE_KEY) or "").strip().lower()
371
370
  if override == _TRACE_OVERRIDE_ON:
372
- policy = _TRACE_POLICY_PARENT_BASED_TRACE_ID_RATIO
371
+ config = replace(config, policy=_TRACE_POLICY_PARENT_BASED_TRACE_ID_RATIO, sample_rate=1.0)
373
372
  elif override == _TRACE_OVERRIDE_OFF:
374
- policy = _TRACE_POLICY_ALWAYS_OFF
375
- else:
376
- policy = _trace_policy()
377
- if policy is None:
373
+ config = replace(config, policy=_TRACE_POLICY_ALWAYS_OFF)
374
+ if config.policy is None:
378
375
  yield
379
376
  return
380
377
 
381
378
  force_trace = override == _TRACE_OVERRIDE_ON
382
379
  if force_trace and traceparent_metadata is not None:
383
380
  traceparent_metadata = _force_sampled_traceparent(traceparent_metadata)
384
- if policy == _TRACE_POLICY_PARENT_BASED_ALWAYS_OFF and traceparent_metadata is None:
381
+ if config.policy == _TRACE_POLICY_PARENT_BASED_ALWAYS_OFF and traceparent_metadata is None:
385
382
  yield
386
383
  return
387
384
 
388
- if policy == _TRACE_POLICY_ALWAYS_OFF:
385
+ if config.policy == _TRACE_POLICY_ALWAYS_OFF:
389
386
  _metadata, parent_context, otel_modules, tracer = _always_off_span_metadata(
390
387
  first_metadata,
391
388
  traceparent_metadata,
@@ -394,8 +391,7 @@ def remote_function_invocation_span(
394
391
  _metadata, parent_context, otel_modules = _span_metadata(
395
392
  first_metadata,
396
393
  traceparent_metadata,
397
- policy,
398
- force_trace,
394
+ config,
399
395
  )
400
396
  tracer = _get_tracer(otel_modules[2]) if otel_modules is not None else None
401
397
 
@@ -416,7 +412,7 @@ def remote_function_invocation_span(
416
412
  span_kwargs["context"] = parent_context
417
413
 
418
414
  # The always-off tracer exports nothing, so only runtime-provider spans need a flush.
419
- flush_after = policy != _TRACE_POLICY_ALWAYS_OFF
415
+ flush_after = config.policy != _TRACE_POLICY_ALWAYS_OFF
420
416
  try:
421
417
  with tracer.start_as_current_span("chalkcompute.remote_function.invoke", **span_kwargs) as span:
422
418
  span.set_attribute("chalk.remote_function.name", function_name)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chalk-remote-call-python
3
- Version: 1.10.5
3
+ Version: 1.10.7
4
4
  Summary: Chalk remote call Python runtime interface client
5
5
  Author: Chalk AI, Inc.
6
6
  Project-URL: Homepage, https://chalk.ai
@@ -35,7 +35,7 @@ Requires-Dist: grpcio-tools>=1.60.0; extra == "dev"
35
35
  Provides-Extra: tracing
36
36
  Requires-Dist: opentelemetry-api>=1.20.0; extra == "tracing"
37
37
  Requires-Dist: opentelemetry-sdk>=1.20.0; extra == "tracing"
38
- Requires-Dist: opentelemetry-exporter-otlp-proto-grpc>=1.20.0; extra == "tracing"
38
+ Requires-Dist: opentelemetry-exporter-otlp-proto-grpc>=1.35.0; extra == "tracing"
39
39
 
40
40
  # chalk-remote-call-python
41
41
 
@@ -13,4 +13,4 @@ grpcio-tools>=1.60.0
13
13
  [tracing]
14
14
  opentelemetry-api>=1.20.0
15
15
  opentelemetry-sdk>=1.20.0
16
- opentelemetry-exporter-otlp-proto-grpc>=1.20.0
16
+ opentelemetry-exporter-otlp-proto-grpc>=1.35.0
@@ -48,7 +48,8 @@ dev = [
48
48
  tracing = [
49
49
  "opentelemetry-api>=1.20.0",
50
50
  "opentelemetry-sdk>=1.20.0",
51
- "opentelemetry-exporter-otlp-proto-grpc>=1.20.0",
51
+ # Unix-socket exports need channel_options, added in 1.35.0.
52
+ "opentelemetry-exporter-otlp-proto-grpc>=1.35.0",
52
53
  ]
53
54
 
54
55
  [project.urls]
@@ -1 +0,0 @@
1
- __version__ = "1.10.5"