flagsmith-common 3.9.0__tar.gz → 3.10.0__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 (112) hide show
  1. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/PKG-INFO +10 -8
  2. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/pyproject.toml +8 -6
  3. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/core/otel.py +4 -3
  4. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/test_tools/plugin.py +9 -2
  5. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/LICENSE +0 -0
  6. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/README.md +0 -0
  7. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/__init__.py +0 -0
  8. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/core/__init__.py +0 -0
  9. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/core/app.py +0 -0
  10. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/core/cli/__init__.py +0 -0
  11. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/core/cli/healthcheck.py +0 -0
  12. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/core/constants.py +0 -0
  13. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/core/docgen/__init__.py +0 -0
  14. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/core/docgen/events.py +0 -0
  15. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/core/logging.py +0 -0
  16. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/core/main.py +0 -0
  17. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/core/management/__init__.py +0 -0
  18. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/core/management/commands/__init__.py +0 -0
  19. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/core/management/commands/docgen.py +0 -0
  20. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/core/management/commands/start.py +0 -0
  21. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/core/management/commands/waitfordb.py +0 -0
  22. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/core/metrics.py +0 -0
  23. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/core/middleware.py +0 -0
  24. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/core/sentry.py +0 -0
  25. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/core/templates/docgen-events.md +0 -0
  26. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/core/templates/docgen-metrics.md +0 -0
  27. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/core/urls.py +0 -0
  28. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/core/utils.py +0 -0
  29. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/core/views.py +0 -0
  30. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/environments/permissions.py +0 -0
  31. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/features/__init__.py +0 -0
  32. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/features/multivariate/__init__.py +0 -0
  33. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/features/multivariate/serializers.py +0 -0
  34. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/features/serializers.py +0 -0
  35. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/features/versioning/__init__.py +0 -0
  36. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/features/versioning/serializers.py +0 -0
  37. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/gunicorn/__init__.py +0 -0
  38. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/gunicorn/conf.py +0 -0
  39. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/gunicorn/constants.py +0 -0
  40. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/gunicorn/logging.py +0 -0
  41. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/gunicorn/metrics.py +0 -0
  42. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/gunicorn/metrics_server.py +0 -0
  43. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/gunicorn/middleware.py +0 -0
  44. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/gunicorn/processors.py +0 -0
  45. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/gunicorn/utils.py +0 -0
  46. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/lint_tests.py +0 -0
  47. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/migrations/__init__.py +0 -0
  48. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/migrations/helpers/__init__.py +0 -0
  49. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/migrations/helpers/postgres_helpers.py +0 -0
  50. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/organisations/permissions.py +0 -0
  51. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/projects/permissions.py +0 -0
  52. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/prometheus/__init__.py +0 -0
  53. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/prometheus/utils.py +0 -0
  54. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/py.typed +0 -0
  55. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/test_tools/__init__.py +0 -0
  56. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/test_tools/types.py +0 -0
  57. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/test_tools/utils.py +0 -0
  58. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/common/types.py +0 -0
  59. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/flagsmith_schemas/__init__.py +0 -0
  60. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/flagsmith_schemas/api.py +0 -0
  61. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/flagsmith_schemas/constants.py +0 -0
  62. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/flagsmith_schemas/dynamodb.py +0 -0
  63. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/flagsmith_schemas/py.typed +0 -0
  64. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/flagsmith_schemas/pydantic_types.py +0 -0
  65. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/flagsmith_schemas/types.py +0 -0
  66. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/flagsmith_schemas/utils.py +0 -0
  67. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/flagsmith_schemas/validators.py +0 -0
  68. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/__init__.py +0 -0
  69. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/admin.py +0 -0
  70. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/apps.py +0 -0
  71. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/decorators.py +0 -0
  72. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/exceptions.py +0 -0
  73. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/health.py +0 -0
  74. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/managers.py +0 -0
  75. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/metrics.py +0 -0
  76. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/migrations/0001_initial.py +0 -0
  77. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/migrations/0002_healthcheckmodel.py +0 -0
  78. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/migrations/0003_add_completed_to_task.py +0 -0
  79. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/migrations/0004_recreate_task_indexes.py +0 -0
  80. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/migrations/0005_update_conditional_index_conditions.py +0 -0
  81. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/migrations/0006_auto_20230221_0802.py +0 -0
  82. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/migrations/0007_add_is_locked.py +0 -0
  83. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/migrations/0008_add_get_task_to_process_function.py +0 -0
  84. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/migrations/0009_add_recurring_task_run_first_run_at.py +0 -0
  85. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/migrations/0010_task_priority.py +0 -0
  86. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/migrations/0011_add_priority_to_get_tasks_to_process.py +0 -0
  87. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/migrations/0012_add_locked_at_and_timeout.py +0 -0
  88. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/migrations/0013_add_last_picked_at.py +0 -0
  89. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/migrations/0014_add_trace_context.py +0 -0
  90. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/migrations/0015_add_is_disabled.py +0 -0
  91. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/migrations/__init__.py +0 -0
  92. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/migrations/sql/0008_get_recurring_tasks_to_process.sql +0 -0
  93. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/migrations/sql/0008_get_tasks_to_process.sql +0 -0
  94. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/migrations/sql/0011_get_tasks_to_process.sql +0 -0
  95. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/migrations/sql/0012_get_recurringtasks_to_process.sql +0 -0
  96. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/migrations/sql/0013_get_recurringtasks_to_process.sql +0 -0
  97. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/migrations/sql/0015_get_recurringtasks_to_process.sql +0 -0
  98. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/migrations/sql/__init__.py +0 -0
  99. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/models.py +0 -0
  100. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/monitoring.py +0 -0
  101. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/processor.py +0 -0
  102. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/py.typed +0 -0
  103. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/routers.py +0 -0
  104. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/serializers.py +0 -0
  105. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/task_registry.py +0 -0
  106. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/task_run_method.py +0 -0
  107. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/tasks.py +0 -0
  108. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/threads.py +0 -0
  109. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/types.py +0 -0
  110. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/urls.py +0 -0
  111. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/utils.py +0 -0
  112. {flagsmith_common-3.9.0 → flagsmith_common-3.10.0}/src/task_processor/views.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flagsmith-common
