Documentation
¶
Overview ¶
* * Copyright 2021 Comcast Cable Communications Management, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-License-Identifier: Apache-2.0
* * Copyright 2021 Comcast Cable Communications Management, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-License-Identifier: Apache-2.0
* * Copyright 2021 Comcast Cable Communications Management, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-License-Identifier: Apache-2.0
* * Copyright 2021 Comcast Cable Communications Management, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- func EndOtelSpan(xpcTracer *XpcTracer, span oteltrace.Span)
- func GetContext(ctx context.Context, key string) interface{}
- func NewOtelSpan(xpcTracer *XpcTracer, r *http.Request) (context.Context, oteltrace.Span)
- func NoopSetSpan(fields log.Fields, tag string)
- func OtelSetSpan(fields log.Fields, tag string)
- func SetContext(ctx context.Context, ctxName string, ctxValue interface{}) context.Context
- func SetSpanMoracideTags(fields log.Fields, moracideTagPrefix string)
- func SetSpanStatusCode(fields log.Fields)
- type SpanSetterFunc
- type XpcTrace
- type XpcTracer
- func (t *XpcTracer) AppEnv() string
- func (t *XpcTracer) AppName() string
- func (t *XpcTracer) AppVersion() string
- func (t *XpcTracer) MoracideTagPrefix() string
- func (t *XpcTracer) OtelOpName() string
- func (t *XpcTracer) OtelTracerProvider() oteltrace.TracerProvider
- func (t *XpcTracer) Region() string
Constants ¶
const ( AuditIDHeader = "X-Auditid" UserAgentHeader = "User-Agent" DefaultMoracideTagPrefix = "X-Cl-Experiment" )
Variables ¶
This section is empty.
Functions ¶
func EndOtelSpan ¶
func GetContext ¶
GetContext - getting context value from context
func NewOtelSpan ¶
func NoopSetSpan ¶
func OtelSetSpan ¶
func SetContext ¶
SetContext - setting context for logging
func SetSpanMoracideTags ¶
func SetSpanStatusCode ¶
Types ¶
type SpanSetterFunc ¶
type XpcTrace ¶
type XpcTrace struct {
ReqMoracideTag string
ReqTraceparent string
ReqTracestate string
OutTraceparent string
OutTracestate string
// These are not useful as of now, just set them for the sake of completion and future
AuditID string
MoneyTrace string
ReqUserAgent string
OutUserAgent string
TraceID string // use the value in outTraceparent, otherwise MoneyTrace
// contains filtered or unexported fields
}
XpcTrace is a carrier/baggage struct to extract data from spans, request headers for usage later Store the trace in ctx for easy retrieval. Ideal place to store it is ofc, xw But because of legacy reasons, xw is not always available in the API flow
type XpcTracer ¶
type XpcTracer struct {
OtelEnabled bool
SetSpan SpanSetterFunc
// contains filtered or unexported fields
}
XpcTracer is a wrapper around tracer setup
func NewXpcTracer ¶
func NewXpcTracer(conf *configuration.Config) *XpcTracer
func (*XpcTracer) AppVersion ¶
func (*XpcTracer) MoracideTagPrefix ¶
func (*XpcTracer) OtelOpName ¶
otelOpName should return "http.request" by default
func (*XpcTracer) OtelTracerProvider ¶
func (t *XpcTracer) OtelTracerProvider() oteltrace.TracerProvider