Beispiel #1
0
			Expect(err).To(BeNil())

			api = NewPerfDashApi(index_name)

		})
		AfterEach(func() {
			_, err := es.DeleteIndex(index_name)
			Expect(err).To(BeNil())
			es.Refresh(index_name)
			//fmt.Println("index name", index_name)
		})

		It("should get a json with metrics", func() {
			req := PerfDashRequest{
				Timerange: datetime.Timerange{
					From: datetime.MustParseJsTime("2015-01-02T15:04:04.000Z"),
					To:   datetime.MustParseJsTime("2015-01-02T15:04:06.000Z"),
				},
				Metrics: []ConfigRaw{
					ConfigRaw{
						Name: "volume_avg",
						Type: "volume",
						Config: json.RawMessage(`{ "type": "volume",
							"field": "count",
							"agg": "avg",
							"interval": "s" }`,
						),
					},
					ConfigRaw{
						Name: "percentile_50th",
						Type: "percentile",
Beispiel #2
0
			err = testdata.InsertInto(es, index_name, transactions)
			Expect(err).To(BeNil())

			api = NewByDimensionApi(index_name)

		})
		AfterEach(func() {
			_, err := es.DeleteIndex(index_name)
			Expect(err).To(BeNil())
			es.Refresh(index_name)
			//fmt.Println("index name", index_name)
		})

		It("should get", func() {
			var req ByDimensionRequest
			req.Timerange.From = datetime.MustParseJsTime("2015-01-02T15:04:04.000Z")
			req.Timerange.To = datetime.MustParseJsTime("2015-01-02T15:04:06.000Z")
			req.Metrics = []string{"volume", "rt_avg", "rt_max",
				"rt_percentiles", "secondary_count", "errors_rate"}
			req.Config.Percentiles = []float32{50, 99.995}

			resp, code, err := api.Query(&req)
			Expect(err).To(BeNil())
			Expect(code).To(Equal(200))
			Expect(len(resp.Primary)).To(Equal(2))

			services := map[string]PrimaryDimension{}
			for _, primary := range resp.Primary {
				services[primary.Name] = primary
			}