3
- Version: 3.9.0
3
+ Version: 3.10.0
4
4
  Summary: Flagsmith's common library
5
5
  Author: Matthew Elwell, Gagan Trivedi, Kim Gustyr, Zach Aysan, Francesco Lo Franco, Rodrigo López Dato, Evandro Myller, Wadii Zaim
6
6
  License-Expression: BSD-3-Clause
@@ -9,6 +9,7 @@ Classifier: Framework :: Django
9
9
  Classifier: Framework :: Pytest
10
10
  Classifier: Intended Audience :: Developers
11
11
  Classifier: License :: OSI Approved :: BSD License
12
+ Requires-Dist: flagsmith-common[otel] ; extra == 'common-core'
12
13
  Requires-Dist: django>4,<6 ; extra == 'common-core'
13
14
  Requires-Dist: django-health-check ; extra == 'common-core'
14
15
  Requires-Dist: djangorestframework-recursive ; extra == 'common-core'
@@ -17,10 +18,6 @@ Requires-Dist: drf-spectacular>=0.28.0,<1 ; extra == 'common-core'
17
18
  Requires-Dist: drf-writable-nested ; extra == 'common-core'
18
19
  Requires-Dist: environs<16 ; extra == 'common-core'
19
20
  Requires-Dist: gunicorn>=19.1 ; extra == 'common-core'
20
- Requires-Dist: inflection ; extra == 'common-core'
21
- Requires-Dist: opentelemetry-api>=1.25,<2 ; extra == 'common-core'
22
- Requires-Dist: opentelemetry-sdk>=1.25,<2 ; extra == 'common-core'
23
- Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.25,<2 ; extra == 'common-core'
24
21
  Requires-Dist: opentelemetry-instrumentation-django>=0.46b0,<1 ; extra == 'common-core'
25
22
  Requires-Dist: opentelemetry-instrumentation-psycopg2>=0.46b0,<1 ; extra == 'common-core'
26
23
  Requires-Dist: opentelemetry-instrumentation-redis>=0.46b0,<1 ; extra == 'common-core'
@@ -28,13 +25,17 @@ Requires-Dist: redis>=5,<6 ; extra == 'common-core'
28
25
  Requires-Dist: prometheus-client>=0.0.16 ; extra == 'common-core'
29
26
  Requires-Dist: psycopg2-binary>=2.9,<3 ; extra == 'common-core'
30
27
  Requires-Dist: requests ; extra == 'common-core'
31
- Requires-Dist: sentry-sdk>=2.0.0,<3.0.0 ; extra == 'common-core'
32
28
  Requires-Dist: simplejson>=3,<4 ; extra == 'common-core'
33
- Requires-Dist: structlog>=24.4,<26 ; extra == 'common-core'
34
- Requires-Dist: typing-extensions ; extra == 'common-core'
35
29
  Requires-Dist: simplejson ; extra == 'flagsmith-schemas'
36
30
  Requires-Dist: typing-extensions ; extra == 'flagsmith-schemas'
37
31
  Requires-Dist: flagsmith-flag-engine>6 ; extra == 'flagsmith-schemas'
32
+ Requires-Dist: inflection ; extra == 'otel'
33
+ Requires-Dist: opentelemetry-api>=1.25,<2 ; extra == 'otel'
34
+ Requires-Dist: opentelemetry-sdk>=1.25,<2 ; extra == 'otel'
35
+ Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.25,<2 ; extra == 'otel'
36
+ Requires-Dist: sentry-sdk>=2.0.0,<3.0.0 ; extra == 'otel'
37
+ Requires-Dist: structlog>=24.4,<26 ; extra == 'otel'
38
+ Requires-Dist: typing-extensions ; extra == 'otel'
38
39
  Requires-Dist: backoff>=2.2.1,<3.0.0 ; extra == 'task-processor'
39
40
  Requires-Dist: django>4,<6 ; extra == 'task-processor'
40
41
  Requires-Dist: django-health-check ; extra == 'task-processor'
