Port osbuild/images v0.33.0 with dot-notation to composer
Update the osbuild/images to the version which introduces "dot notation" for distro release versions. - Replace all uses of distroregistry by distrofactory. - Delete local version of reporegistry and use the one from the osbuild/images. - Weldr: unify `createWeldrAPI()` and `createWeldrAPI2()` into a single `createTestWeldrAPI()` function`. - store/fixture: rework fixtures to allow overriding the host distro name and host architecture name. A cleanup function to restore the host distro and arch names is always part of the fixture struct. - Delete `distro_mock` package, since it is no longer used. - Bump the required version of osbuild to 98, because the OSCAP customization is using the 'compress_results' stage option, which is not available in older versions of osbuild. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
f6ff8c40dd
commit
625b1578fa
1166 changed files with 154457 additions and 5508 deletions
40
vendor/cloud.google.com/go/internal/.repo-metadata-full.json
generated
vendored
40
vendor/cloud.google.com/go/internal/.repo-metadata-full.json
generated
vendored
|
|
@ -619,6 +619,16 @@
|
|||
"release_level": "stable",
|
||||
"library_type": "GAPIC_AUTO"
|
||||
},
|
||||
"cloud.google.com/go/cloudprofiler/apiv2": {
|
||||
"api_shortname": "cloudprofiler",
|
||||
"distribution_name": "cloud.google.com/go/cloudprofiler/apiv2",
|
||||
"description": "Cloud Profiler API",
|
||||
"language": "go",
|
||||
"client_library_type": "generated",
|
||||
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/cloudprofiler/latest/apiv2",
|
||||
"release_level": "preview",
|
||||
"library_type": "GAPIC_AUTO"
|
||||
},
|
||||
"cloud.google.com/go/cloudtasks/apiv2": {
|
||||
"api_shortname": "cloudtasks",
|
||||
"distribution_name": "cloud.google.com/go/cloudtasks/apiv2",
|
||||
|
|
@ -1019,6 +1029,16 @@
|
|||
"release_level": "stable",
|
||||
"library_type": "GAPIC_AUTO"
|
||||
},
|
||||
"cloud.google.com/go/edgenetwork/apiv1": {
|
||||
"api_shortname": "edgenetwork",
|
||||
"distribution_name": "cloud.google.com/go/edgenetwork/apiv1",
|
||||
"description": "Distributed Cloud Edge Network API",
|
||||
"language": "go",
|
||||
"client_library_type": "generated",
|
||||
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/edgenetwork/latest/apiv1",
|
||||
"release_level": "preview",
|
||||
"library_type": "GAPIC_AUTO"
|
||||
},
|
||||
"cloud.google.com/go/errorreporting": {
|
||||
"api_shortname": "clouderrorreporting",
|
||||
"distribution_name": "cloud.google.com/go/errorreporting",
|
||||
|
|
@ -1099,6 +1119,16 @@
|
|||
"release_level": "stable",
|
||||
"library_type": "GAPIC_AUTO"
|
||||
},
|
||||
"cloud.google.com/go/firestore/apiv1/admin": {
|
||||
"api_shortname": "firestore",
|
||||
"distribution_name": "cloud.google.com/go/firestore/apiv1/admin",
|
||||
"description": "Cloud Firestore API",
|
||||
"language": "go",
|
||||
"client_library_type": "generated",
|
||||
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/firestore/latest/apiv1/admin",
|
||||
"release_level": "stable",
|
||||
"library_type": "GAPIC_AUTO"
|
||||
},
|
||||
"cloud.google.com/go/functions/apiv1": {
|
||||
"api_shortname": "cloudfunctions",
|
||||
"distribution_name": "cloud.google.com/go/functions/apiv1",
|
||||
|
|
@ -2279,6 +2309,16 @@
|
|||
"release_level": "preview",
|
||||
"library_type": "GAPIC_AUTO"
|
||||
},
|
||||
"cloud.google.com/go/telcoautomation/apiv1": {
|
||||
"api_shortname": "telcoautomation",
|
||||
"distribution_name": "cloud.google.com/go/telcoautomation/apiv1",
|
||||
"description": "Telco Automation API",
|
||||
"language": "go",
|
||||
"client_library_type": "generated",
|
||||
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/telcoautomation/latest/apiv1",
|
||||
"release_level": "preview",
|
||||
"library_type": "GAPIC_AUTO"
|
||||
},
|
||||
"cloud.google.com/go/texttospeech/apiv1": {
|
||||
"api_shortname": "texttospeech",
|
||||
"distribution_name": "cloud.google.com/go/texttospeech/apiv1",
|
||||
|
|
|
|||
146
vendor/cloud.google.com/go/internal/trace/trace.go
generated
vendored
146
vendor/cloud.google.com/go/internal/trace/trace.go
generated
vendored
|
|
@ -16,35 +16,94 @@ package trace
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"go.opencensus.io/trace"
|
||||
"golang.org/x/xerrors"
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/codes"
|
||||
ottrace "go.opentelemetry.io/otel/trace"
|
||||
"google.golang.org/api/googleapi"
|
||||
"google.golang.org/genproto/googleapis/rpc/code"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// StartSpan adds a span to the trace with the given name.
|
||||
const (
|
||||
telemetryPlatformTracingOpenCensus = "opencensus"
|
||||
telemetryPlatformTracingOpenTelemetry = "opentelemetry"
|
||||
telemetryPlatformTracingVar = "GOOGLE_API_GO_EXPERIMENTAL_TELEMETRY_PLATFORM_TRACING"
|
||||
)
|
||||
|
||||
var (
|
||||
// TODO(chrisdsmith): Should the name of the OpenTelemetry tracer be public and mutable?
|
||||
openTelemetryTracerName string = "cloud.google.com/go"
|
||||
openTelemetryTracingEnabled bool = strings.EqualFold(strings.TrimSpace(
|
||||
os.Getenv(telemetryPlatformTracingVar)), telemetryPlatformTracingOpenTelemetry)
|
||||
)
|
||||
|
||||
// IsOpenCensusTracingEnabled returns true if the environment variable
|
||||
// GOOGLE_API_GO_EXPERIMENTAL_TELEMETRY_PLATFORM_TRACING is NOT set to the
|
||||
// case-insensitive value "opentelemetry".
|
||||
func IsOpenCensusTracingEnabled() bool {
|
||||
return !IsOpenTelemetryTracingEnabled()
|
||||
}
|
||||
|
||||
// IsOpenTelemetryTracingEnabled returns true if the environment variable
|
||||
// GOOGLE_API_GO_EXPERIMENTAL_TELEMETRY_PLATFORM_TRACING is set to the
|
||||
// case-insensitive value "opentelemetry".
|
||||
func IsOpenTelemetryTracingEnabled() bool {
|
||||
return openTelemetryTracingEnabled
|
||||
}
|
||||
|
||||
// StartSpan adds a span to the trace with the given name. If IsOpenCensusTracingEnabled
|
||||
// returns true, the span will be an OpenCensus span. If IsOpenTelemetryTracingEnabled
|
||||
// returns true, the span will be an OpenTelemetry span. Set the environment variable
|
||||
// GOOGLE_API_GO_EXPERIMENTAL_TELEMETRY_PLATFORM_TRACING to the case-insensitive
|
||||
// value "opentelemetry" before loading the package to use OpenTelemetry tracing.
|
||||
// The default will remain OpenCensus until [TBD], at which time the default will
|
||||
// switch to "opentelemetry" and explicitly setting the environment variable to
|
||||
// "opencensus" will be required to continue using OpenCensus tracing.
|
||||
func StartSpan(ctx context.Context, name string) context.Context {
|
||||
ctx, _ = trace.StartSpan(ctx, name)
|
||||
if IsOpenTelemetryTracingEnabled() {
|
||||
ctx, _ = otel.GetTracerProvider().Tracer(openTelemetryTracerName).Start(ctx, name)
|
||||
} else {
|
||||
ctx, _ = trace.StartSpan(ctx, name)
|
||||
}
|
||||
return ctx
|
||||
}
|
||||
|
||||
// EndSpan ends a span with the given error.
|
||||
// EndSpan ends a span with the given error. If IsOpenCensusTracingEnabled
|
||||
// returns true, the span will be an OpenCensus span. If IsOpenTelemetryTracingEnabled
|
||||
// returns true, the span will be an OpenTelemetry span. Set the environment variable
|
||||
// GOOGLE_API_GO_EXPERIMENTAL_TELEMETRY_PLATFORM_TRACING to the case-insensitive
|
||||
// value "opentelemetry" before loading the package to use OpenTelemetry tracing.
|
||||
// The default will remain OpenCensus until [TBD], at which time the default will
|
||||
// switch to "opentelemetry" and explicitly setting the environment variable to
|
||||
// "opencensus" will be required to continue using OpenCensus tracing.
|
||||
func EndSpan(ctx context.Context, err error) {
|
||||
span := trace.FromContext(ctx)
|
||||
if err != nil {
|
||||
span.SetStatus(toStatus(err))
|
||||
if IsOpenTelemetryTracingEnabled() {
|
||||
span := ottrace.SpanFromContext(ctx)
|
||||
if err != nil {
|
||||
span.SetStatus(codes.Error, toOpenTelemetryStatusDescription(err))
|
||||
span.RecordError(err)
|
||||
}
|
||||
span.End()
|
||||
} else {
|
||||
span := trace.FromContext(ctx)
|
||||
if err != nil {
|
||||
span.SetStatus(toStatus(err))
|
||||
}
|
||||
span.End()
|
||||
}
|
||||
span.End()
|
||||
}
|
||||
|
||||
// toStatus interrogates an error and converts it to an appropriate
|
||||
// OpenCensus status.
|
||||
// toStatus converts an error to an equivalent OpenCensus status.
|
||||
func toStatus(err error) trace.Status {
|
||||
var err2 *googleapi.Error
|
||||
if ok := xerrors.As(err, &err2); ok {
|
||||
if ok := errors.As(err, &err2); ok {
|
||||
return trace.Status{Code: httpStatusCodeToOCCode(err2.Code), Message: err2.Message}
|
||||
} else if s, ok := status.FromError(err); ok {
|
||||
return trace.Status{Code: int32(s.Code()), Message: s.Message()}
|
||||
|
|
@ -53,6 +112,18 @@ func toStatus(err error) trace.Status {
|
|||
}
|
||||
}
|
||||
|
||||
// toOpenTelemetryStatus converts an error to an equivalent OpenTelemetry status description.
|
||||
func toOpenTelemetryStatusDescription(err error) string {
|
||||
var err2 *googleapi.Error
|
||||
if ok := errors.As(err, &err2); ok {
|
||||
return err2.Message
|
||||
} else if s, ok := status.FromError(err); ok {
|
||||
return s.Message()
|
||||
} else {
|
||||
return err.Error()
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(deklerk): switch to using OpenCensus function when it becomes available.
|
||||
// Reference: https://github.com/googleapis/googleapis/blob/26b634d2724ac5dd30ae0b0cbfb01f07f2e4050e/google/rpc/code.proto
|
||||
func httpStatusCodeToOCCode(httpStatusCode int) int32 {
|
||||
|
|
@ -86,10 +157,33 @@ func httpStatusCodeToOCCode(httpStatusCode int) int32 {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: (odeke-em): perhaps just pass around spans due to the cost
|
||||
// incurred from using trace.FromContext(ctx) yet we could avoid
|
||||
// throwing away the work done by ctx, span := trace.StartSpan.
|
||||
// TracePrintf retrieves the current OpenCensus or OpenTelemetry span from context, then:
|
||||
// * calls Span.Annotatef if OpenCensus is enabled; or
|
||||
// * calls Span.AddEvent if OpenTelemetry is enabled.
|
||||
//
|
||||
// If IsOpenCensusTracingEnabled returns true, the expected span must be an
|
||||
// OpenCensus span. If IsOpenTelemetryTracingEnabled returns true, the expected
|
||||
// span must be an OpenTelemetry span. Set the environment variable
|
||||
// GOOGLE_API_GO_EXPERIMENTAL_TELEMETRY_PLATFORM_TRACING to the case-insensitive
|
||||
// value "opentelemetry" before loading the package to use OpenTelemetry tracing.
|
||||
// The default will remain OpenCensus until [TBD], at which time the default will
|
||||
// switch to "opentelemetry" and explicitly setting the environment variable to
|
||||
// "opencensus" will be required to continue using OpenCensus tracing.
|
||||
func TracePrintf(ctx context.Context, attrMap map[string]interface{}, format string, args ...interface{}) {
|
||||
if IsOpenTelemetryTracingEnabled() {
|
||||
attrs := otAttrs(attrMap)
|
||||
ottrace.SpanFromContext(ctx).AddEvent(fmt.Sprintf(format, args...), ottrace.WithAttributes(attrs...))
|
||||
} else {
|
||||
attrs := ocAttrs(attrMap)
|
||||
// TODO: (odeke-em): perhaps just pass around spans due to the cost
|
||||
// incurred from using trace.FromContext(ctx) yet we could avoid
|
||||
// throwing away the work done by ctx, span := trace.StartSpan.
|
||||
trace.FromContext(ctx).Annotatef(attrs, format, args...)
|
||||
}
|
||||
}
|
||||
|
||||
// ocAttrs converts a generic map to OpenCensus attributes.
|
||||
func ocAttrs(attrMap map[string]interface{}) []trace.Attribute {
|
||||
var attrs []trace.Attribute
|
||||
for k, v := range attrMap {
|
||||
var a trace.Attribute
|
||||
|
|
@ -107,5 +201,27 @@ func TracePrintf(ctx context.Context, attrMap map[string]interface{}, format str
|
|||
}
|
||||
attrs = append(attrs, a)
|
||||
}
|
||||
trace.FromContext(ctx).Annotatef(attrs, format, args...)
|
||||
return attrs
|
||||
}
|
||||
|
||||
// otAttrs converts a generic map to OpenTelemetry attributes.
|
||||
func otAttrs(attrMap map[string]interface{}) []attribute.KeyValue {
|
||||
var attrs []attribute.KeyValue
|
||||
for k, v := range attrMap {
|
||||
var a attribute.KeyValue
|
||||
switch v := v.(type) {
|
||||
case string:
|
||||
a = attribute.Key(k).String(v)
|
||||
case bool:
|
||||
a = attribute.Key(k).Bool(v)
|
||||
case int:
|
||||
a = attribute.Key(k).Int(v)
|
||||
case int64:
|
||||
a = attribute.Key(k).Int64(v)
|
||||
default:
|
||||
a = attribute.Key(k).String(fmt.Sprintf("%#v", v))
|
||||
}
|
||||
attrs = append(attrs, a)
|
||||
}
|
||||
return attrs
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue