Skip to content

Commit e2e3b27

Browse files
committed
Change method naming
1 parent 3bdc028 commit e2e3b27

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This package does not cover Telnet API, and that's why:
2020
- HTTP API use cases: production applications, complex data queries, integrations with other systems, and secure communications.
2121

2222
OpenTSDB HTTP API supported by:
23-
- [VictoriaMetrics](https://docs.victoriametrics.com/#sending-opentsdb-data-via-http-apiput-requests) but because of [limitation](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/959) `sendDataPointListSilently` should be used to send metrics.
23+
- [VictoriaMetrics](https://docs.victoriametrics.com/#sending-opentsdb-data-via-http-apiput-requests) but because of [limitation](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/959) `sendDataPointListWithDebug` method is not supported.
2424

2525
## What is OpenTSDB
2626

src/OpenTsdbClient.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,6 @@ public function __construct(
3232
*/
3333
public function sendDataPointList(
3434
array $dataPointList,
35-
): SendDataPointListResponse {
36-
$result = $this->sendRequest(
37-
$this->buildUrl('/api/put?details&summary'),
38-
json_encode($dataPointList),
39-
);
40-
41-
$statusCode = $result->getStatusCode();
42-
$decodedResult = json_decode($result->getBody()->getContents(), true);
43-
44-
return new SendDataPointListResponse(
45-
$statusCode,
46-
$decodedResult['success'],
47-
$decodedResult['failed'],
48-
$decodedResult['errors'],
49-
);
50-
}
51-
52-
/**
53-
* @param list<DataPoint> $dataPointList
54-
*/
55-
public function sendDataPointListSilently(
56-
array $dataPointList,
5735
): void {
5836
$result = $this->sendRequest(
5937
$this->buildUrl('/api/put'),
@@ -128,6 +106,28 @@ public function sendDataPointListSilently(
128106
}
129107
}
130108

109+
/**
110+
* @param list<DataPoint> $dataPointList
111+
*/
112+
public function sendDataPointListWithDebug(
113+
array $dataPointList,
114+
): SendDataPointListResponse {
115+
$result = $this->sendRequest(
116+
$this->buildUrl('/api/put?details&summary'),
117+
json_encode($dataPointList),
118+
);
119+
120+
$statusCode = $result->getStatusCode();
121+
$decodedResult = json_decode($result->getBody()->getContents(), true);
122+
123+
return new SendDataPointListResponse(
124+
$statusCode,
125+
$decodedResult['success'],
126+
$decodedResult['failed'],
127+
$decodedResult['errors'],
128+
);
129+
}
130+
131131
private function sendRequest(
132132
string $url,
133133
string $body,

test/Integration/OpenTsdbClientTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function testSuccess(): void
4141

4242
$openTsdbClient = $this->initOpenTsdbClient();
4343

44-
$response = $openTsdbClient->sendDataPointList($dataPointList);
44+
$response = $openTsdbClient->sendDataPointListWithDebug($dataPointList);
4545
$this->assertSame(200, $response->httpStatusCode());
4646
$this->assertSame(2, $response->success());
4747
$this->assertSame(0, $response->failed());

0 commit comments

Comments
 (0)