Skip to content

Commit b293371

Browse files
committed
Updated the endpoint to 8.15.0 adding the OTel support
1 parent 66171e2 commit b293371

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2273
-724
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"license": "MIT",
1212
"require": {
1313
"php": "^7.4 || ^8.0",
14-
"elastic/transport": "^8.8",
14+
"elastic/transport": "^8.10",
1515
"psr/http-client": "^1.0",
1616
"psr/http-message": "^1.1 || ^2.0",
1717
"psr/log": "^1|^2|^3",

src/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
final class Client implements ClientInterface
2929
{
3030
const CLIENT_NAME = 'es';
31-
const VERSION = '8.14.0';
31+
const VERSION = '8.15.0';
3232
const API_COMPATIBILITY_HEADER = '%s/vnd.elasticsearch+%s; compatible-with=8';
3333

3434
use ClientEndpointsTrait;

src/Endpoints/AsyncSearch.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ public function delete(array $params = [])
5959
$headers = [
6060
'Accept' => 'application/json',
6161
];
62-
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
62+
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
63+
$request = $this->addOtelAttributes($params, ['id'], $request, 'async_search.delete');
64+
return $this->client->sendRequest($request);
6365
}
6466

6567

@@ -97,7 +99,9 @@ public function get(array $params = [])
9799
$headers = [
98100
'Accept' => 'application/json',
99101
];
100-
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
102+
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
103+
$request = $this->addOtelAttributes($params, ['id'], $request, 'async_search.get');
104+
return $this->client->sendRequest($request);
101105
}
102106

103107

@@ -133,7 +137,9 @@ public function status(array $params = [])
133137
$headers = [
134138
'Accept' => 'application/json',
135139
];
136-
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
140+
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
141+
$request = $this->addOtelAttributes($params, ['id'], $request, 'async_search.status');
142+
return $this->client->sendRequest($request);
137143
}
138144

139145

@@ -213,6 +219,8 @@ public function submit(array $params = [])
213219
'Accept' => 'application/json',
214220
'Content-Type' => 'application/json',
215221
];
216-
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
222+
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
223+
$request = $this->addOtelAttributes($params, ['index'], $request, 'async_search.submit');
224+
return $this->client->sendRequest($request);
217225
}
218226
}

src/Endpoints/Autoscaling.php

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class Autoscaling extends AbstractEndpoint
3535
*
3636
* @param array{
3737
* name: string, // (REQUIRED) the name of the autoscaling policy
38+
* master_timeout: time, // Timeout for processing on master node
39+
* timeout: time, // Timeout for acknowledgement of update from all nodes in cluster
3840
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
3941
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
4042
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
@@ -55,11 +57,13 @@ public function deleteAutoscalingPolicy(array $params = [])
5557
$url = '/_autoscaling/policy/' . $this->encode($params['name']);
5658
$method = 'DELETE';
5759

58-
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
60+
$url = $this->addQueryString($url, $params, ['master_timeout','timeout','pretty','human','error_trace','source','filter_path']);
5961
$headers = [
6062
'Accept' => 'application/json',
6163
];
62-
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
64+
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
65+
$request = $this->addOtelAttributes($params, ['name'], $request, 'autoscaling.delete_autoscaling_policy');
66+
return $this->client->sendRequest($request);
6367
}
6468

6569

@@ -69,6 +73,7 @@ public function deleteAutoscalingPolicy(array $params = [])
6973
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-get-autoscaling-capacity.html
7074
*
7175
* @param array{
76+
* master_timeout: time, // Timeout for processing on master node
7277
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
7378
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
7479
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
@@ -87,11 +92,13 @@ public function getAutoscalingCapacity(array $params = [])
8792
$url = '/_autoscaling/capacity';
8893
$method = 'GET';
8994

90-
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
95+
$url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']);
9196
$headers = [
9297
'Accept' => 'application/json',
9398
];
94-
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
99+
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
100+
$request = $this->addOtelAttributes($params, [], $request, 'autoscaling.get_autoscaling_capacity');
101+
return $this->client->sendRequest($request);
95102
}
96103

97104

@@ -102,6 +109,7 @@ public function getAutoscalingCapacity(array $params = [])
102109
*
103110
* @param array{
104111
* name: string, // (REQUIRED) the name of the autoscaling policy
112+
* master_timeout: time, // Timeout for processing on master node
105113
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
106114
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
107115
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
@@ -122,11 +130,13 @@ public function getAutoscalingPolicy(array $params = [])
122130
$url = '/_autoscaling/policy/' . $this->encode($params['name']);
123131
$method = 'GET';
124132

125-
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
133+
$url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']);
126134
$headers = [
127135
'Accept' => 'application/json',
128136
];
129-
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
137+
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
138+
$request = $this->addOtelAttributes($params, ['name'], $request, 'autoscaling.get_autoscaling_policy');
139+
return $this->client->sendRequest($request);
130140
}
131141

132142

@@ -137,6 +147,8 @@ public function getAutoscalingPolicy(array $params = [])
137147
*
138148
* @param array{
139149
* name: string, // (REQUIRED) the name of the autoscaling policy
150+
* master_timeout: time, // Timeout for processing on master node
151+
* timeout: time, // Timeout for acknowledgement of update from all nodes in cluster
140152
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
141153
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
142154
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
@@ -158,11 +170,13 @@ public function putAutoscalingPolicy(array $params = [])
158170
$url = '/_autoscaling/policy/' . $this->encode($params['name']);
159171
$method = 'PUT';
160172

161-
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
173+
$url = $this->addQueryString($url, $params, ['master_timeout','timeout','pretty','human','error_trace','source','filter_path']);
162174
$headers = [
163175
'Accept' => 'application/json',
164176
'Content-Type' => 'application/json',
165177
];
166-
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
178+
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
179+
$request = $this->addOtelAttributes($params, ['name'], $request, 'autoscaling.put_autoscaling_policy');
180+
return $this->client->sendRequest($request);
167181
}
168182
}

0 commit comments

Comments
 (0)