mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-18 13:57:32 +00:00
8609ced24b
* chore(deps): bump k8s.io/apiextensions-apiserver from 0.19.2 to 0.21.3 Bumps [k8s.io/apiextensions-apiserver](https://github.com/kubernetes/apiextensions-apiserver) from 0.19.2 to 0.21.3. - [Release notes](https://github.com/kubernetes/apiextensions-apiserver/releases) - [Commits](https://github.com/kubernetes/apiextensions-apiserver/compare/v0.19.2...v0.21.3) --- updated-dependencies: - dependency-name: k8s.io/apiextensions-apiserver dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * chore(deps): bump google.golang.org/api from 0.34.0 to 0.52.0 Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.34.0 to 0.52.0. - [Release notes](https://github.com/googleapis/google-api-go-client/releases) - [Changelog](https://github.com/googleapis/google-api-go-client/blob/master/CHANGES.md) - [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.34.0...v0.52.0) --- updated-dependencies: - dependency-name: google.golang.org/api dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * start update dependencies * update mods and otlp * fix(build): update to go 1.16 * old version for k8s mods * update k8s versions * update orbos * with batcher * add batch span processor * try with older otel version 0.20 * remove syncer * otel rc2 * fix config Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Stefan Benz <stefan@caos.ch>
46 lines
893 B
Go
46 lines
893 B
Go
package tracing
|
|
|
|
import (
|
|
grpc_errs "github.com/caos/zitadel/internal/api/grpc/errors"
|
|
"go.opentelemetry.io/otel/attribute"
|
|
"go.opentelemetry.io/otel/trace"
|
|
)
|
|
|
|
type Span struct {
|
|
span trace.Span
|
|
opts []trace.SpanEndOption
|
|
}
|
|
|
|
func CreateSpan(span trace.Span) *Span {
|
|
return &Span{span: span, opts: []trace.SpanEndOption{}}
|
|
}
|
|
|
|
func (s *Span) End() {
|
|
if s.span == nil {
|
|
return
|
|
}
|
|
|
|
s.span.End(s.opts...)
|
|
}
|
|
|
|
func (s *Span) EndWithError(err error) {
|
|
s.SetStatusByError(err)
|
|
s.End()
|
|
}
|
|
|
|
func (s *Span) SetStatusByError(err error) {
|
|
if s.span == nil {
|
|
return
|
|
}
|
|
if err != nil {
|
|
// trace.WithErrorStatus(codes.Error)
|
|
s.span.RecordError(err)
|
|
s.span.SetAttributes(
|
|
attribute.KeyValue{},
|
|
)
|
|
}
|
|
|
|
code, msg, id, _ := grpc_errs.ExtractCaosError(err)
|
|
s.span.SetAttributes(attribute.Int("grpc_code", int(code)), attribute.String("grpc_msg", msg), attribute.String("error_id", id))
|
|
}
|