百度智能云

All Product Document

          Time-Spatial Database

          Gzip Compression Instruction of Writing Data Points

          In the sdk of v0.10.10, gzip compression is enabled by default for writing data points. If you do not need to use it, you can refer to the following code:

          String METRIC = "cpu_idle";                                          // metric
          String TAG_KEY = "server";                                           // tag name
          String TAG_VALUE = "server1";                                        // tag value
           
          // create data points
          List<Datapoint> datapoints = Arrays.asList(new Datapoint()
                          .withMetric(METRIC)                                  // set Metric
                          .addTag(TAG_KEY, TAG_VALUE)                          // set Tag
                          .addDoubleValue(System.currentTimeMillis(), 0.1));   // add a data point
          boolean useGzip = false;                                             // do not use gzip
           
          tsdbClient.writeDatapoints(new WriteDatapointsRequest().withDatapoints(datapoints), useGzip);
          Previous
          URLGenerate the Pre-Signed URL of Query Data Points
          Next
          Management Interface