MCPcopy Create free account
hub / github.com/InferCore/InferCore / normalizeOTLPBaseURL

Function normalizeOTLPBaseURL

internal/telemetry/otel_otlp_exporter.go:103–122  ·  view source on GitHub ↗
(raw string)

Source from the content-addressed store, hash-verified

101}
102
103func normalizeOTLPBaseURL(raw string) (string, error) {
104 raw = strings.TrimSpace(raw)
105 if raw == "" {
106 return "", fmt.Errorf("empty otlp endpoint")
107 }
108 u, err := url.Parse(raw)
109 if err != nil {
110 return "", err
111 }
112 if u.Scheme == "" {
113 u, err = url.Parse("http://" + raw)
114 if err != nil {
115 return "", err
116 }
117 }
118 if u.Host == "" {
119 return "", fmt.Errorf("invalid otlp endpoint host in %q", raw)
120 }
121 return strings.TrimRight(fmt.Sprintf("%s://%s", u.Scheme, u.Host), "/"), nil
122}
123
124func (e *OtelOTLPExporter) EmitMetric(name string, value float64, labels map[string]string) {
125 e.mu.Lock()

Callers 1

NewOtelOTLPExporterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected