diff --git a/influx/annotations.go b/influx/annotations.go index fa4cfccb3e..16903d0832 100644 --- a/influx/annotations.go +++ b/influx/annotations.go @@ -18,8 +18,8 @@ const ( AllAnnotations = `SELECT "start_time", "modified_time_ns", "text", "type", "id" FROM "chronograf"."autogen"."annotations" WHERE "deleted"=false AND time >= %dns and "start_time" <= %d ORDER BY time DESC` // GetAnnotationID returns all annotations from the chronograf database where id is %s GetAnnotationID = `SELECT "start_time", "modified_time_ns", "text", "type", "id" FROM "chronograf"."autogen"."annotations" WHERE "id"='%s' AND "deleted"=false ORDER BY time DESC` - // DefaultDB is chronograf. Perhaps later we allow this to be changed - DefaultDB = "chronograf" + // AnnotationsDB is chronograf. Perhaps later we allow this to be changed + AnnotationsDB = "chronograf" // DefaultRP is autogen. Perhaps later we allow this to be changed DefaultRP = "autogen" // DefaultMeasurement is annotations. @@ -104,7 +104,7 @@ func (a *AnnotationStore) Update(ctx context.Context, anno *chronograf.Annotatio func (a *AnnotationStore) queryAnnotations(ctx context.Context, query string) ([]chronograf.Annotation, error) { res, err := a.client.Query(ctx, chronograf.Query{ Command: query, - DB: DefaultDB, + DB: AnnotationsDB, Epoch: "ns", }) if err != nil { @@ -126,7 +126,7 @@ func (a *AnnotationStore) queryAnnotations(ctx context.Context, query string) ([ func toPoint(anno *chronograf.Annotation, now time.Time) *chronograf.Point { return &chronograf.Point{ - Database: DefaultDB, + Database: AnnotationsDB, RetentionPolicy: DefaultRP, Measurement: DefaultMeasurement, Time: anno.EndTime.UnixNano(), @@ -145,7 +145,7 @@ func toPoint(anno *chronograf.Annotation, now time.Time) *chronograf.Point { func toDeletedPoint(anno *chronograf.Annotation, now time.Time) *chronograf.Point { return &chronograf.Point{ - Database: DefaultDB, + Database: AnnotationsDB, RetentionPolicy: DefaultRP, Measurement: DefaultMeasurement, Time: anno.EndTime.UnixNano(), diff --git a/influx/annotations_test.go b/influx/annotations_test.go index 1d6b410817..45b00f8a87 100644 --- a/influx/annotations_test.go +++ b/influx/annotations_test.go @@ -29,7 +29,7 @@ func Test_toPoint(t *testing.T) { }, now: time.Unix(0, 0), want: &chronograf.Point{ - Database: DefaultDB, + Database: AnnotationsDB, RetentionPolicy: DefaultRP, Measurement: DefaultMeasurement, Time: time.Time{}.UnixNano(), @@ -56,7 +56,7 @@ func Test_toPoint(t *testing.T) { }, now: time.Unix(0, 0), want: &chronograf.Point{ - Database: DefaultDB, + Database: AnnotationsDB, RetentionPolicy: DefaultRP, Measurement: DefaultMeasurement, Time: time.Unix(200, 0).UnixNano(), @@ -97,7 +97,7 @@ func Test_toDeletedPoint(t *testing.T) { }, now: time.Unix(0, 0), want: &chronograf.Point{ - Database: DefaultDB, + Database: AnnotationsDB, RetentionPolicy: DefaultRP, Measurement: DefaultMeasurement, Time: 0,