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
{{ message }}
This repository was archived by the owner on Jun 15, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: doc_source/guide_sdk-metrics-configure.rst
+100-9Lines changed: 100 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -58,9 +58,83 @@ By default, |SDKM| is turned off, host is set to '127.0.0.1' and the port is set
58
58
59
59
Enabling |SDKM| is independent of configuring your credentials to use an AWS service.
60
60
61
-
You can enable |SDKM| by setting environment variables or by using the AWS Shared config file.
61
+
You can enable |SDKM| by passing in a client configuration option, setting environment variables, or by using the AWS Shared config file.
62
62
63
-
Option 1: Set Environment Variables
63
+
**Order of Precedence**
64
+
65
+
The order of precedence is as follows (1 overrides 2-3, etc.):
66
+
67
+
1. Client configuration option
68
+
2. Environment variables
69
+
3. AWS Shared config file
70
+
71
+
Option 1: Client Configuration Option
72
+
-------------------------------------
73
+
74
+
You can pass in a :code:`csm` option to your client constructor to enable and set the configuration options.
75
+
This option can be an associative array, an instance of :code:`\Aws\ClientSideMonitoring\ConfigurationInterface`,
76
+
a callable that provides an instance of :code:`\Aws\ClientSideMonitoring\ConfigurationInterface`,
77
+
or the boolean value of :code:`false`.
78
+
79
+
**Associative array:**
80
+
81
+
.. code-block:: php
82
+
83
+
$client = new \Aws\S3\S3Client([
84
+
'region' => 'your-region',
85
+
'version' => 'latest',
86
+
'csm' => [
87
+
'enabled' => true,
88
+
'host' => 'my.host',
89
+
'port' => 1234,
90
+
'client_id' => 'My Application'
91
+
]
92
+
]);
93
+
94
+
**Instance of \\Aws\\ClientSideMonitoring\\ConfigurationInterface:**
95
+
96
+
.. code-block:: php
97
+
98
+
$client = new \Aws\S3\S3Client([
99
+
'region' => 'your-region',
100
+
'version' => 'latest',
101
+
'csm' => new \Aws\ClientSideMonitoring\Configuration(
102
+
true,
103
+
'my.host',
104
+
1234,
105
+
'My Application'
106
+
)
107
+
]);
108
+
109
+
**Callable:**
110
+
111
+
.. code-block:: php
112
+
113
+
$client = new \Aws\S3\S3Client([
114
+
'region' => 'your-region',
115
+
'version' => 'latest',
116
+
'csm' => function() {
117
+
return new \Aws\ClientSideMonitoring\Configuration(
118
+
true,
119
+
'127.0.0.1',
120
+
1234,
121
+
'My Application'
122
+
);
123
+
}
124
+
]);
125
+
126
+
**Boolean `false`:**
127
+
128
+
.. code-block:: php
129
+
130
+
$client = new \Aws\S3\S3Client([
131
+
'region' => 'your-region',
132
+
'version' => 'latest',
133
+
'csm' => false
134
+
]);
135
+
136
+
137
+
Option 2: Set Environment Variables
64
138
-----------------------------------
65
139
66
140
The SDK first checks the profile specified in the environment variable under :code:`AWS_PROFILE` to determine if |SDKM| is enabled.
@@ -78,7 +152,7 @@ To turn on |SDKM|, add the following to your environmental variables.
78
152
Enabling |SDKM| does not configure your credentials to use an AWS service.
79
153
To do that, see :doc:`Credentials for the AWS SDK for PHP Version 3<guide_credentials>`.
80
154
81
-
Option 2: AWS Shared Config File
155
+
Option 3: AWS Shared Config File
82
156
--------------------------------
83
157
84
158
If no CSM configuration is found in the environment variables, the SDK looks for your default AWS profile field. If :code:`AWS_DEFAULT_PROFILE` is set to something other than default, update that profile. To enable SDK Metrics, add :code:`csm_enabled` to the shared config file located at :file:`~/.aws/config`.
@@ -105,7 +179,14 @@ Update a |CW| Agent
105
179
106
180
To make changes to the host or port ID, you need to set the values and then restart any AWS jobs that are currently active.
107
181
108
-
Option 1: Set Environment Variables
182
+
Option 1: Client Configuration Option
183
+
-------------------------------------
184
+
185
+
See Option 1 above under "Enable |SDKM| for the |sdk-php|" for examples of how to set the
186
+
client configuration :code:`csm` option to modify CSM settings.
187
+
188
+
189
+
Option 2: Set Environment Variables
109
190
-----------------------------------
110
191
111
192
Most AWS services use the default port. But if the service you want |SDKM| to monitor uses a unique port, add `AWS_CSM_PORT=[port_number]`, to the host's environment variables.
@@ -118,7 +199,7 @@ Additionally, a different host can be specified using the `AWS_CSM_HOST` environ
118
199
export AWS_CSM_HOST=192.168.0.1
119
200
120
201
121
-
Option 2: AWS Shared Config File
202
+
Option 3: AWS Shared Config File
122
203
--------------------------------
123
204
124
205
Most services use the default port. But if your service requires a
@@ -159,16 +240,26 @@ Then restart your |CW| agent so that the changes can take effect.
159
240
Set csm_enabled to false
160
241
------------------------
161
242
162
-
**Option 1: Environment Variables**
243
+
.. note:: Note the order of precedence listed above. For example, if |SDKM| is enabled in the environment variables but disabled in the config file, the |SDKM| remains enabled.
244
+
245
+
**Option 1: Client configuration**
246
+
247
+
.. code-block:: php
248
+
249
+
$client = new \Aws\S3\S3Client([
250
+
'region' => 'your-region',
251
+
'version' => 'latest',
252
+
'csm' => false
253
+
]);
254
+
255
+
**Option 2: Environment Variables**
163
256
164
257
.. code-block:: ini
165
258
166
259
export AWS_CSM_ENABLED=false
167
260
168
261
169
-
**Option 2: AWS Shared Config File**
170
-
171
-
.. note:: Environment variables override the AWS Shared config file. If |SDKM| is enabled in the environment variables, the |SDKM| remains enabled.
0 commit comments