Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: logdog/client/annotee/annotation/annotation.go

Issue 2268543003: Annotee: Shorten logdog log link label (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: Retrain Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | logdog/client/annotee/annotation/test_expectations/coverage_steps.proto.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 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 annotation 5 package annotation
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "path" 9 "path"
10 "strconv" 10 "strconv"
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 if !ok { 746 if !ok {
747 // No entry for this log line. Create a new one and register it. 747 // No entry for this log line. Create a new one and register it.
748 // 748 //
749 // This will appear as: 749 // This will appear as:
750 // [BASE]/logs/[label]/[ord] 750 // [BASE]/logs/[label]/[ord]
751 subName, err := types.MakeStreamName("s_", "logs", label, strcon v.Itoa(as.logLineCount[label])) 751 subName, err := types.MakeStreamName("s_", "logs", label, strcon v.Itoa(as.logLineCount[label]))
752 if err != nil { 752 if err != nil {
753 panic(fmt.Errorf("failed to generate log stream name for [%s]: %s", label, err)) 753 panic(fmt.Errorf("failed to generate log stream name for [%s]: %s", label, err))
754 } 754 }
755 name = as.BaseStream(subName) 755 name = as.BaseStream(subName)
756 » » as.AddLogdogStreamLink("", "", name) 756 » » as.AddLogdogStreamLink("", label, "", name)
757 757
758 as.logLines[label] = name 758 as.logLines[label] = name
759 as.logLineCount[label]++ 759 as.logLineCount[label]++
760 updated = true 760 updated = true
761 } 761 }
762 762
763 as.s.Callbacks.StepLogLine(as, name, label, line) 763 as.s.Callbacks.StepLogLine(as, name, label, line)
764 return updated 764 return updated
765 } 765 }
766 766
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 } 840 }
841 } 841 }
842 if nestParent == nil || nestParent == as.parent { 842 if nestParent == nil || nestParent == as.parent {
843 return true 843 return true
844 } 844 }
845 nestParent.appendSubstep(as) 845 nestParent.appendSubstep(as)
846 return true 846 return true
847 } 847 }
848 848
849 // AddLogdogStreamLink adds a LogDog stream link to this Step's links list. 849 // AddLogdogStreamLink adds a LogDog stream link to this Step's links list.
850 func (as *Step) AddLogdogStreamLink(server string, prefix, name types.StreamName ) { 850 func (as *Step) AddLogdogStreamLink(server, label string, prefix, name types.Str eamName) {
851 link := &milo.Link{ 851 link := &milo.Link{
852 Label: label,
852 Value: &milo.Link_LogdogStream{&milo.LogdogStream{ 853 Value: &milo.Link_LogdogStream{&milo.LogdogStream{
853 Name: string(name), 854 Name: string(name),
854 Server: server, 855 Server: server,
855 Prefix: string(prefix), 856 Prefix: string(prefix),
856 }}, 857 }},
857 } 858 }
858 as.OtherLinks = append(as.OtherLinks, link) 859 as.OtherLinks = append(as.OtherLinks, link)
859 } 860 }
860 861
861 // AddURLLink adds a URL link to this Step's links list. 862 // AddURLLink adds a URL link to this Step's links list.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 as.StderrStream, updated = as.maybeSetLogDogStream(as.StderrStream, st) 913 as.StderrStream, updated = as.maybeSetLogDogStream(as.StderrStream, st)
913 return 914 return
914 } 915 }
915 916
916 func (as *Step) maybeSetLogDogStream(target *milo.LogdogStream, st *milo.LogdogS tream) (*milo.LogdogStream, bool) { 917 func (as *Step) maybeSetLogDogStream(target *milo.LogdogStream, st *milo.LogdogS tream) (*milo.LogdogStream, bool) {
917 if (target == nil && st == nil) || (target != nil && st != nil && *targe t == *st) { 918 if (target == nil && st == nil) || (target != nil && st != nil && *targe t == *st) {
918 return target, false 919 return target, false
919 } 920 }
920 return st, true 921 return st, true
921 } 922 }
OLDNEW
« no previous file with comments | « no previous file | logdog/client/annotee/annotation/test_expectations/coverage_steps.proto.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698