OLD | NEW |
1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 The LUCI Authors. All rights reserved. |
2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
4 | 4 |
5 package main | 5 package main |
6 | 6 |
7 import ( | 7 import ( |
8 "time" | 8 "time" |
9 | 9 |
10 "github.com/luci/luci-go/common/auth" | 10 "github.com/luci/luci-go/common/auth" |
11 "github.com/luci/luci-go/common/clock" | 11 "github.com/luci/luci-go/common/clock" |
12 "github.com/luci/luci-go/common/config" | 12 "github.com/luci/luci-go/common/config" |
13 "github.com/luci/luci-go/common/errors" | 13 "github.com/luci/luci-go/common/errors" |
14 "github.com/luci/luci-go/common/gcloud/gs" | 14 "github.com/luci/luci-go/common/gcloud/gs" |
15 gcps "github.com/luci/luci-go/common/gcloud/pubsub" | 15 gcps "github.com/luci/luci-go/common/gcloud/pubsub" |
16 log "github.com/luci/luci-go/common/logging" | 16 log "github.com/luci/luci-go/common/logging" |
17 "github.com/luci/luci-go/common/parallel" | 17 "github.com/luci/luci-go/common/parallel" |
18 "github.com/luci/luci-go/common/proto/logdog/svcconfig" | 18 "github.com/luci/luci-go/common/proto/logdog/svcconfig" |
19 "github.com/luci/luci-go/common/tsmon/distribution" | 19 "github.com/luci/luci-go/common/tsmon/distribution" |
20 "github.com/luci/luci-go/common/tsmon/field" | 20 "github.com/luci/luci-go/common/tsmon/field" |
21 "github.com/luci/luci-go/common/tsmon/metric" | 21 "github.com/luci/luci-go/common/tsmon/metric" |
| 22 "github.com/luci/luci-go/common/tsmon/types" |
22 "github.com/luci/luci-go/server/internal/logdog/archivist" | 23 "github.com/luci/luci-go/server/internal/logdog/archivist" |
23 "github.com/luci/luci-go/server/internal/logdog/service" | 24 "github.com/luci/luci-go/server/internal/logdog/service" |
24 "golang.org/x/net/context" | 25 "golang.org/x/net/context" |
25 "google.golang.org/cloud" | 26 "google.golang.org/cloud" |
26 "google.golang.org/cloud/pubsub" | 27 "google.golang.org/cloud/pubsub" |
27 ) | 28 ) |
28 | 29 |
29 var ( | 30 var ( |
30 errInvalidConfig = errors.New("invalid configuration") | 31 errInvalidConfig = errors.New("invalid configuration") |
31 | 32 |
32 // tsTaskProcessingTime measures the amount of time spent processing a s
ingle | 33 // tsTaskProcessingTime measures the amount of time spent processing a s
ingle |
33 // task. | 34 // task. |
34 // | 35 // |
35 // The "consumed" field is true if the underlying task was consumed and | 36 // The "consumed" field is true if the underlying task was consumed and |
36 // false if it was not. | 37 // false if it was not. |
37 tsTaskProcessingTime = metric.NewCumulativeDistribution("logdog/archivis
t/task_processing_time_ms", | 38 tsTaskProcessingTime = metric.NewCumulativeDistribution("logdog/archivis
t/task_processing_time_ms", |
38 "The amount of time (in milliseconds) that a single task takes t
o process.", | 39 "The amount of time (in milliseconds) that a single task takes t
o process.", |
| 40 types.MetricMetadata{Units: types.Milliseconds}, |
39 distribution.DefaultBucketer, | 41 distribution.DefaultBucketer, |
40 field.Bool("consumed")) | 42 field.Bool("consumed")) |
41 ) | 43 ) |
42 | 44 |
43 const ( | 45 const ( |
44 // subscriptionErrorDelay is the amount of time to sleep after a subscri
ption | 46 // subscriptionErrorDelay is the amount of time to sleep after a subscri
ption |
45 // iterator returns a non-terminal error. | 47 // iterator returns a non-terminal error. |
46 subscriptionErrorDelay = 10 * time.Second | 48 subscriptionErrorDelay = 10 * time.Second |
47 ) | 49 ) |
48 | 50 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 275 |
274 // Entry point. | 276 // Entry point. |
275 func main() { | 277 func main() { |
276 a := application{ | 278 a := application{ |
277 Service: service.Service{ | 279 Service: service.Service{ |
278 Name: "archivist", | 280 Name: "archivist", |
279 }, | 281 }, |
280 } | 282 } |
281 a.Run(context.Background(), a.runArchivist) | 283 a.Run(context.Background(), a.runArchivist) |
282 } | 284 } |
OLD | NEW |