@@ -52,6 +53,7 @@ Project-URL: Issues, https://github.com/flagsmith/flagsmith-common/issues
52
53
  Project-URL: Repository, https://github.com/flagsmith/flagsmith-common
53
54
  Provides-Extra: common-core
54
55
  Provides-Extra: flagsmith-schemas
56
+ Provides-Extra: otel
55
57
  Provides-Extra: task-processor
56
58
  Provides-Extra: test-tools
57
59
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "flagsmith-common"
3
- version = "3.9.0"
3
+ version = "3.10.0"
4
4
  description = "Flagsmith's common library"
5
5
  requires-python = ">=3.11,<4.0"
6
6
  dependencies = []
@@ -8,6 +8,7 @@ optional-dependencies = { test-tools = [
8
8
  "pyfakefs (>=5,<6)",
9
9
  "pytest-django (>=4,<5)",
10
10
  ], common-core = [
11
+ "flagsmith-common[otel]",
11
12
  "django (>4,<6)",
12
13
  "django-health-check",
13
14
  "djangorestframework-recursive",
@@ -16,10 +17,6 @@ optional-dependencies = { test-tools = [
16
17
  "drf-writable-nested",
17
18
  "environs (<16)",
18
19
  "gunicorn (>=19.1)",
19
- "inflection",
20
- "opentelemetry-api (>=1.25,<2)",
21
- "opentelemetry-sdk (>=1.25,<2)",
22
- "opentelemetry-exporter-otlp-proto-http (>=1.25,<2)",
23
20
  "opentelemetry-instrumentation-django (>=0.46b0,<1)",
24
21
  "opentelemetry-instrumentation-psycopg2 (>=0.46b0,<1)",
25
22
  "opentelemetry-instrumentation-redis (>=0.46b0,<1)",
@@ -27,8 +24,13 @@ optional-dependencies = { test-tools = [
27
24
  "prometheus-client (>=0.0.16)",
28
25
  "psycopg2-binary (>=2.9,<3)",
29
26
  "requests",
30
- "sentry-sdk (>=2.0.0,<3.0.0)",
31
27
  "simplejson (>=3,<4)",
28
+ ], otel = [
29
+ "inflection",
30
+ "opentelemetry-api (>=1.25,<2)",
31
+ "opentelemetry-sdk (>=1.25,<2)",
32
+ "opentelemetry-exporter-otlp-proto-http (>=1.25,<2)",
33
+ "sentry-sdk (>=2.0.0,<3.0.0)",
32
34
  "structlog (>=24.4,<26)",
33
35
  "typing_extensions",
34
36
  ], task-processor = [
@@ -17,9 +17,6 @@ from opentelemetry.exporter.otlp.proto.http._log_exporter import (
17
17
  from opentelemetry.exporter.otlp.proto.http.trace_exporter import (
18
18
  OTLPSpanExporter,
19
19
  )
20
- from opentelemetry.instrumentation.django import DjangoInstrumentor
21
- from opentelemetry.instrumentation.psycopg2 import Psycopg2Instrumentor
22
- from opentelemetry.instrumentation.redis import RedisInstrumentor
23
20
  from opentelemetry.propagate import set_global_textmap
24
21
  from opentelemetry.propagators.composite import CompositePropagator
25
22
  from opentelemetry.propagators.textmap import TextMapPropagator
@@ -195,6 +192,10 @@ def setup_tracing(
195
192
  (e.g. ``"health/liveness,health/readiness"``). If not provided,
196
193
  falls back to the ``OTEL_PYTHON_DJANGO_EXCLUDED_URLS`` env var.
197
194
  """
195
+ from opentelemetry.instrumentation.django import DjangoInstrumentor
196
+ from opentelemetry.instrumentation.psycopg2 import Psycopg2Instrumentor
197
+ from opentelemetry.instrumentation.redis import RedisInstrumentor
198
+
198
199
  trace.set_tracer_provider(tracer_provider)
199
200
 
200
201
  propagator: TextMapPropagator = CompositePropagator(
@@ -31,10 +31,17 @@ def assert_metric_impl() -> Generator[AssertMetricFixture, None, None]:
31
31
  registry = prometheus_client.REGISTRY
32
32
  collectors = [*registry._collector_to_names]
33
33
 
34
- # Reset registry state
34
+ # Reset registry state. `MetricWrapperBase.clear()` is implemented for
35
+ # parent metrics (those declared with labels) — calling it on an
36
+ # unlabeled metric raises AttributeError because `_lock` is only set on
37
+ # parents. Reset unlabeled metrics' observable state via `_metric_init`.
35
38
  for collector in collectors:
36
- if isinstance(collector, prometheus_client.metrics.MetricWrapperBase):
39
+ if not isinstance(collector, prometheus_client.metrics.MetricWrapperBase):
40
+ continue
41
+ if collector._is_parent(): # type: ignore[no-untyped-call]
37
42
  collector.clear()
43
+ else:
44
+ collector._metric_init() # type: ignore[no-untyped-call]
38
45
 
39
46
  def _assert_metric(
40
47
  *,