File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
localstack-core/localstack/utils/analytics Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ from localstack .runtime import hooks
2
+
3
+
4
+ @hooks .on_runtime_ready ()
5
+ def publish_provider_assignment ():
6
+ """
7
+ Publishes the service provider assignment to the analytics service.
8
+ """
9
+ from datetime import datetime
10
+
11
+ from localstack .config import SERVICE_PROVIDER_CONFIG
12
+ from localstack .utils .analytics import get_session_id
13
+ from localstack .utils .analytics .events import Event , EventMetadata
14
+ from localstack .utils .analytics .publisher import AnalyticsClientPublisher
15
+
16
+ provider_assignment = {
17
+ service : f"localstack.aws.provider/{ service } :{ provider } "
18
+ for service , provider in SERVICE_PROVIDER_CONFIG .items ()
19
+ if provider
20
+ }
21
+ metadata = EventMetadata (
22
+ session_id = get_session_id (),
23
+ client_time = str (datetime .now ()),
24
+ )
25
+
26
+ event = Event (
27
+ name = "ls_service_provider_assignment" , metadata = metadata , payload = provider_assignment
28
+ )
29
+
30
+ AnalyticsClientPublisher ().publish ([event ])
You can’t perform that action at this time.
0 commit comments