Chore: Add grafana-apiserver (#70721)

* add grafana-apiserver
* remove watchset & move provisioning and http server to background
services
* remove scheme
* otel fixes (#70874)
* remove module ProvideRegistry test
* use certgenerator from apiserver package
* Control collector/pdata from going to v1.0.0-rc8 (as Tempo 1.5.1 would have it)
This commit is contained in:
Todd Treece
2023-07-14 15:22:10 -04:00
committed by GitHub
parent 8ced4343f3
commit 52121b7165
25 changed files with 690 additions and 838 deletions

View File

@@ -11,8 +11,9 @@ import (
"time"
om "github.com/wk8/go-ordered-map"
otlp "go.opentelemetry.io/collector/model/otlp"
otelpdata "go.opentelemetry.io/collector/model/pdata"
"go.opentelemetry.io/collector/model/otlp"
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/ptrace"
)
// KeyVal is an ordered map of string to interface
@@ -142,7 +143,7 @@ func (tc TraceContext) KeyVal() *KeyVal {
// Traces wraps the otel traces model.
type Traces struct {
otelpdata.Traces
ptrace.Traces
}
// UnmarshalJSON unmarshals Traces model.
@@ -163,12 +164,12 @@ func (t Traces) MarshalJSON() ([]byte, error) {
}
// SpanSlice unpacks Traces entity into a slice of Spans.
func (t Traces) SpanSlice() []otelpdata.Span {
spans := make([]otelpdata.Span, 0)
func (t Traces) SpanSlice() []ptrace.Span {
spans := make([]ptrace.Span, 0)
rss := t.ResourceSpans()
for i := 0; i < rss.Len(); i++ {
rs := rss.At(i)
ilss := rs.InstrumentationLibrarySpans()
ilss := rs.ScopeSpans()
for j := 0; j < ilss.Len(); j++ {
s := ilss.At(j).Spans()
for si := 0; si < s.Len(); si++ {
@@ -180,7 +181,7 @@ func (t Traces) SpanSlice() []otelpdata.Span {
}
// SpanToKeyVal returns KeyVal representation of a Span.
func SpanToKeyVal(s otelpdata.Span) *KeyVal {
func SpanToKeyVal(s ptrace.Span) *KeyVal {
kv := NewKeyVal()
if s.StartTimestamp() > 0 {
KeyValAdd(kv, "timestamp", s.StartTimestamp().AsTime().String())
@@ -194,7 +195,7 @@ func SpanToKeyVal(s otelpdata.Span) *KeyVal {
KeyValAdd(kv, "span_kind", s.Kind().String())
KeyValAdd(kv, "name", s.Name())
KeyValAdd(kv, "parent_spanID", s.ParentSpanID().HexString())
s.Attributes().Range(func(k string, v otelpdata.AttributeValue) bool {
s.Attributes().Range(func(k string, v pcommon.Value) bool {
KeyValAdd(kv, "attr_"+k, fmt.Sprintf("%v", v))
return true
})