Chromium Code Reviews| 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 logdog | 5 package logdog |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "net/http" | 8 "net/http" |
| 9 "strings" | 9 "strings" |
| 10 | 10 |
| 11 "github.com/julienschmidt/httprouter" | 11 "github.com/julienschmidt/httprouter" |
| 12 "github.com/luci/luci-go/common/config" | 12 "github.com/luci/luci-go/common/config" |
| 13 log "github.com/luci/luci-go/common/logging" | 13 log "github.com/luci/luci-go/common/logging" |
| 14 "github.com/luci/luci-go/grpc/prpc" | |
| 15 "github.com/luci/luci-go/logdog/client/coordinator" | |
| 14 "github.com/luci/luci-go/logdog/common/types" | 16 "github.com/luci/luci-go/logdog/common/types" |
| 15 "github.com/luci/luci-go/milo/appengine/settings" | 17 "github.com/luci/luci-go/milo/appengine/settings" |
| 16 "github.com/luci/luci-go/milo/common/miloerror" | 18 "github.com/luci/luci-go/milo/common/miloerror" |
| 17 "github.com/luci/luci-go/server/auth" | 19 "github.com/luci/luci-go/server/auth" |
| 18 "github.com/luci/luci-go/server/templates" | 20 "github.com/luci/luci-go/server/templates" |
| 19 | 21 |
| 20 "golang.org/x/net/context" | 22 "golang.org/x/net/context" |
| 21 ) | 23 ) |
| 22 | 24 |
| 23 // AnnotationStream is a ThemedHandler that renders a LogDog Milo annotation | 25 // AnnotationStream is a ThemedHandler that renders a LogDog Milo annotation |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 46 Code: http.StatusInternalServerError, | 48 Code: http.StatusInternalServerError, |
| 47 } | 49 } |
| 48 } | 50 } |
| 49 | 51 |
| 50 as := annotationStreamRequest{ | 52 as := annotationStreamRequest{ |
| 51 AnnotationStream: s, | 53 AnnotationStream: s, |
| 52 | 54 |
| 53 project: config.ProjectName(p.ByName("project")), | 55 project: config.ProjectName(p.ByName("project")), |
| 54 path: types.StreamPath(strings.Trim(p.ByName("path"), "/")), | 56 path: types.StreamPath(strings.Trim(p.ByName("path"), "/")), |
| 55 host: req.FormValue("host"), | 57 host: req.FormValue("host"), |
| 56 | |
| 57 logDogClient: http.Client{ | |
| 58 Transport: t, | |
| 59 }, | |
| 60 } | 58 } |
| 61 if err := as.normalize(); err != nil { | 59 if err := as.normalize(); err != nil { |
| 62 return nil, err | 60 return nil, err |
| 63 } | 61 } |
| 64 | 62 |
| 63 // Setup our LogDog client. | |
| 64 as.logDogClient = coordinator.NewClient(&prpc.Client{ | |
|
martiniss
2016/09/22 03:40:39
why was this moved?
dnj
2016/09/22 16:00:05
Previously, "logDogClient" was an http.Client. Now
| |
| 65 C: &http.Client{ | |
| 66 Transport: t, | |
| 67 }, | |
| 68 Host: as.host, | |
| 69 }) | |
| 70 | |
| 65 // Load the Milo annotation protobuf from the annotation stream. | 71 // Load the Milo annotation protobuf from the annotation stream. |
| 66 if err := as.load(c); err != nil { | 72 if err := as.load(c); err != nil { |
| 67 return nil, err | 73 return nil, err |
| 68 } | 74 } |
| 69 | 75 |
| 70 // Convert the Milo Annotation protobuf to Milo objects. | 76 // Convert the Milo Annotation protobuf to Milo objects. |
| 71 return &templates.Args{ | 77 return &templates.Args{ |
| 72 "Build": as.toMiloBuild(c), | 78 "Build": as.toMiloBuild(c), |
| 73 }, nil | 79 }, nil |
| 74 } | 80 } |
| OLD | NEW |