You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ads/telemetry/telemetry.py
+36-10Lines changed: 36 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,26 @@
1
1
#!/usr/bin/env python
2
-
# -*- coding: utf-8; -*-
2
+
# -*- coding: utf-8 -*--
3
3
4
-
# Copyright (c) 2022 Oracle and/or its affiliates.
4
+
# Copyright (c) 2022, 2023 Oracle and/or its affiliates.
5
5
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
-
fromadsimport__version__
6
+
7
+
importos
7
8
fromenumimportEnum, auto
9
+
fromtypingimportAny, Dict, Optional
8
10
9
11
importads.config
12
+
fromadsimport__version__
13
+
fromads.commonimportlogger
10
14
15
+
LIBRARY="Oracle-ads"
11
16
EXTRA_USER_AGENT_INFO="EXTRA_USER_AGENT_INFO"
12
17
USER_AGENT_KEY="additional_user_agent"
13
-
ENV_MD_OCID="MD_OCID"
14
18
UNKNOWN="UNKNOWN"
15
19
16
20
17
21
classSurface(Enum):
18
22
"""
19
-
An Enum class for labeling the surface where ADS is being used
23
+
An Enum class for labeling the surface where ADS is being used.
20
24
"""
21
25
22
26
WORKSTATION=auto()
@@ -25,6 +29,7 @@ class Surface(Enum):
25
29
DATASCIENCE_MODEL_DEPLOYMENT=auto()
26
30
DATAFLOW=auto()
27
31
OCI_SERVICE=auto()
32
+
DATASCIENCE_PIPELINE=auto()
28
33
29
34
@classmethod
30
35
defsurface(cls):
@@ -43,12 +48,33 @@ def surface(cls):
43
48
surface=cls.DATASCIENCE_MODEL_DEPLOYMENT
44
49
elifads.config.DATAFLOW_RUN_OCID:
45
50
surface=cls.DATAFLOW
51
+
elifads.config.PIPELINE_RUN_OCID:
52
+
surface=cls.DATASCIENCE_PIPELINE
46
53
returnsurface
47
54
48
55
49
-
defupdate_oci_client_config(config={}):
50
-
ifnotconfig.get(USER_AGENT_KEY):
51
-
config[
52
-
USER_AGENT_KEY
53
-
] =f"Oracle-ads/version={__version__}/surface={Surface.surface().name}"# To be enabled in future - /api={os.environ.get(EXTRA_USER_AGENT_INFO,UNKNOWN)}"
0 commit comments