| 1 | // Copyright 2019 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package eventscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event`/ |
| 6 | |
| 7 | import ( |
| 8 | "contextscip-go gomod github.com/golang/go/src go1.25.0 context/" |
| 9 | |
| 10 | "golang.org/x/tools/internal/event/corescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/" |
| 11 | "golang.org/x/tools/internal/event/keysscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/" |
| 12 | "golang.org/x/tools/internal/event/labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/" |
| 13 | ) |
| 14 | |
| 15 | // Exporter is a function that handles events. |
| 16 | // It may return a modified context and event. |
| 17 | type Exporterscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event`/Exporter# func(contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Contextscip-go gomod github.com/golang/go/src go1.25.0 context/Context#, corescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/.Eventscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/Event#, labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/.Mapscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/Map#) contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Contextscip-go gomod github.com/golang/go/src go1.25.0 context/Context# |
| 18 | |
| 19 | // SetExporter sets the global exporter function that handles all events. |
| 20 | // The exporter is called synchronously from the event call site, so it should |
| 21 | // return quickly so as not to hold up user code. |
| 22 | func SetExporterscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event`/SetExporter().(e Exporterscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event`/Exporter#) { |
| 23 | corescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/.SetExporterscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/SetExporter().(corescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/.Exporterscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/Exporter#(e)) |
| 24 | } |
| 25 | |
| 26 | // Log takes a message and a label list and combines them into a single event |
| 27 | // before delivering them to the exporter. |
| 28 | func Logscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event`/Log().(ctx contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Contextscip-go gomod github.com/golang/go/src go1.25.0 context/Context#, message string, labels ...labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/.Labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/Label#) { |
| 29 | corescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/.Exportscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/Export().(ctx, corescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/.MakeEventscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/MakeEvent().([3]labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/.Labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/Label#{ |
| 30 | keysscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/.Msgscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/Msg..Ofscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/String#Of().(message), |
| 31 | }, labels)) |
| 32 | } |
| 33 | |
| 34 | // IsLog returns true if the event was built by the Log function. |
| 35 | // It is intended to be used in exporters to identify the semantics of the |
| 36 | // event when deciding what to do with it. |
| 37 | func IsLogscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event`/IsLog().(ev corescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/.Eventscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/Event#) bool { |
| 38 | return ev.Labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/Event#Label().(0).Keyscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/Label#Key().() == keysscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/.Msgscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/Msg. |
| 39 | } |
| 40 | |
| 41 | // Error takes a message and a label list and combines them into a single event |
| 42 | // before delivering them to the exporter. It captures the error in the |
| 43 | // delivered event. |
| 44 | func Errorscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event`/Error().(ctx contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Contextscip-go gomod github.com/golang/go/src go1.25.0 context/Context#, message string, err error, labels ...labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/.Labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/Label#) { |
| 45 | corescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/.Exportscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/Export().(ctx, corescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/.MakeEventscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/MakeEvent().([3]labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/.Labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/Label#{ |
| 46 | keysscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/.Msgscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/Msg..Ofscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/String#Of().(message), |
| 47 | keysscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/.Errscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/Err..Ofscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/Error#Of().(err), |
| 48 | }, labels)) |
| 49 | } |
| 50 | |
| 51 | // IsError returns true if the event was built by the Error function. |
| 52 | // It is intended to be used in exporters to identify the semantics of the |
| 53 | // event when deciding what to do with it. |
| 54 | func IsErrorscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event`/IsError().(ev corescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/.Eventscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/Event#) bool { |
| 55 | return ev.Labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/Event#Label().(0).Keyscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/Label#Key().() == keysscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/.Msgscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/Msg. && |
| 56 | ev.Labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/Event#Label().(1).Keyscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/Label#Key().() == keysscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/.Errscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/Err. |
| 57 | } |
| 58 | |
| 59 | // Metric sends a label event to the exporter with the supplied labels. |
| 60 | func Metricscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event`/Metric().(ctx contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Contextscip-go gomod github.com/golang/go/src go1.25.0 context/Context#, labels ...labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/.Labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/Label#) { |
| 61 | corescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/.Exportscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/Export().(ctx, corescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/.MakeEventscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/MakeEvent().([3]labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/.Labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/Label#{ |
| 62 | keysscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/.Metricscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/Metric..Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/Tag#New().(), |
| 63 | }, labels)) |
| 64 | } |
| 65 | |
| 66 | // IsMetric returns true if the event was built by the Metric function. |
| 67 | // It is intended to be used in exporters to identify the semantics of the |
| 68 | // event when deciding what to do with it. |
| 69 | func IsMetricscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event`/IsMetric().(ev corescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/.Eventscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/Event#) bool { |
| 70 | return ev.Labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/Event#Label().(0).Keyscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/Label#Key().() == keysscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/.Metricscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/Metric. |
| 71 | } |
| 72 | |
| 73 | // Label sends a label event to the exporter with the supplied labels. |
| 74 | func Labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event`/Label().(ctx contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Contextscip-go gomod github.com/golang/go/src go1.25.0 context/Context#, labels ...labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/.Labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/Label#) contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Contextscip-go gomod github.com/golang/go/src go1.25.0 context/Context# { |
| 75 | return corescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/.Exportscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/Export().(ctx, corescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/.MakeEventscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/MakeEvent().([3]labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/.Labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/Label#{ |
| 76 | keysscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/.Labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/Label..Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/Tag#New().(), |
| 77 | }, labels)) |
| 78 | } |
| 79 | |
| 80 | // IsLabel returns true if the event was built by the Label function. |
| 81 | // It is intended to be used in exporters to identify the semantics of the |
| 82 | // event when deciding what to do with it. |
| 83 | func IsLabelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event`/IsLabel().(ev corescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/.Eventscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/Event#) bool { |
| 84 | return ev.Labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/Event#Label().(0).Keyscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/Label#Key().() == keysscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/.Labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/Label. |
| 85 | } |
| 86 | |
| 87 | // Start sends a span start event with the supplied label list to the exporter. |
| 88 | // It also returns a function that will end the span, which should normally be |
| 89 | // deferred. |
| 90 | func Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event`/Start().(ctx contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Contextscip-go gomod github.com/golang/go/src go1.25.0 context/Context#, name string, labels ...labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/.Labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/Label#) (contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Contextscip-go gomod github.com/golang/go/src go1.25.0 context/Context#, func()) { |
| 91 | return corescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/.ExportPairscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/ExportPair().(ctx, |
| 92 | corescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/.MakeEventscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/MakeEvent().([3]labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/.Labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/Label#{ |
| 93 | keysscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/.Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/Start..Ofscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/String#Of().(name), |
| 94 | }, labels), |
| 95 | corescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/.MakeEventscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/MakeEvent().([3]labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/.Labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/Label#{ |
| 96 | keysscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/.Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/End..Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/Tag#New().(), |
| 97 | }, nil)) |
| 98 | } |
| 99 | |
| 100 | // IsStart returns true if the event was built by the Start function. |
| 101 | // It is intended to be used in exporters to identify the semantics of the |
| 102 | // event when deciding what to do with it. |
| 103 | func IsStartscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event`/IsStart().(ev corescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/.Eventscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/Event#) bool { |
| 104 | return ev.Labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/Event#Label().(0).Keyscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/Label#Key().() == keysscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/.Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/Start. |
| 105 | } |
| 106 | |
| 107 | // IsEnd returns true if the event was built by the End function. |
| 108 | // It is intended to be used in exporters to identify the semantics of the |
| 109 | // event when deciding what to do with it. |
| 110 | func IsEndscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event`/IsEnd().(ev corescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/.Eventscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/Event#) bool { |
| 111 | return ev.Labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/Event#Label().(0).Keyscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/Label#Key().() == keysscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/.Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/End. |
| 112 | } |
| 113 | |
| 114 | // Detach returns a context without an associated span. |
| 115 | // This allows the creation of spans that are not children of the current span. |
| 116 | func Detachscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event`/Detach().(ctx contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Contextscip-go gomod github.com/golang/go/src go1.25.0 context/Context#) contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Contextscip-go gomod github.com/golang/go/src go1.25.0 context/Context# { |
| 117 | return corescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/.Exportscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/Export().(ctx, corescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/.MakeEventscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/MakeEvent().([3]labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/.Labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/Label#{ |
| 118 | keysscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/.Detachscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/Detach..Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/Tag#New().(), |
| 119 | }, nil)) |
| 120 | } |
| 121 | |
| 122 | // IsDetach returns true if the event was built by the Detach function. |
| 123 | // It is intended to be used in exporters to identify the semantics of the |
| 124 | // event when deciding what to do with it. |
| 125 | func IsDetachscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event`/IsDetach().(ev corescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/.Eventscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/Event#) bool { |
| 126 | return ev.Labelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/core`/Event#Label().(0).Keyscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/label`/Label#Key().() == keysscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/.Detachscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/event/keys`/Detach. |
| 127 | } |