Skip to content

Commit

Permalink
Updated the endpoint to 8.15.0 adding the OTel support
Browse files Browse the repository at this point in the history
  • Loading branch information
ezimuel committed Aug 14, 2024
1 parent 66171e2 commit b293371
Show file tree
Hide file tree
Showing 50 changed files with 2,273 additions and 724 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"license": "MIT",
"require": {
"php": "^7.4 || ^8.0",
"elastic/transport": "^8.8",
"elastic/transport": "^8.10",
"psr/http-client": "^1.0",
"psr/http-message": "^1.1 || ^2.0",
"psr/log": "^1|^2|^3",
Expand Down
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
final class Client implements ClientInterface
{
const CLIENT_NAME = 'es';
const VERSION = '8.14.0';
const VERSION = '8.15.0';
const API_COMPATIBILITY_HEADER = '%s/vnd.elasticsearch+%s; compatible-with=8';

use ClientEndpointsTrait;
Expand Down
16 changes: 12 additions & 4 deletions src/Endpoints/AsyncSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ public function delete(array $params = [])
$headers = [
'Accept' => 'application/json',
];
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
$request = $this->addOtelAttributes($params, ['id'], $request, 'async_search.delete');
return $this->client->sendRequest($request);
}


Expand Down Expand Up @@ -97,7 +99,9 @@ public function get(array $params = [])
$headers = [
'Accept' => 'application/json',
];
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
$request = $this->addOtelAttributes($params, ['id'], $request, 'async_search.get');
return $this->client->sendRequest($request);
}


Expand Down Expand Up @@ -133,7 +137,9 @@ public function status(array $params = [])
$headers = [
'Accept' => 'application/json',
];
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
$request = $this->addOtelAttributes($params, ['id'], $request, 'async_search.status');
return $this->client->sendRequest($request);
}


Expand Down Expand Up @@ -213,6 +219,8 @@ public function submit(array $params = [])
'Accept' => 'application/json',
'Content-Type' => 'application/json',
];
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
$request = $this->addOtelAttributes($params, ['index'], $request, 'async_search.submit');
return $this->client->sendRequest($request);
}
}
30 changes: 22 additions & 8 deletions src/Endpoints/Autoscaling.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class Autoscaling extends AbstractEndpoint
*
* @param array{
* name: string, // (REQUIRED) the name of the autoscaling policy
* master_timeout: time, // Timeout for processing on master node
* timeout: time, // Timeout for acknowledgement of update from all nodes in cluster
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
Expand All @@ -55,11 +57,13 @@ public function deleteAutoscalingPolicy(array $params = [])
$url = '/_autoscaling/policy/' . $this->encode($params['name']);
$method = 'DELETE';

$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['master_timeout','timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
$request = $this->addOtelAttributes($params, ['name'], $request, 'autoscaling.delete_autoscaling_policy');
return $this->client->sendRequest($request);
}


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

$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
$request = $this->addOtelAttributes($params, [], $request, 'autoscaling.get_autoscaling_capacity');
return $this->client->sendRequest($request);
}


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

$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
$request = $this->addOtelAttributes($params, ['name'], $request, 'autoscaling.get_autoscaling_policy');
return $this->client->sendRequest($request);
}


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

$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['master_timeout','timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
];
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
$request = $this->addOtelAttributes($params, ['name'], $request, 'autoscaling.put_autoscaling_policy');
return $this->client->sendRequest($request);
}
}
Loading

0 comments on commit b293371

Please sign in to comment.