Skip to content

Commit 54b42fe

Browse files
committed
added minutes in destination file
1 parent 2dcc409 commit 54b42fe

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
This project provides a way to extract time series samples from Arduino cloud, publishing to a S3 destination bucket.
44
Data are extracted at the given resolution via a scheduled Lambda function. Then samples are stored in CSV files and saved to S3.
5-
By default, data extraction is performed every hour, extracting samples aggregated at 5min resolution. Non numeric values like strings are sampled at the given resolution.
5+
By default, data extraction is performed every hour (configurable), extracting samples aggregated at 5min resolution (configurable).
6+
Aggregation is performed as average over aggregation period.
7+
Non numeric values like strings are sampled at the given resolution.
68

79
## Architecture
810

business/tsextractor/tsextractor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func (a *TsExtractor) ExportTSToS3(
128128
writer.Close()
129129
defer writer.Delete()
130130

131-
destinationKey := fmt.Sprintf("%s/%s.csv", from.Format("2006-01-02"), from.Format("2006-01-02-15"))
131+
destinationKey := fmt.Sprintf("%s/%s.csv", from.Format("2006-01-02"), from.Format("2006-01-02-15-04"))
132132
a.logger.Infof("Uploading file %s to bucket %s\n", destinationKey, s3cl.DestinationBucket())
133133
if err := s3cl.WriteFile(ctx, destinationKey, writer.GetFilePath()); err != nil {
134134
return err

internal/csv/csv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const (
1818
var csvHeader = []string{"timestamp", "thing_id", "thing_name", "property_id", "property_name", "property_type", "value"}
1919

2020
func NewWriter(destinationHour time.Time, logger *logrus.Entry) (*CsvWriter, error) {
21-
filePath := fmt.Sprintf("%s/%s.csv", baseTmpStorage, destinationHour.Format("2006-01-02-15:04"))
21+
filePath := fmt.Sprintf("%s/%s.csv", baseTmpStorage, destinationHour.Format("2006-01-02-15-04"))
2222
file, err := os.Create(filePath)
2323
if err != nil {
2424
logger.Fatalf("failed creating file: %s", err)

0 commit comments

Comments
 (0)