Fatal error: Class 'Point' not found
hi i had a problem using "point" example code.
// create an array of points
$points = array(
new Point(
'test_metric', // name of the measurement
0.64, // the measurement value
['host' => 'server01', 'region' => 'us-west'], // optional tags
['cpucount' => 10], // optional additional fields
1435255849 // Time precision has to be set to seconds!
),
new Point(
'test_metric', // name of the measurement
0.84, // the measurement value
['host' => 'server01', 'region' => 'us-west'], // optional tags
['cpucount' => 10], // optional additional fields
1435255849 // Time precision has to be set to seconds!
)
);
// we are writing unix timestamps, which have a second precision
$result = $database->writePoints($points, Database::PRECISION_SECONDS);
using this code in php, i got a "Fatal error: Class 'Point' not found". so I wasted a few hours, and found a solution.
"new Point" -> "new InfluxDB\Point"
Plz modify the example code. thanku.
What exactly did you do with ""new Point" -> "new InfluxDB\Point" to fix the issue?
Sorry for the noob question
What exactly did you do with ""new Point" -> "new InfluxDB\Point" to fix the issue?
Sorry for the noob question
Don't know if you're still looking for an answer but it may help others in the future also. But this....
new Point(
'test_metric', // name of the measurement
0.84, // the measurement value
['host' => 'server01', 'region' => 'us-west'], // optional tags
['cpucount' => 10], // optional additional fields
1435255849 // Time precision has to be set to seconds!
)
Becomes this...
new InfluxDB\Point(
'test_metric', // name of the measurement
0.84, // the measurement value
['host' => 'server01', 'region' => 'us-west'], // optional tags
['cpucount' => 10], // optional additional fields
1435255849 // Time precision has to be set to seconds!
)
Any time you get that class error, stick InfluxDB\ before the class with the error, and it should fix it!