Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writing problem #14

Closed
alifirat opened this issue Mar 9, 2016 · 2 comments
Closed

Writing problem #14

alifirat opened this issue Mar 9, 2016 · 2 comments

Comments

@alifirat
Copy link

alifirat commented Mar 9, 2016

Hi,

I'm using your library to communicate with influx. I met a problem when I'm writing data : all the data is not inserted like excepted. Here's the scenario : I have two list of Points, each have the same size of 742400. I'm doing this in a sequential way : I insert the points from the first list then the points from the second. For the first list, no problem all the points are inserted but for the second, only 74240 points are inserted. Some points from the lists share the same timestamp but using a tag and not field, the points are not overwritten. Here the way to build the list of points and the way to add into influx :

def map2points
      (
        m : scala.collection.mutable.Map[String, List[Double]], // matrix of points 
        channels : Array[String],
        awsKey : String,
        startime : Long,
        frequency : Double
      ) : List[Point] = {
      m.foldLeft(List[Point]()) { case (acc, (key, values)) =>
        val timed_points : List[Point] = values.zipWithIndex map { case (v, i) =>
          val ts = startime + (math round ((10e6 / frequency) * i)).toLong
          Point("titi",ts)
            .addTag("channel",key)
            .addField("value", v)
        }
        timed_points ++ acc
      }
    }
  }
val t4 = System.currentTimeMillis
 assert(points.size == 742400)
 Logger.info("Insertion status =  " + Await.result(database.bulkWrite(points, precision = Precision.MICROSECONDS), 10.seconds))
val t5 = System.currentTimeMillis

Which I find weird, the boolean returned by the bulkWrite function is true even all the points are not inserted. Do you have an idea why all the points are not inserted ? Maybe I use the library in a wrong way ?

@alifirat
Copy link
Author

I fixed my error, there are some points with the same timestamp and the same tag. It's the reason why some points were not inserted into influx.

@paulgoldbaum
Copy link
Owner

Glad you could solve this!

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

No branches or pull requests

2 participants