Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Fatal error: Class 'Point' not found #110

Open
hSnow26 opened this issue Aug 8, 2018 · 2 comments
Open

Fatal error: Class 'Point' not found #110

hSnow26 opened this issue Aug 8, 2018 · 2 comments

Comments

@hSnow26
Copy link

hSnow26 commented Aug 8, 2018

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.

@Corruptsector
Copy link

What exactly did you do with ""new Point" -> "new InfluxDB\Point" to fix the issue?

Sorry for the noob question

@ghost
Copy link

ghost commented Jan 23, 2020

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!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants