provide-foundation 0.0.0.dev0__py3-none-any.whl → 0.0.0.dev1__py3-none-any.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.
- provide/foundation/__init__.py +12 -20
- provide/foundation/archive/__init__.py +23 -0
- provide/foundation/archive/base.py +70 -0
- provide/foundation/archive/bzip2.py +157 -0
- provide/foundation/archive/gzip.py +159 -0
- provide/foundation/archive/operations.py +336 -0
- provide/foundation/archive/tar.py +164 -0
- provide/foundation/archive/zip.py +203 -0
- provide/foundation/config/base.py +2 -2
- provide/foundation/config/sync.py +19 -4
- provide/foundation/core.py +1 -2
- provide/foundation/crypto/__init__.py +2 -0
- provide/foundation/crypto/certificates/__init__.py +34 -0
- provide/foundation/crypto/certificates/base.py +173 -0
- provide/foundation/crypto/certificates/certificate.py +290 -0
- provide/foundation/crypto/certificates/factory.py +213 -0
- provide/foundation/crypto/certificates/generator.py +138 -0
- provide/foundation/crypto/certificates/loader.py +130 -0
- provide/foundation/crypto/certificates/operations.py +198 -0
- provide/foundation/crypto/certificates/trust.py +107 -0
- provide/foundation/eventsets/__init__.py +0 -0
- provide/foundation/eventsets/display.py +84 -0
- provide/foundation/eventsets/registry.py +160 -0
- provide/foundation/eventsets/resolver.py +192 -0
- provide/foundation/eventsets/sets/das.py +128 -0
- provide/foundation/eventsets/sets/database.py +125 -0
- provide/foundation/eventsets/sets/http.py +153 -0
- provide/foundation/eventsets/sets/llm.py +139 -0
- provide/foundation/eventsets/sets/task_queue.py +107 -0
- provide/foundation/eventsets/types.py +70 -0
- provide/foundation/hub/components.py +7 -133
- provide/foundation/logger/__init__.py +3 -10
- provide/foundation/logger/config/logging.py +6 -6
- provide/foundation/logger/core.py +0 -2
- provide/foundation/logger/custom_processors.py +1 -0
- provide/foundation/logger/factories.py +11 -2
- provide/foundation/logger/processors/main.py +20 -84
- provide/foundation/logger/setup/__init__.py +5 -1
- provide/foundation/logger/setup/coordinator.py +75 -23
- provide/foundation/logger/setup/processors.py +2 -9
- provide/foundation/logger/trace.py +27 -0
- provide/foundation/metrics/otel.py +10 -10
- provide/foundation/process/lifecycle.py +82 -26
- provide/foundation/testing/__init__.py +77 -0
- provide/foundation/testing/archive/__init__.py +24 -0
- provide/foundation/testing/archive/fixtures.py +217 -0
- provide/foundation/testing/common/__init__.py +34 -0
- provide/foundation/testing/common/fixtures.py +263 -0
- provide/foundation/testing/file/__init__.py +40 -0
- provide/foundation/testing/file/fixtures.py +523 -0
- provide/foundation/testing/logger.py +41 -11
- provide/foundation/testing/mocking/__init__.py +46 -0
- provide/foundation/testing/mocking/fixtures.py +331 -0
- provide/foundation/testing/process/__init__.py +48 -0
- provide/foundation/testing/process/fixtures.py +577 -0
- provide/foundation/testing/threading/__init__.py +38 -0
- provide/foundation/testing/threading/fixtures.py +520 -0
- provide/foundation/testing/time/__init__.py +32 -0
- provide/foundation/testing/time/fixtures.py +409 -0
- provide/foundation/testing/transport/__init__.py +30 -0
- provide/foundation/testing/transport/fixtures.py +280 -0
- provide/foundation/tools/__init__.py +58 -0
- provide/foundation/tools/base.py +348 -0
- provide/foundation/tools/cache.py +266 -0
- provide/foundation/tools/downloader.py +213 -0
- provide/foundation/tools/installer.py +254 -0
- provide/foundation/tools/registry.py +223 -0
- provide/foundation/tools/resolver.py +321 -0
- provide/foundation/tools/verifier.py +186 -0
- provide/foundation/tracer/otel.py +7 -11
- provide/foundation/transport/__init__.py +155 -0
- provide/foundation/transport/base.py +171 -0
- provide/foundation/transport/client.py +266 -0
- provide/foundation/transport/config.py +209 -0
- provide/foundation/transport/errors.py +79 -0
- provide/foundation/transport/http.py +232 -0
- provide/foundation/transport/middleware.py +366 -0
- provide/foundation/transport/registry.py +167 -0
- provide/foundation/transport/types.py +45 -0
- {provide_foundation-0.0.0.dev0.dist-info → provide_foundation-0.0.0.dev1.dist-info}/METADATA +5 -28
- {provide_foundation-0.0.0.dev0.dist-info → provide_foundation-0.0.0.dev1.dist-info}/RECORD +85 -34
- provide/foundation/cli/commands/logs/generate_old.py +0 -569
- provide/foundation/crypto/certificates.py +0 -896
- provide/foundation/logger/emoji/__init__.py +0 -44
- provide/foundation/logger/emoji/matrix.py +0 -209
- provide/foundation/logger/emoji/sets.py +0 -458
- provide/foundation/logger/emoji/types.py +0 -56
- provide/foundation/logger/setup/emoji_resolver.py +0 -64
- {provide_foundation-0.0.0.dev0.dist-info → provide_foundation-0.0.0.dev1.dist-info}/WHEEL +0 -0
- {provide_foundation-0.0.0.dev0.dist-info → provide_foundation-0.0.0.dev1.dist-info}/entry_points.txt +0 -0
- {provide_foundation-0.0.0.dev0.dist-info → provide_foundation-0.0.0.dev1.dist-info}/licenses/LICENSE +0 -0
- {provide_foundation-0.0.0.dev0.dist-info → provide_foundation-0.0.0.dev1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,125 @@
|
|
1
|
+
"""
|
2
|
+
Database operations event set for Foundation.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from provide.foundation.eventsets.types import EventSet, EventMapping, FieldMapping
|
6
|
+
|
7
|
+
EVENT_SET = EventSet(
|
8
|
+
name="database",
|
9
|
+
description="Database interaction and query enrichment",
|
10
|
+
mappings=[
|
11
|
+
EventMapping(
|
12
|
+
name="db_system",
|
13
|
+
visual_markers={
|
14
|
+
"postgres": "🐘",
|
15
|
+
"mysql": "🐬",
|
16
|
+
"sqlite": "💾",
|
17
|
+
"mongodb": "🍃",
|
18
|
+
"redis": "🟥",
|
19
|
+
"elasticsearch": "🔍",
|
20
|
+
"default": "🗄️",
|
21
|
+
},
|
22
|
+
metadata_fields={
|
23
|
+
"postgres": {"db.type": "sql", "db.vendor": "postgresql"},
|
24
|
+
"mysql": {"db.type": "sql", "db.vendor": "mysql"},
|
25
|
+
"sqlite": {"db.type": "sql", "db.vendor": "sqlite"},
|
26
|
+
"mongodb": {"db.type": "nosql", "db.vendor": "mongodb"},
|
27
|
+
"redis": {"db.type": "cache", "db.vendor": "redis"},
|
28
|
+
"elasticsearch": {"db.type": "search", "db.vendor": "elastic"},
|
29
|
+
},
|
30
|
+
default_key="default"
|
31
|
+
),
|
32
|
+
EventMapping(
|
33
|
+
name="db_operation",
|
34
|
+
visual_markers={
|
35
|
+
"query": "🔍",
|
36
|
+
"select": "🔍",
|
37
|
+
"insert": "➕",
|
38
|
+
"update": "🔄",
|
39
|
+
"delete": "🗑️",
|
40
|
+
"connect": "🔗",
|
41
|
+
"disconnect": "💔",
|
42
|
+
"transaction_begin": "💳🟢",
|
43
|
+
"transaction_commit": "💳✅",
|
44
|
+
"transaction_rollback": "💳❌",
|
45
|
+
"default": "⚙️",
|
46
|
+
},
|
47
|
+
metadata_fields={
|
48
|
+
"select": {"db.read": True},
|
49
|
+
"query": {"db.read": True},
|
50
|
+
"insert": {"db.write": True},
|
51
|
+
"update": {"db.write": True},
|
52
|
+
"delete": {"db.write": True},
|
53
|
+
},
|
54
|
+
default_key="default"
|
55
|
+
),
|
56
|
+
EventMapping(
|
57
|
+
name="db_outcome",
|
58
|
+
visual_markers={
|
59
|
+
"success": "👍",
|
60
|
+
"error": "🔥",
|
61
|
+
"not_found": "❓🤷",
|
62
|
+
"timeout": "⏱️",
|
63
|
+
"default": "➡️",
|
64
|
+
},
|
65
|
+
metadata_fields={
|
66
|
+
"success": {"db.success": True},
|
67
|
+
"error": {"db.error": True},
|
68
|
+
"timeout": {"db.timeout": True},
|
69
|
+
},
|
70
|
+
default_key="default"
|
71
|
+
),
|
72
|
+
],
|
73
|
+
field_mappings=[
|
74
|
+
FieldMapping(
|
75
|
+
log_key="db.system",
|
76
|
+
event_set_name="database",
|
77
|
+
description="Database system type",
|
78
|
+
value_type="string"
|
79
|
+
),
|
80
|
+
FieldMapping(
|
81
|
+
log_key="db.operation",
|
82
|
+
event_set_name="database",
|
83
|
+
description="Database operation performed",
|
84
|
+
value_type="string"
|
85
|
+
),
|
86
|
+
FieldMapping(
|
87
|
+
log_key="db.outcome",
|
88
|
+
event_set_name="database",
|
89
|
+
description="Operation outcome",
|
90
|
+
value_type="string"
|
91
|
+
),
|
92
|
+
FieldMapping(
|
93
|
+
log_key="db.statement",
|
94
|
+
event_set_name="database",
|
95
|
+
description="SQL or query statement",
|
96
|
+
value_type="string"
|
97
|
+
),
|
98
|
+
FieldMapping(
|
99
|
+
log_key="db.table",
|
100
|
+
event_set_name="database",
|
101
|
+
description="Table name",
|
102
|
+
value_type="string",
|
103
|
+
default_override_key="default"
|
104
|
+
),
|
105
|
+
FieldMapping(
|
106
|
+
log_key="db.rows_affected",
|
107
|
+
event_set_name="database",
|
108
|
+
description="Number of rows affected",
|
109
|
+
value_type="integer"
|
110
|
+
),
|
111
|
+
FieldMapping(
|
112
|
+
log_key="duration_ms",
|
113
|
+
event_set_name="database",
|
114
|
+
description="Query duration in milliseconds",
|
115
|
+
value_type="integer"
|
116
|
+
),
|
117
|
+
FieldMapping(
|
118
|
+
log_key="trace_id",
|
119
|
+
event_set_name="database",
|
120
|
+
description="Distributed trace ID",
|
121
|
+
value_type="string"
|
122
|
+
),
|
123
|
+
],
|
124
|
+
priority=90
|
125
|
+
)
|
@@ -0,0 +1,153 @@
|
|
1
|
+
"""
|
2
|
+
HTTP request/response event set for Foundation.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from provide.foundation.eventsets.types import EventMapping, EventSet, FieldMapping
|
6
|
+
|
7
|
+
EVENT_SET = EventSet(
|
8
|
+
name="http",
|
9
|
+
description="HTTP client and server interaction enrichment",
|
10
|
+
mappings=[
|
11
|
+
EventMapping(
|
12
|
+
name="http_method",
|
13
|
+
visual_markers={
|
14
|
+
"get": "📥",
|
15
|
+
"post": "📤",
|
16
|
+
"put": "📝⬆️",
|
17
|
+
"delete": "🗑️",
|
18
|
+
"patch": "🩹",
|
19
|
+
"head": "👤❔",
|
20
|
+
"options": "⚙️❔",
|
21
|
+
"default": "🌐",
|
22
|
+
},
|
23
|
+
default_key="default"
|
24
|
+
),
|
25
|
+
EventMapping(
|
26
|
+
name="http_status_class",
|
27
|
+
visual_markers={
|
28
|
+
"1xx": "ℹ️",
|
29
|
+
"2xx": "✅",
|
30
|
+
"3xx": "↪️",
|
31
|
+
"4xx": "⚠️CLIENT",
|
32
|
+
"5xx": "🔥SERVER",
|
33
|
+
"default": "❓",
|
34
|
+
},
|
35
|
+
metadata_fields={
|
36
|
+
"2xx": {"http.success": True},
|
37
|
+
"4xx": {"http.client_error": True},
|
38
|
+
"5xx": {"http.server_error": True},
|
39
|
+
},
|
40
|
+
default_key="default"
|
41
|
+
),
|
42
|
+
EventMapping(
|
43
|
+
name="http_target_type",
|
44
|
+
visual_markers={
|
45
|
+
"path": "🛣️",
|
46
|
+
"query": "❓",
|
47
|
+
"fragment": "#️⃣",
|
48
|
+
"default": "🎯",
|
49
|
+
},
|
50
|
+
default_key="default"
|
51
|
+
),
|
52
|
+
],
|
53
|
+
field_mappings=[
|
54
|
+
FieldMapping(
|
55
|
+
log_key="http.method",
|
56
|
+
event_set_name="http",
|
57
|
+
description="HTTP request method",
|
58
|
+
value_type="string"
|
59
|
+
),
|
60
|
+
FieldMapping(
|
61
|
+
log_key="http.status_class",
|
62
|
+
event_set_name="http",
|
63
|
+
description="HTTP status code class",
|
64
|
+
value_type="string"
|
65
|
+
),
|
66
|
+
FieldMapping(
|
67
|
+
log_key="http.target",
|
68
|
+
event_set_name="http",
|
69
|
+
description="Request target path and query",
|
70
|
+
value_type="string",
|
71
|
+
default_override_key="path"
|
72
|
+
),
|
73
|
+
FieldMapping(
|
74
|
+
log_key="http.url",
|
75
|
+
event_set_name="http",
|
76
|
+
description="Full HTTP URL",
|
77
|
+
value_type="string"
|
78
|
+
),
|
79
|
+
FieldMapping(
|
80
|
+
log_key="http.scheme",
|
81
|
+
event_set_name="http",
|
82
|
+
description="URL scheme",
|
83
|
+
value_type="string"
|
84
|
+
),
|
85
|
+
FieldMapping(
|
86
|
+
log_key="http.host",
|
87
|
+
event_set_name="http",
|
88
|
+
description="Request hostname",
|
89
|
+
value_type="string"
|
90
|
+
),
|
91
|
+
FieldMapping(
|
92
|
+
log_key="http.status_code",
|
93
|
+
event_set_name="http",
|
94
|
+
description="HTTP response status code",
|
95
|
+
value_type="integer"
|
96
|
+
),
|
97
|
+
FieldMapping(
|
98
|
+
log_key="http.request.body.size",
|
99
|
+
event_set_name="http",
|
100
|
+
description="Request body size in bytes",
|
101
|
+
value_type="integer"
|
102
|
+
),
|
103
|
+
FieldMapping(
|
104
|
+
log_key="http.response.body.size",
|
105
|
+
event_set_name="http",
|
106
|
+
description="Response body size in bytes",
|
107
|
+
value_type="integer"
|
108
|
+
),
|
109
|
+
FieldMapping(
|
110
|
+
log_key="client.address",
|
111
|
+
event_set_name="http",
|
112
|
+
description="Client IP address",
|
113
|
+
value_type="string"
|
114
|
+
),
|
115
|
+
FieldMapping(
|
116
|
+
log_key="server.address",
|
117
|
+
event_set_name="http",
|
118
|
+
description="Server address or hostname",
|
119
|
+
value_type="string"
|
120
|
+
),
|
121
|
+
FieldMapping(
|
122
|
+
log_key="duration_ms",
|
123
|
+
event_set_name="http",
|
124
|
+
description="Request duration in milliseconds",
|
125
|
+
value_type="integer"
|
126
|
+
),
|
127
|
+
FieldMapping(
|
128
|
+
log_key="trace_id",
|
129
|
+
event_set_name="http",
|
130
|
+
description="Distributed trace ID",
|
131
|
+
value_type="string"
|
132
|
+
),
|
133
|
+
FieldMapping(
|
134
|
+
log_key="span_id",
|
135
|
+
event_set_name="http",
|
136
|
+
description="Span ID",
|
137
|
+
value_type="string"
|
138
|
+
),
|
139
|
+
FieldMapping(
|
140
|
+
log_key="error.message",
|
141
|
+
event_set_name="http",
|
142
|
+
description="Error message if request failed",
|
143
|
+
value_type="string"
|
144
|
+
),
|
145
|
+
FieldMapping(
|
146
|
+
log_key="error.type",
|
147
|
+
event_set_name="http",
|
148
|
+
description="Error type if request failed",
|
149
|
+
value_type="string"
|
150
|
+
),
|
151
|
+
],
|
152
|
+
priority=80
|
153
|
+
)
|
@@ -0,0 +1,139 @@
|
|
1
|
+
"""
|
2
|
+
Large Language Model (LLM) interaction event set for Foundation.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from provide.foundation.eventsets.types import EventSet, EventMapping, FieldMapping
|
6
|
+
|
7
|
+
EVENT_SET = EventSet(
|
8
|
+
name="llm",
|
9
|
+
description="LLM provider and interaction enrichment",
|
10
|
+
mappings=[
|
11
|
+
EventMapping(
|
12
|
+
name="llm_provider",
|
13
|
+
visual_markers={
|
14
|
+
"openai": "🤖",
|
15
|
+
"anthropic": "📚",
|
16
|
+
"google": "🇬",
|
17
|
+
"meta": "🦙",
|
18
|
+
"mistral": "🌬️",
|
19
|
+
"perplexity": "❓",
|
20
|
+
"cohere": "🔊",
|
21
|
+
"default": "💡",
|
22
|
+
},
|
23
|
+
metadata_fields={
|
24
|
+
"openai": {"llm.vendor": "openai", "llm.api": "openai"},
|
25
|
+
"anthropic": {"llm.vendor": "anthropic", "llm.api": "claude"},
|
26
|
+
"google": {"llm.vendor": "google", "llm.api": "gemini"},
|
27
|
+
"meta": {"llm.vendor": "meta", "llm.api": "llama"},
|
28
|
+
"mistral": {"llm.vendor": "mistral", "llm.api": "mistral"},
|
29
|
+
},
|
30
|
+
default_key="default"
|
31
|
+
),
|
32
|
+
EventMapping(
|
33
|
+
name="llm_task",
|
34
|
+
visual_markers={
|
35
|
+
"generation": "✍️",
|
36
|
+
"completion": "✅",
|
37
|
+
"embedding": "🔗",
|
38
|
+
"chat": "💬",
|
39
|
+
"tool_use": "🛠️",
|
40
|
+
"summarization": "📜",
|
41
|
+
"translation": "🌐",
|
42
|
+
"classification": "🏷️",
|
43
|
+
"default": "⚡",
|
44
|
+
},
|
45
|
+
metadata_fields={
|
46
|
+
"generation": {"llm.type": "generative"},
|
47
|
+
"completion": {"llm.type": "completion"},
|
48
|
+
"embedding": {"llm.type": "embedding"},
|
49
|
+
"chat": {"llm.type": "conversational"},
|
50
|
+
"tool_use": {"llm.type": "function_calling"},
|
51
|
+
},
|
52
|
+
default_key="default"
|
53
|
+
),
|
54
|
+
EventMapping(
|
55
|
+
name="llm_outcome",
|
56
|
+
visual_markers={
|
57
|
+
"success": "👍",
|
58
|
+
"error": "🔥",
|
59
|
+
"filtered_input": "🛡️👁️",
|
60
|
+
"filtered_output": "🛡️🗣️",
|
61
|
+
"rate_limit": "⏳",
|
62
|
+
"partial_success": "🤏",
|
63
|
+
"tool_call": "📞",
|
64
|
+
"default": "➡️",
|
65
|
+
},
|
66
|
+
metadata_fields={
|
67
|
+
"success": {"llm.success": True},
|
68
|
+
"error": {"llm.error": True},
|
69
|
+
"rate_limit": {"llm.rate_limited": True},
|
70
|
+
"filtered_input": {"llm.filtered": True, "llm.filter_type": "input"},
|
71
|
+
"filtered_output": {"llm.filtered": True, "llm.filter_type": "output"},
|
72
|
+
},
|
73
|
+
default_key="default"
|
74
|
+
),
|
75
|
+
],
|
76
|
+
field_mappings=[
|
77
|
+
FieldMapping(
|
78
|
+
log_key="llm.provider",
|
79
|
+
event_set_name="llm",
|
80
|
+
description="LLM provider name",
|
81
|
+
value_type="string"
|
82
|
+
),
|
83
|
+
FieldMapping(
|
84
|
+
log_key="llm.task",
|
85
|
+
event_set_name="llm",
|
86
|
+
description="LLM task type",
|
87
|
+
value_type="string"
|
88
|
+
),
|
89
|
+
FieldMapping(
|
90
|
+
log_key="llm.model",
|
91
|
+
event_set_name="llm",
|
92
|
+
description="Model identifier",
|
93
|
+
value_type="string"
|
94
|
+
),
|
95
|
+
FieldMapping(
|
96
|
+
log_key="llm.outcome",
|
97
|
+
event_set_name="llm",
|
98
|
+
description="Operation outcome",
|
99
|
+
value_type="string"
|
100
|
+
),
|
101
|
+
FieldMapping(
|
102
|
+
log_key="llm.input.tokens",
|
103
|
+
event_set_name="llm",
|
104
|
+
description="Input token count",
|
105
|
+
value_type="integer"
|
106
|
+
),
|
107
|
+
FieldMapping(
|
108
|
+
log_key="llm.output.tokens",
|
109
|
+
event_set_name="llm",
|
110
|
+
description="Output token count",
|
111
|
+
value_type="integer"
|
112
|
+
),
|
113
|
+
FieldMapping(
|
114
|
+
log_key="llm.tool.name",
|
115
|
+
event_set_name="llm",
|
116
|
+
description="Tool/function name",
|
117
|
+
value_type="string"
|
118
|
+
),
|
119
|
+
FieldMapping(
|
120
|
+
log_key="llm.tool.call_id",
|
121
|
+
event_set_name="llm",
|
122
|
+
description="Tool call identifier",
|
123
|
+
value_type="string"
|
124
|
+
),
|
125
|
+
FieldMapping(
|
126
|
+
log_key="duration_ms",
|
127
|
+
event_set_name="llm",
|
128
|
+
description="LLM operation duration",
|
129
|
+
value_type="integer"
|
130
|
+
),
|
131
|
+
FieldMapping(
|
132
|
+
log_key="trace_id",
|
133
|
+
event_set_name="llm",
|
134
|
+
description="Distributed trace ID",
|
135
|
+
value_type="string"
|
136
|
+
),
|
137
|
+
],
|
138
|
+
priority=100 # High priority for LLM operations
|
139
|
+
)
|
@@ -0,0 +1,107 @@
|
|
1
|
+
"""
|
2
|
+
Task queue and async job processing event set for Foundation.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from provide.foundation.eventsets.types import EventSet, EventMapping, FieldMapping
|
6
|
+
|
7
|
+
EVENT_SET = EventSet(
|
8
|
+
name="task_queue",
|
9
|
+
description="Asynchronous task queue operation enrichment",
|
10
|
+
mappings=[
|
11
|
+
EventMapping(
|
12
|
+
name="task_system",
|
13
|
+
visual_markers={
|
14
|
+
"celery": "🥕",
|
15
|
+
"rq": "🟥🇶",
|
16
|
+
"dramatiq": "🎭",
|
17
|
+
"kafka": "🌊",
|
18
|
+
"rabbitmq": "🐇",
|
19
|
+
"default": "📨",
|
20
|
+
},
|
21
|
+
metadata_fields={
|
22
|
+
"celery": {"task.broker": "celery"},
|
23
|
+
"rq": {"task.broker": "redis"},
|
24
|
+
"dramatiq": {"task.broker": "dramatiq"},
|
25
|
+
"kafka": {"task.broker": "kafka", "task.streaming": True},
|
26
|
+
"rabbitmq": {"task.broker": "amqp"},
|
27
|
+
},
|
28
|
+
default_key="default"
|
29
|
+
),
|
30
|
+
EventMapping(
|
31
|
+
name="task_status",
|
32
|
+
visual_markers={
|
33
|
+
"submitted": "➡️📨",
|
34
|
+
"received": "📥",
|
35
|
+
"started": "▶️",
|
36
|
+
"progress": "🔄",
|
37
|
+
"retrying": "🔁",
|
38
|
+
"success": "✅🏁",
|
39
|
+
"failure": "❌🔥",
|
40
|
+
"revoked": "🚫",
|
41
|
+
"default": "❓",
|
42
|
+
},
|
43
|
+
metadata_fields={
|
44
|
+
"submitted": {"task.state": "pending"},
|
45
|
+
"received": {"task.state": "pending"},
|
46
|
+
"started": {"task.state": "active"},
|
47
|
+
"progress": {"task.state": "active"},
|
48
|
+
"retrying": {"task.state": "retry"},
|
49
|
+
"success": {"task.state": "completed", "task.success": True},
|
50
|
+
"failure": {"task.state": "failed", "task.success": False},
|
51
|
+
"revoked": {"task.state": "cancelled"},
|
52
|
+
},
|
53
|
+
default_key="default"
|
54
|
+
),
|
55
|
+
],
|
56
|
+
field_mappings=[
|
57
|
+
FieldMapping(
|
58
|
+
log_key="task.system",
|
59
|
+
event_set_name="task_queue",
|
60
|
+
description="Task queue system",
|
61
|
+
value_type="string"
|
62
|
+
),
|
63
|
+
FieldMapping(
|
64
|
+
log_key="task.status",
|
65
|
+
event_set_name="task_queue",
|
66
|
+
description="Task execution status",
|
67
|
+
value_type="string"
|
68
|
+
),
|
69
|
+
FieldMapping(
|
70
|
+
log_key="task.id",
|
71
|
+
event_set_name="task_queue",
|
72
|
+
description="Unique task identifier",
|
73
|
+
value_type="string"
|
74
|
+
),
|
75
|
+
FieldMapping(
|
76
|
+
log_key="task.name",
|
77
|
+
event_set_name="task_queue",
|
78
|
+
description="Task or job name",
|
79
|
+
value_type="string"
|
80
|
+
),
|
81
|
+
FieldMapping(
|
82
|
+
log_key="task.queue_name",
|
83
|
+
event_set_name="task_queue",
|
84
|
+
description="Queue name",
|
85
|
+
value_type="string"
|
86
|
+
),
|
87
|
+
FieldMapping(
|
88
|
+
log_key="task.retries",
|
89
|
+
event_set_name="task_queue",
|
90
|
+
description="Retry attempt count",
|
91
|
+
value_type="integer"
|
92
|
+
),
|
93
|
+
FieldMapping(
|
94
|
+
log_key="duration_ms",
|
95
|
+
event_set_name="task_queue",
|
96
|
+
description="Task execution duration",
|
97
|
+
value_type="integer"
|
98
|
+
),
|
99
|
+
FieldMapping(
|
100
|
+
log_key="trace_id",
|
101
|
+
event_set_name="task_queue",
|
102
|
+
description="Distributed trace ID",
|
103
|
+
value_type="string"
|
104
|
+
),
|
105
|
+
],
|
106
|
+
priority=70
|
107
|
+
)
|
@@ -0,0 +1,70 @@
|
|
1
|
+
"""
|
2
|
+
Event set type definitions for the Foundation event enrichment system.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from collections.abc import Callable
|
6
|
+
from typing import Any
|
7
|
+
|
8
|
+
from attrs import define, field
|
9
|
+
|
10
|
+
|
11
|
+
@define(frozen=True, slots=True)
|
12
|
+
class EventMapping:
|
13
|
+
"""
|
14
|
+
Individual event enrichment mapping for a specific domain.
|
15
|
+
|
16
|
+
Attributes:
|
17
|
+
name: Unique identifier for this mapping
|
18
|
+
visual_markers: Mapping of values to visual indicators (e.g., emojis)
|
19
|
+
metadata_fields: Additional metadata to attach based on values
|
20
|
+
transformations: Value transformation functions
|
21
|
+
default_key: Key to use when no specific match is found
|
22
|
+
"""
|
23
|
+
|
24
|
+
name: str
|
25
|
+
visual_markers: dict[str, str] = field(factory=lambda: {})
|
26
|
+
metadata_fields: dict[str, dict[str, Any]] = field(factory=lambda: {})
|
27
|
+
transformations: dict[str, Callable[[Any], Any]] = field(factory=lambda: {})
|
28
|
+
default_key: str = field(default="default")
|
29
|
+
|
30
|
+
|
31
|
+
@define(frozen=True, slots=True)
|
32
|
+
class FieldMapping:
|
33
|
+
"""
|
34
|
+
Maps a log field to an event set for enrichment.
|
35
|
+
|
36
|
+
Attributes:
|
37
|
+
log_key: The field key in log events (e.g., "http.method", "llm.provider")
|
38
|
+
description: Human-readable description of this field
|
39
|
+
value_type: Expected type of the field value
|
40
|
+
event_set_name: Name of the EventSet to use for enrichment
|
41
|
+
default_override_key: Override the default key for this specific field
|
42
|
+
default_value: Default value to use if field is not present
|
43
|
+
"""
|
44
|
+
|
45
|
+
log_key: str
|
46
|
+
description: str | None = field(default=None)
|
47
|
+
value_type: str | None = field(default=None)
|
48
|
+
event_set_name: str | None = field(default=None)
|
49
|
+
default_override_key: str | None = field(default=None)
|
50
|
+
default_value: Any | None = field(default=None)
|
51
|
+
|
52
|
+
|
53
|
+
@define(frozen=True, slots=True)
|
54
|
+
class EventSet:
|
55
|
+
"""
|
56
|
+
Complete event enrichment domain definition.
|
57
|
+
|
58
|
+
Attributes:
|
59
|
+
name: Unique identifier for this event set
|
60
|
+
description: Human-readable description
|
61
|
+
mappings: List of EventMapping definitions
|
62
|
+
field_mappings: List of field-to-mapping associations
|
63
|
+
priority: Higher priority sets override lower ones
|
64
|
+
"""
|
65
|
+
|
66
|
+
name: str
|
67
|
+
description: str | None = field(default=None)
|
68
|
+
mappings: list[EventMapping] = field(factory=lambda: [])
|
69
|
+
field_mappings: list[FieldMapping] = field(factory=lambda: [])
|
70
|
+
priority: int = field(default=0, converter=int)
|