| 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 ocagent adds the ability to export all telemetry to an ocagent. |
| 6 | // This keeps the compile time dependencies to zero and allows the agent to |
| 7 | // have the exporters needed for telemetry aggregation and viewing systems. |
| 8 | package ocagentscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/ |
| 9 | |
| 10 | import ( |
| 11 | "bytesscip-go gomod github.com/golang/go/src go1.24.0 bytes/" |
| 12 | "contextscip-go gomod github.com/golang/go/src go1.24.0 context/" |
| 13 | "encoding/jsonscip-go gomod github.com/golang/go/src go1.24.0 `encoding/json`/" |
| 14 | "fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/" |
| 15 | "net/httpscip-go gomod github.com/golang/go/src go1.24.0 `net/http`/" |
| 16 | "osscip-go gomod github.com/golang/go/src go1.24.0 os/" |
| 17 | "path/filepathscip-go gomod github.com/golang/go/src go1.24.0 `path/filepath`/" |
| 18 | "syncscip-go gomod github.com/golang/go/src go1.24.0 sync/" |
| 19 | "timescip-go gomod github.com/golang/go/src go1.24.0 time/" |
| 20 | |
| 21 | "cuelang.org/go/internal/golangorgx/tools/eventscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event`/" |
| 22 | "cuelang.org/go/internal/golangorgx/tools/event/corescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/core`/" |
| 23 | "cuelang.org/go/internal/golangorgx/tools/event/exportscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export`/" |
| 24 | "cuelang.org/go/internal/golangorgx/tools/event/export/metricscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/metric`/" |
| 25 | "cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/" |
| 26 | "cuelang.org/go/internal/golangorgx/tools/event/keysscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/" |
| 27 | "cuelang.org/go/internal/golangorgx/tools/event/labelscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/" |
| 28 | ) |
| 29 | |
| 30 | type Configscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config# struct { |
| 31 | Startscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Start. timescip-go gomod github.com/golang/go/src go1.24.0 time/.Timescip-go gomod github.com/golang/go/src go1.24.0 time/Time# |
| 32 | Hostscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Host. string |
| 33 | Processscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Process. uint32 |
| 34 | Clientscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Client. *httpscip-go gomod github.com/golang/go/src go1.24.0 `net/http`/.Clientscip-go gomod github.com/golang/go/src go1.24.0 `net/http`/Client# |
| 35 | Servicescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Service. string |
| 36 | Addressscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Address. string |
| 37 | Ratescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Rate. timescip-go gomod github.com/golang/go/src go1.24.0 time/.Durationscip-go gomod github.com/golang/go/src go1.24.0 time/Duration# |
| 38 | } |
| 39 | |
| 40 | var ( |
| 41 | connectMuscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/connectMu. syncscip-go gomod github.com/golang/go/src go1.24.0 sync/.Mutexscip-go gomod github.com/golang/go/src go1.24.0 sync/Mutex# |
| 42 | exportersscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/exporters. = make(map[Configscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#]*Exporterscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#) |
| 43 | ) |
| 44 | |
| 45 | // Discover finds the local agent to export to, it will return nil if there |
| 46 | // is not one running. |
| 47 | // TODO: Actually implement a discovery protocol rather than a hard coded address |
| 48 | func Discoverscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Discover().() *Configscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config# { |
| 49 | return &Configscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#{ |
| 50 | Addressscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Address.: "http://localhost:55678", |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | type Exporterscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter# struct { |
| 55 | muscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#mu. syncscip-go gomod github.com/golang/go/src go1.24.0 sync/.Mutexscip-go gomod github.com/golang/go/src go1.24.0 sync/Mutex# |
| 56 | configscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#config. Configscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config# |
| 57 | spansscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#spans. []*exportscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export`/.Spanscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export`/Span# |
| 58 | metricsscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#metrics. []metricscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/metric`/.Datascip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/metric`/Data# |
| 59 | } |
| 60 | |
| 61 | // Connect creates a process specific exporter with the specified |
| 62 | // serviceName and the address of the ocagent to which it will upload |
| 63 | // its telemetry. |
| 64 | func Connectscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Connect().(config *Configscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#) *Exporterscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter# { |
| 65 | if config == nil || config.Addressscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Address. == "off" { |
| 66 | return nil |
| 67 | } |
| 68 | resolved := *config |
| 69 | if resolved.Hostscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Host. == "" { |
| 70 | hostname, _ := osscip-go gomod github.com/golang/go/src go1.24.0 os/.Hostnamescip-go gomod github.com/golang/go/src go1.24.0 os/Hostname().() |
| 71 | resolved.Hostscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Host. = hostname |
| 72 | } |
| 73 | if resolved.Processscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Process. == 0 { |
| 74 | resolved.Processscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Process. = uint32(osscip-go gomod github.com/golang/go/src go1.24.0 os/.Getpidscip-go gomod github.com/golang/go/src go1.24.0 os/Getpid().()) |
| 75 | } |
| 76 | if resolved.Clientscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Client. == nil { |
| 77 | resolved.Clientscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Client. = httpscip-go gomod github.com/golang/go/src go1.24.0 `net/http`/.DefaultClientscip-go gomod github.com/golang/go/src go1.24.0 `net/http`/DefaultClient. |
| 78 | } |
| 79 | if resolved.Servicescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Service. == "" { |
| 80 | resolved.Servicescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Service. = filepathscip-go gomod github.com/golang/go/src go1.24.0 `path/filepath`/.Basescip-go gomod github.com/golang/go/src go1.24.0 `path/filepath`/Base().(osscip-go gomod github.com/golang/go/src go1.24.0 os/.Argsscip-go gomod github.com/golang/go/src go1.24.0 os/Args.[0]) |
| 81 | } |
| 82 | if resolved.Ratescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Rate. == 0 { |
| 83 | resolved.Ratescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Rate. = 2 * timescip-go gomod github.com/golang/go/src go1.24.0 time/.Secondscip-go gomod github.com/golang/go/src go1.24.0 time/Second. |
| 84 | } |
| 85 | |
| 86 | connectMuscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/connectMu..Lockscip-go gomod github.com/golang/go/src go1.24.0 sync/Mutex#Lock().() |
| 87 | defer connectMuscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/connectMu..Unlockscip-go gomod github.com/golang/go/src go1.24.0 sync/Mutex#Unlock().() |
| 88 | if exporter, found := exportersscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/exporters.[resolved]; found { |
| 89 | return exporter |
| 90 | } |
| 91 | exporter := &Exporterscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#{configscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#config.: resolved} |
| 92 | exportersscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/exporters.[resolved] = exporter |
| 93 | if exporter.configscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#config..Startscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Start..IsZeroscip-go gomod github.com/golang/go/src go1.24.0 time/Time#IsZero().() { |
| 94 | exporter.configscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#config..Startscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Start. = timescip-go gomod github.com/golang/go/src go1.24.0 time/.Nowscip-go gomod github.com/golang/go/src go1.24.0 time/Now().() |
| 95 | } |
| 96 | go func() { |
| 97 | for range timescip-go gomod github.com/golang/go/src go1.24.0 time/.Tickscip-go gomod github.com/golang/go/src go1.24.0 time/Tick().(exporter.configscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#config..Ratescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Rate.) { |
| 98 | exporter.Flushscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#Flush().() |
| 99 | } |
| 100 | }() |
| 101 | return exporter |
| 102 | } |
| 103 | |
| 104 | func (e *Exporterscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#) ProcessEventscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#ProcessEvent().(ctx contextscip-go gomod github.com/golang/go/src go1.24.0 context/.Contextscip-go gomod github.com/golang/go/src go1.24.0 context/Context#, ev corescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/core`/.Eventscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/core`/Event#, lm labelscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/.Mapscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/Map#) contextscip-go gomod github.com/golang/go/src go1.24.0 context/.Contextscip-go gomod github.com/golang/go/src go1.24.0 context/Context# { |
| 105 | switch { |
| 106 | case eventscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event`/.IsEndscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event`/IsEnd().(ev): |
| 107 | e.muscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#mu..Lockscip-go gomod github.com/golang/go/src go1.24.0 sync/Mutex#Lock().() |
| 108 | defer e.muscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#mu..Unlockscip-go gomod github.com/golang/go/src go1.24.0 sync/Mutex#Unlock().() |
| 109 | span := exportscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export`/.GetSpanscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export`/GetSpan().(ctx) |
| 110 | if span != nil { |
| 111 | e.spansscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#spans. = append(e.spansscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#spans., span) |
| 112 | } |
| 113 | case eventscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event`/.IsMetricscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event`/IsMetric().(ev): |
| 114 | e.muscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#mu..Lockscip-go gomod github.com/golang/go/src go1.24.0 sync/Mutex#Lock().() |
| 115 | defer e.muscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#mu..Unlockscip-go gomod github.com/golang/go/src go1.24.0 sync/Mutex#Unlock().() |
| 116 | data := metricscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/metric`/.Entriesscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/metric`/Entries..Getscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Value#Get().(lm).([]metricscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/metric`/.Datascip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/metric`/Data#) |
| 117 | e.metricsscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#metrics. = append(e.metricsscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#metrics., data...) |
| 118 | } |
| 119 | return ctx |
| 120 | } |
| 121 | |
| 122 | func (e *Exporterscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#) Flushscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#Flush().() { |
| 123 | e.muscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#mu..Lockscip-go gomod github.com/golang/go/src go1.24.0 sync/Mutex#Lock().() |
| 124 | defer e.muscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#mu..Unlockscip-go gomod github.com/golang/go/src go1.24.0 sync/Mutex#Unlock().() |
| 125 | spans := make([]*wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.Spanscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Span#, len(e.spansscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#spans.)) |
| 126 | for i, s := range e.spansscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#spans. { |
| 127 | spans[i] = convertSpanscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/convertSpan().(s) |
| 128 | } |
| 129 | e.spansscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#spans. = nil |
| 130 | metrics := make([]*wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.Metricscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Metric#, len(e.metricsscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#metrics.)) |
| 131 | for i, m := range e.metricsscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#metrics. { |
| 132 | metrics[i] = convertMetricscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/convertMetric().(m, e.configscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#config..Startscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Start.) |
| 133 | } |
| 134 | e.metricsscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#metrics. = nil |
| 135 | |
| 136 | if len(spans) > 0 { |
| 137 | e.sendscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#send().("/v1/trace", &wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.ExportTraceServiceRequestscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/ExportTraceServiceRequest#{ |
| 138 | Nodescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/ExportTraceServiceRequest#Node.: e.configscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#config..buildNodescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#buildNode().(), |
| 139 | Spansscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/ExportTraceServiceRequest#Spans.: spans, |
| 140 | //TODO: Resource? |
| 141 | }) |
| 142 | } |
| 143 | if len(metrics) > 0 { |
| 144 | e.sendscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#send().("/v1/metrics", &wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.ExportMetricsServiceRequestscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/ExportMetricsServiceRequest#{ |
| 145 | Nodescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/ExportMetricsServiceRequest#Node.: e.configscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#config..buildNodescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#buildNode().(), |
| 146 | Metricsscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/ExportMetricsServiceRequest#Metrics.: metrics, |
| 147 | //TODO: Resource? |
| 148 | }) |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | func (cfg *Configscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#) buildNodescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#buildNode().() *wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.Nodescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Node# { |
| 153 | return &wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.Nodescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Node#{ |
| 154 | Identifierscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Node#Identifier.: &wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.ProcessIdentifierscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/ProcessIdentifier#{ |
| 155 | HostNamescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/ProcessIdentifier#HostName.: cfg.Hostscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Host., |
| 156 | Pidscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/ProcessIdentifier#Pid.: cfg.Processscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Process., |
| 157 | StartTimestampscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/ProcessIdentifier#StartTimestamp.: convertTimestampscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/convertTimestamp().(cfg.Startscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Start.), |
| 158 | }, |
| 159 | LibraryInfoscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Node#LibraryInfo.: &wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.LibraryInfoscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/LibraryInfo#{ |
| 160 | Languagescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/LibraryInfo#Language.: wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.LanguageGoscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/LanguageGo., |
| 161 | ExporterVersionscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/LibraryInfo#ExporterVersion.: "0.0.1", |
| 162 | CoreLibraryVersionscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/LibraryInfo#CoreLibraryVersion.: "x/tools", |
| 163 | }, |
| 164 | ServiceInfoscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Node#ServiceInfo.: &wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.ServiceInfoscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/ServiceInfo#{ |
| 165 | Namescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/ServiceInfo#Name.: cfg.Servicescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Service., |
| 166 | }, |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | func (e *Exporterscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#) sendscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#send().(endpoint string, message interface{}) { |
| 171 | blob, err := jsonscip-go gomod github.com/golang/go/src go1.24.0 `encoding/json`/.Marshalscip-go gomod github.com/golang/go/src go1.24.0 `encoding/json`/Marshal().(message) |
| 172 | if err != nil { |
| 173 | errorInExportscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/errorInExport().("ocagent failed to marshal message for %v: %v", endpoint, err) |
| 174 | return |
| 175 | } |
| 176 | uri := e.configscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#config..Addressscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Address. + endpoint |
| 177 | req, err := httpscip-go gomod github.com/golang/go/src go1.24.0 `net/http`/.NewRequestscip-go gomod github.com/golang/go/src go1.24.0 `net/http`/NewRequest().("POST", uri, bytesscip-go gomod github.com/golang/go/src go1.24.0 bytes/.NewReaderscip-go gomod github.com/golang/go/src go1.24.0 bytes/NewReader().(blob)) |
| 178 | if err != nil { |
| 179 | errorInExportscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/errorInExport().("ocagent failed to build request for %v: %v", uri, err) |
| 180 | return |
| 181 | } |
| 182 | req.Headerscip-go gomod github.com/golang/go/src go1.24.0 `net/http`/Request#Header..Setscip-go gomod github.com/golang/go/src go1.24.0 `net/http`/Header#Set().("Content-Type", "application/json") |
| 183 | res, err := e.configscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Exporter#config..Clientscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/Config#Client..Doscip-go gomod github.com/golang/go/src go1.24.0 `net/http`/Client#Do().(req) |
| 184 | if err != nil { |
| 185 | errorInExportscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/errorInExport().("ocagent failed to send message: %v \n", err) |
| 186 | return |
| 187 | } |
| 188 | if res.Bodyscip-go gomod github.com/golang/go/src go1.24.0 `net/http`/Response#Body. != nil { |
| 189 | res.Bodyscip-go gomod github.com/golang/go/src go1.24.0 `net/http`/Response#Body..Closescip-go gomod github.com/golang/go/src go1.24.0 io/Closer#Close().() |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | func errorInExportscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/errorInExport().(message string, args ...interface{}) { |
| 194 | // This function is useful when debugging the exporter, but in general we |
| 195 | // want to just drop any export |
| 196 | } |
| 197 | |
| 198 | func convertTimestampscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/convertTimestamp().(t timescip-go gomod github.com/golang/go/src go1.24.0 time/.Timescip-go gomod github.com/golang/go/src go1.24.0 time/Time#) wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.Timestampscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Timestamp# { |
| 199 | return t.Formatscip-go gomod github.com/golang/go/src go1.24.0 time/Time#Format().(timescip-go gomod github.com/golang/go/src go1.24.0 time/.RFC3339Nanoscip-go gomod github.com/golang/go/src go1.24.0 time/RFC3339Nano.) |
| 200 | } |
| 201 | |
| 202 | func toTruncatableStringscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/toTruncatableString().(s string) *wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.TruncatableStringscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/TruncatableString# { |
| 203 | if s == "" { |
| 204 | return nil |
| 205 | } |
| 206 | return &wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.TruncatableStringscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/TruncatableString#{Valuescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/TruncatableString#Value.: s} |
| 207 | } |
| 208 | |
| 209 | func convertSpanscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/convertSpan().(span *exportscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export`/.Spanscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export`/Span#) *wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.Spanscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Span# { |
| 210 | result := &wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.Spanscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Span#{ |
| 211 | TraceIDscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Span#TraceID.: span.IDscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export`/Span#ID..TraceIDscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export`/SpanContext#TraceID.[:], |
| 212 | SpanIDscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Span#SpanID.: span.IDscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export`/Span#ID..SpanIDscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export`/SpanContext#SpanID.[:], |
| 213 | TraceStatescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Span#TraceState.: nil, //TODO? |
| 214 | ParentSpanIDscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Span#ParentSpanID.: span.ParentIDscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export`/Span#ParentID.[:], |
| 215 | Namescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Span#Name.: toTruncatableStringscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/toTruncatableString().(span.Namescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export`/Span#Name.), |
| 216 | Kindscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Span#Kind.: wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.UnspecifiedSpanKindscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/UnspecifiedSpanKind., |
| 217 | StartTimescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Span#StartTime.: convertTimestampscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/convertTimestamp().(span.Startscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export`/Span#Start().().Atscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/core`/Event#At().()), |
| 218 | EndTimescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Span#EndTime.: convertTimestampscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/convertTimestamp().(span.Finishscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export`/Span#Finish().().Atscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/core`/Event#At().()), |
| 219 | Attributesscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Span#Attributes.: convertAttributesscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/convertAttributes().(span.Startscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export`/Span#Start().(), 1), |
| 220 | TimeEventsscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Span#TimeEvents.: convertEventsscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/convertEvents().(span.Eventsscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export`/Span#Events().()), |
| 221 | SameProcessAsParentSpanscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Span#SameProcessAsParentSpan.: true, |
| 222 | //TODO: StackTrace? |
| 223 | //TODO: Links? |
| 224 | //TODO: Status? |
| 225 | //TODO: Resource? |
| 226 | } |
| 227 | return result |
| 228 | } |
| 229 | |
| 230 | func convertMetricscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/convertMetric().(data metricscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/metric`/.Datascip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/metric`/Data#, start timescip-go gomod github.com/golang/go/src go1.24.0 time/.Timescip-go gomod github.com/golang/go/src go1.24.0 time/Time#) *wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.Metricscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Metric# { |
| 231 | descriptor := dataToMetricDescriptorscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/dataToMetricDescriptor().(data) |
| 232 | timeseries := dataToTimeseriesscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/dataToTimeseries().(data, start) |
| 233 | |
| 234 | if descriptor == nil && timeseries == nil { |
| 235 | return nil |
| 236 | } |
| 237 | |
| 238 | // TODO: handle Histogram metrics |
| 239 | return &wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.Metricscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Metric#{ |
| 240 | MetricDescriptorscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Metric#MetricDescriptor.: descriptor, |
| 241 | Timeseriesscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Metric#Timeseries.: timeseries, |
| 242 | // TODO: attach Resource? |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | func skipToValidLabelscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/skipToValidLabel().(list labelscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/.Listscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/List#, index int) (int, labelscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/.Labelscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/Label#) { |
| 247 | // skip to the first valid label |
| 248 | for ; list.Validscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/List#Valid.(index); index++ { |
| 249 | l := list.Labelscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/List#Label.(index) |
| 250 | if !l.Validscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/Label#Valid().() || l.Keyscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/Label#Key().() == keysscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/.Labelscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Label. { |
| 251 | continue |
| 252 | } |
| 253 | return index, l |
| 254 | } |
| 255 | return -1, labelscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/.Labelscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/Label#{} |
| 256 | } |
| 257 | |
| 258 | func convertAttributesscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/convertAttributes().(list labelscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/.Listscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/List#, index int) *wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.Attributesscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Attributes# { |
| 259 | index, l := skipToValidLabelscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/skipToValidLabel().(list, index) |
| 260 | if !l.Validscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/Label#Valid().() { |
| 261 | return nil |
| 262 | } |
| 263 | attributes := make(map[string]wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.Attributescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Attribute#) |
| 264 | for { |
| 265 | if l.Validscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/Label#Valid().() { |
| 266 | attributes[l.Keyscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/Label#Key().().Namescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/Key#Name.()] = convertAttributescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/convertAttribute().(l) |
| 267 | } |
| 268 | index++ |
| 269 | if !list.Validscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/List#Valid.(index) { |
| 270 | return &wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.Attributesscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Attributes#{AttributeMapscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Attributes#AttributeMap.: attributes} |
| 271 | } |
| 272 | l = list.Labelscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/List#Label.(index) |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | func convertAttributescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/convertAttribute().(l labelscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/.Labelscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/Label#) wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.Attributescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Attribute# { |
| 277 | switch key := l.Keyscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/Label#Key().().(type) { |
| 278 | case *keysscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/.Intscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Int#: |
| 279 | return wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.IntAttributescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/IntAttribute#{IntValuescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/IntAttribute#IntValue.: int64(key.Fromscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Int#From().(l))} |
| 280 | case *keysscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/.Int8scip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Int8#: |
| 281 | return wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.IntAttributescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/IntAttribute#{IntValuescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/IntAttribute#IntValue.: int64(key.Fromscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Int8#From().(l))} |
| 282 | case *keysscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/.Int16scip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Int16#: |
| 283 | return wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.IntAttributescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/IntAttribute#{IntValuescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/IntAttribute#IntValue.: int64(key.Fromscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Int16#From().(l))} |
| 284 | case *keysscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/.Int32scip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Int32#: |
| 285 | return wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.IntAttributescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/IntAttribute#{IntValuescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/IntAttribute#IntValue.: int64(key.Fromscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Int32#From().(l))} |
| 286 | case *keysscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/.Int64scip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Int64#: |
| 287 | return wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.IntAttributescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/IntAttribute#{IntValuescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/IntAttribute#IntValue.: int64(key.Fromscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Int64#From().(l))} |
| 288 | case *keysscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/.UIntscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/UInt#: |
| 289 | return wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.IntAttributescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/IntAttribute#{IntValuescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/IntAttribute#IntValue.: int64(key.Fromscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/UInt#From().(l))} |
| 290 | case *keysscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/.UInt8scip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/UInt8#: |
| 291 | return wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.IntAttributescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/IntAttribute#{IntValuescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/IntAttribute#IntValue.: int64(key.Fromscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/UInt8#From().(l))} |
| 292 | case *keysscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/.UInt16scip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/UInt16#: |
| 293 | return wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.IntAttributescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/IntAttribute#{IntValuescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/IntAttribute#IntValue.: int64(key.Fromscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/UInt16#From().(l))} |
| 294 | case *keysscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/.UInt32scip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/UInt32#: |
| 295 | return wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.IntAttributescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/IntAttribute#{IntValuescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/IntAttribute#IntValue.: int64(key.Fromscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/UInt32#From().(l))} |
| 296 | case *keysscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/.UInt64scip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/UInt64#: |
| 297 | return wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.IntAttributescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/IntAttribute#{IntValuescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/IntAttribute#IntValue.: int64(key.Fromscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/UInt64#From().(l))} |
| 298 | case *keysscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/.Float32scip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Float32#: |
| 299 | return wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.DoubleAttributescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/DoubleAttribute#{DoubleValuescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/DoubleAttribute#DoubleValue.: float64(key.Fromscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Float32#From().(l))} |
| 300 | case *keysscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/.Float64scip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Float64#: |
| 301 | return wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.DoubleAttributescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/DoubleAttribute#{DoubleValuescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/DoubleAttribute#DoubleValue.: key.Fromscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Float64#From().(l)} |
| 302 | case *keysscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/.Booleanscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Boolean#: |
| 303 | return wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.BoolAttributescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/BoolAttribute#{BoolValuescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/BoolAttribute#BoolValue.: key.Fromscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Boolean#From().(l)} |
| 304 | case *keysscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/.Stringscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/String#: |
| 305 | return wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.StringAttributescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/StringAttribute#{StringValuescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/StringAttribute#StringValue.: toTruncatableStringscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/toTruncatableString().(key.Fromscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/String#From().(l))} |
| 306 | case *keysscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/.Errorscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Error#: |
| 307 | return wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.StringAttributescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/StringAttribute#{StringValuescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/StringAttribute#StringValue.: toTruncatableStringscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/toTruncatableString().(key.Fromscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Error#From().(l).Error())} |
| 308 | case *keysscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/.Valuescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Value#: |
| 309 | return wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.StringAttributescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/StringAttribute#{StringValuescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/StringAttribute#StringValue.: toTruncatableStringscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/toTruncatableString().(fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Sprintscip-go gomod github.com/golang/go/src go1.24.0 fmt/Sprint().(key.Fromscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Value#From().(l)))} |
| 310 | default: |
| 311 | return wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.StringAttributescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/StringAttribute#{StringValuescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/StringAttribute#StringValue.: toTruncatableStringscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/toTruncatableString().(fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Sprintf().("%T", key))} |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | func convertEventsscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/convertEvents().(events []corescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/core`/.Eventscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/core`/Event#) *wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.TimeEventsscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/TimeEvents# { |
| 316 | //TODO: MessageEvents? |
| 317 | result := make([]wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.TimeEventscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/TimeEvent#, len(events)) |
| 318 | for i, event := range events { |
| 319 | result[i] = convertEventscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/convertEvent().(event) |
| 320 | } |
| 321 | return &wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.TimeEventsscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/TimeEvents#{TimeEventscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/TimeEvents#TimeEvent.: result} |
| 322 | } |
| 323 | |
| 324 | func convertEventscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/convertEvent().(ev corescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/core`/.Eventscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/core`/Event#) wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.TimeEventscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/TimeEvent# { |
| 325 | return wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.TimeEventscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/TimeEvent#{ |
| 326 | Timescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/TimeEvent#Time.: convertTimestampscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/convertTimestamp().(ev.Atscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/core`/Event#At().()), |
| 327 | Annotationscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/TimeEvent#Annotation.: convertAnnotationscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/convertAnnotation().(ev), |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | func getAnnotationDescriptionscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/getAnnotationDescription().(ev corescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/core`/.Eventscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/core`/Event#) (string, int) { |
| 332 | l := ev.Labelscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/core`/Event#Label().(0) |
| 333 | if l.Keyscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/Label#Key().() != keysscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/.Msgscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Msg. { |
| 334 | return "", 0 |
| 335 | } |
| 336 | if msg := keysscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/.Msgscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Msg..Fromscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/String#From().(l); msg != "" { |
| 337 | return msg, 1 |
| 338 | } |
| 339 | l = ev.Labelscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/core`/Event#Label().(1) |
| 340 | if l.Keyscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/Label#Key().() != keysscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/.Errscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Err. { |
| 341 | return "", 1 |
| 342 | } |
| 343 | if err := keysscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/.Errscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Err..Fromscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/keys`/Error#From().(l); err != nil { |
| 344 | return err.Error(), 2 |
| 345 | } |
| 346 | return "", 2 |
| 347 | } |
| 348 | |
| 349 | func convertAnnotationscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/convertAnnotation().(ev corescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/core`/.Eventscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/core`/Event#) *wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.Annotationscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Annotation# { |
| 350 | description, index := getAnnotationDescriptionscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/getAnnotationDescription().(ev) |
| 351 | if _, l := skipToValidLabelscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/skipToValidLabel().(ev, index); !l.Validscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/label`/Label#Valid().() && description == "" { |
| 352 | return nil |
| 353 | } |
| 354 | return &wirescip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/.Annotationscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Annotation#{ |
| 355 | Descriptionscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Annotation#Description.: toTruncatableStringscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/toTruncatableString().(description), |
| 356 | Attributesscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent/wire`/Annotation#Attributes.: convertAttributesscip-go gomod cuelang.org/go . `cuelang.org/go/internal/golangorgx/tools/event/export/ocagent`/convertAttributes().(ev, index), |
| 357 | } |
| 358 | } |