From cee2bfea8906c6604a85a41dd4bea3d934de2d7b Mon Sep 17 00:00:00 2001 From: Daniel OBrien Date: Thu, 16 May 2024 08:46:51 -0400 Subject: [PATCH] vendor cleanup --- go.mod | 14 +- go.sum | 31 - vendor/dagger.io/dagger/.changie.yaml | 40 - vendor/dagger.io/dagger/.gitattributes | 1 - vendor/dagger.io/dagger/.gitignore | 1 - vendor/dagger.io/dagger/CHANGELOG.md | 578 -- vendor/dagger.io/dagger/LICENSE | 191 - vendor/dagger.io/dagger/README.md | 22 - vendor/dagger.io/dagger/client.go | 172 - vendor/dagger.io/dagger/dagger.gen.go | 6967 ----------------- vendor/dagger.io/dagger/fs.go | 19 - vendor/dagger.io/dagger/generate.go | 3 - vendor/dagger.io/dagger/go.mod | 45 - vendor/dagger.io/dagger/go.sum | 89 - .../dagger/internal/engineconn/cli.go | 329 - .../dagger/internal/engineconn/engineconn.go | 107 - .../dagger/internal/engineconn/env.go | 47 - .../dagger/internal/engineconn/session.go | 277 - .../dagger/internal/engineconn/version.gen.go | 5 - .../dagger.io/dagger/querybuilder/marshal.go | 162 - .../dagger/querybuilder/querybuilder.go | 204 - vendor/dagger.io/dagger/telemetry/attrs.go | 31 - .../dagger/telemetry/batch_processor.go | 455 -- vendor/dagger.io/dagger/telemetry/init.go | 251 - .../dagger.io/dagger/telemetry/processor.go | 139 - vendor/dagger.io/dagger/telemetry/proxy.go | 94 - vendor/dagger.io/dagger/telemetry/span.go | 33 - vendor/github.com/99designs/gqlgen/LICENSE | 19 - .../99designs/gqlgen/graphql/any.go | 19 - .../99designs/gqlgen/graphql/bool.go | 27 - .../99designs/gqlgen/graphql/cache.go | 29 - .../99designs/gqlgen/graphql/coercion.go | 56 - .../99designs/gqlgen/graphql/context_field.go | 113 - .../gqlgen/graphql/context_operation.go | 125 - .../99designs/gqlgen/graphql/context_path.go | 77 - .../gqlgen/graphql/context_response.go | 161 - .../gqlgen/graphql/context_root_field.go | 25 - .../99designs/gqlgen/graphql/deferred.go | 26 - .../99designs/gqlgen/graphql/duration.go | 27 - .../99designs/gqlgen/graphql/error.go | 33 - .../gqlgen/graphql/executable_schema.go | 211 - .../gqlgen/graphql/executable_schema_mock.go | 175 - .../99designs/gqlgen/graphql/fieldset.go | 70 - .../99designs/gqlgen/graphql/float.go | 47 - .../99designs/gqlgen/graphql/handler.go | 131 - .../github.com/99designs/gqlgen/graphql/id.go | 58 - .../99designs/gqlgen/graphql/input.go | 55 - .../99designs/gqlgen/graphql/int.go | 79 - .../99designs/gqlgen/graphql/jsonw.go | 93 - .../99designs/gqlgen/graphql/map.go | 24 - .../99designs/gqlgen/graphql/omittable.go | 58 - .../99designs/gqlgen/graphql/oneshot.go | 16 - .../99designs/gqlgen/graphql/recovery.go | 20 - .../99designs/gqlgen/graphql/response.go | 28 - .../99designs/gqlgen/graphql/root.go | 7 - .../99designs/gqlgen/graphql/stats.go | 60 - .../99designs/gqlgen/graphql/string.go | 73 - .../99designs/gqlgen/graphql/time.go | 25 - .../99designs/gqlgen/graphql/uint.go | 106 - .../99designs/gqlgen/graphql/upload.go | 27 - .../99designs/gqlgen/graphql/uuid.go | 25 - .../99designs/gqlgen/graphql/version.go | 3 - vendor/github.com/Khan/genqlient/LICENSE | 22 - .../Khan/genqlient/graphql/client.go | 241 - .../github.com/Khan/genqlient/graphql/util.go | 42 - vendor/github.com/adrg/xdg/CODE_OF_CONDUCT.md | 77 - vendor/github.com/adrg/xdg/CONTRIBUTING.md | 135 - vendor/github.com/adrg/xdg/LICENSE | 21 - vendor/github.com/adrg/xdg/README.md | 280 - vendor/github.com/adrg/xdg/base_dirs.go | 68 - vendor/github.com/adrg/xdg/codecov.yml | 11 - vendor/github.com/adrg/xdg/doc.go | 99 - .../adrg/xdg/internal/pathutil/pathutil.go | 78 - .../xdg/internal/pathutil/pathutil_plan9.go | 29 - .../xdg/internal/pathutil/pathutil_unix.go | 32 - .../xdg/internal/pathutil/pathutil_windows.go | 64 - vendor/github.com/adrg/xdg/paths_darwin.go | 60 - vendor/github.com/adrg/xdg/paths_plan9.go | 55 - vendor/github.com/adrg/xdg/paths_unix.go | 71 - vendor/github.com/adrg/xdg/paths_windows.go | 168 - vendor/github.com/adrg/xdg/user_dirs.go | 40 - vendor/github.com/adrg/xdg/xdg.go | 218 - vendor/github.com/go-logr/logr/.golangci.yaml | 26 - vendor/github.com/go-logr/logr/CHANGELOG.md | 6 - .../github.com/go-logr/logr/CONTRIBUTING.md | 17 - vendor/github.com/go-logr/logr/LICENSE | 201 - vendor/github.com/go-logr/logr/README.md | 406 - vendor/github.com/go-logr/logr/SECURITY.md | 18 - vendor/github.com/go-logr/logr/context.go | 33 - .../github.com/go-logr/logr/context_noslog.go | 49 - .../github.com/go-logr/logr/context_slog.go | 83 - vendor/github.com/go-logr/logr/discard.go | 24 - vendor/github.com/go-logr/logr/funcr/funcr.go | 911 --- .../github.com/go-logr/logr/funcr/slogsink.go | 105 - vendor/github.com/go-logr/logr/logr.go | 520 -- vendor/github.com/go-logr/logr/sloghandler.go | 192 - vendor/github.com/go-logr/logr/slogr.go | 100 - vendor/github.com/go-logr/logr/slogsink.go | 120 - vendor/github.com/go-logr/stdr/LICENSE | 201 - vendor/github.com/go-logr/stdr/README.md | 6 - vendor/github.com/go-logr/stdr/stdr.go | 170 - vendor/github.com/google/uuid/CHANGELOG.md | 41 - vendor/github.com/google/uuid/CONTRIBUTING.md | 26 - vendor/github.com/google/uuid/CONTRIBUTORS | 9 - vendor/github.com/google/uuid/LICENSE | 27 - vendor/github.com/google/uuid/README.md | 21 - vendor/github.com/google/uuid/dce.go | 80 - vendor/github.com/google/uuid/doc.go | 12 - vendor/github.com/google/uuid/hash.go | 59 - vendor/github.com/google/uuid/marshal.go | 38 - vendor/github.com/google/uuid/node.go | 90 - vendor/github.com/google/uuid/node_js.go | 12 - vendor/github.com/google/uuid/node_net.go | 33 - vendor/github.com/google/uuid/null.go | 118 - vendor/github.com/google/uuid/sql.go | 59 - vendor/github.com/google/uuid/time.go | 134 - vendor/github.com/google/uuid/util.go | 43 - vendor/github.com/google/uuid/uuid.go | 365 - vendor/github.com/google/uuid/version1.go | 44 - vendor/github.com/google/uuid/version4.go | 76 - vendor/github.com/google/uuid/version6.go | 56 - vendor/github.com/google/uuid/version7.go | 104 - .../github.com/mitchellh/go-homedir/LICENSE | 21 - .../github.com/mitchellh/go-homedir/README.md | 14 - .../mitchellh/go-homedir/homedir.go | 167 - vendor/github.com/sosodev/duration/.gitignore | 1 - vendor/github.com/sosodev/duration/LICENSE | 21 - .../github.com/sosodev/duration/duration.go | 301 - vendor/github.com/sosodev/duration/readme.md | 54 - vendor/github.com/vektah/gqlparser/v2/LICENSE | 19 - .../vektah/gqlparser/v2/ast/argmap.go | 37 - .../vektah/gqlparser/v2/ast/collections.go | 148 - .../vektah/gqlparser/v2/ast/comment.go | 31 - .../vektah/gqlparser/v2/ast/decode.go | 216 - .../vektah/gqlparser/v2/ast/definition.go | 110 - .../vektah/gqlparser/v2/ast/directive.go | 43 - .../vektah/gqlparser/v2/ast/document.go | 88 - .../vektah/gqlparser/v2/ast/dumper.go | 159 - .../vektah/gqlparser/v2/ast/fragment.go | 41 - .../vektah/gqlparser/v2/ast/operation.go | 32 - .../vektah/gqlparser/v2/ast/path.go | 70 - .../vektah/gqlparser/v2/ast/selection.go | 41 - .../vektah/gqlparser/v2/ast/source.go | 19 - .../vektah/gqlparser/v2/ast/type.go | 68 - .../vektah/gqlparser/v2/ast/value.go | 122 - .../vektah/gqlparser/v2/gqlerror/error.go | 186 - .../go.opentelemetry.io/otel/.codespellignore | 7 - vendor/go.opentelemetry.io/otel/.codespellrc | 10 - .../go.opentelemetry.io/otel/.gitattributes | 3 - vendor/go.opentelemetry.io/otel/.gitignore | 22 - vendor/go.opentelemetry.io/otel/.gitmodules | 3 - vendor/go.opentelemetry.io/otel/.golangci.yml | 296 - vendor/go.opentelemetry.io/otel/.lycheeignore | 6 - .../otel/.markdownlint.yaml | 29 - vendor/go.opentelemetry.io/otel/CHANGELOG.md | 2939 ------- vendor/go.opentelemetry.io/otel/CODEOWNERS | 17 - .../go.opentelemetry.io/otel/CONTRIBUTING.md | 645 -- vendor/go.opentelemetry.io/otel/LICENSE | 201 - vendor/go.opentelemetry.io/otel/Makefile | 318 - vendor/go.opentelemetry.io/otel/README.md | 112 - vendor/go.opentelemetry.io/otel/RELEASING.md | 139 - vendor/go.opentelemetry.io/otel/VERSIONING.md | 224 - .../go.opentelemetry.io/otel/attribute/doc.go | 16 - .../otel/attribute/encoder.go | 146 - .../otel/attribute/filter.go | 60 - .../otel/attribute/iterator.go | 161 - .../go.opentelemetry.io/otel/attribute/key.go | 134 - .../go.opentelemetry.io/otel/attribute/kv.go | 86 - .../go.opentelemetry.io/otel/attribute/set.go | 452 -- .../otel/attribute/type_string.go | 31 - .../otel/attribute/value.go | 270 - .../otel/baggage/baggage.go | 744 -- .../otel/baggage/context.go | 39 - .../go.opentelemetry.io/otel/baggage/doc.go | 20 - .../go.opentelemetry.io/otel/codes/codes.go | 116 - vendor/go.opentelemetry.io/otel/codes/doc.go | 21 - vendor/go.opentelemetry.io/otel/doc.go | 34 - .../go.opentelemetry.io/otel/error_handler.go | 38 - .../go.opentelemetry.io/otel/get_main_pkgs.sh | 41 - vendor/go.opentelemetry.io/otel/handler.go | 48 - .../otel/internal/attribute/attribute.go | 111 - .../otel/internal/baggage/baggage.go | 43 - .../otel/internal/baggage/context.go | 92 - .../go.opentelemetry.io/otel/internal/gen.go | 29 - .../otel/internal/global/handler.go | 102 - .../otel/internal/global/instruments.go | 371 - .../otel/internal/global/internal_logging.go | 69 - .../otel/internal/global/meter.go | 356 - .../otel/internal/global/propagator.go | 82 - .../otel/internal/global/state.go | 156 - .../otel/internal/global/trace.go | 199 - .../otel/internal/rawhelpers.go | 55 - .../otel/internal_logging.go | 26 - vendor/go.opentelemetry.io/otel/metric.go | 53 - .../go.opentelemetry.io/otel/metric/LICENSE | 201 - .../otel/metric/asyncfloat64.go | 271 - .../otel/metric/asyncint64.go | 269 - .../go.opentelemetry.io/otel/metric/config.go | 92 - vendor/go.opentelemetry.io/otel/metric/doc.go | 170 - .../otel/metric/embedded/embedded.go | 234 - .../otel/metric/instrument.go | 357 - .../go.opentelemetry.io/otel/metric/meter.go | 212 - .../otel/metric/syncfloat64.go | 185 - .../otel/metric/syncint64.go | 185 - .../go.opentelemetry.io/otel/propagation.go | 31 - .../otel/propagation/baggage.go | 58 - .../otel/propagation/doc.go | 24 - .../otel/propagation/propagation.go | 153 - .../otel/propagation/trace_context.go | 167 - .../go.opentelemetry.io/otel/requirements.txt | 1 - vendor/go.opentelemetry.io/otel/trace.go | 47 - vendor/go.opentelemetry.io/otel/trace/LICENSE | 201 - .../go.opentelemetry.io/otel/trace/config.go | 334 - .../go.opentelemetry.io/otel/trace/context.go | 61 - vendor/go.opentelemetry.io/otel/trace/doc.go | 130 - .../otel/trace/embedded/embedded.go | 56 - .../otel/trace/nonrecording.go | 27 - vendor/go.opentelemetry.io/otel/trace/noop.go | 93 - .../go.opentelemetry.io/otel/trace/trace.go | 577 -- .../otel/trace/tracestate.go | 331 - .../otel/verify_examples.sh | 85 - vendor/go.opentelemetry.io/otel/version.go | 20 - vendor/go.opentelemetry.io/otel/versions.yaml | 56 - vendor/golang.org/x/sync/LICENSE | 27 - vendor/golang.org/x/sync/PATENTS | 22 - vendor/golang.org/x/sync/errgroup/errgroup.go | 135 - vendor/golang.org/x/sync/errgroup/go120.go | 13 - .../golang.org/x/sync/errgroup/pre_go120.go | 14 - vendor/modules.txt | 57 +- 229 files changed, 3 insertions(+), 34955 deletions(-) delete mode 100644 vendor/dagger.io/dagger/.changie.yaml delete mode 100644 vendor/dagger.io/dagger/.gitattributes delete mode 100644 vendor/dagger.io/dagger/.gitignore delete mode 100644 vendor/dagger.io/dagger/CHANGELOG.md delete mode 100644 vendor/dagger.io/dagger/LICENSE delete mode 100644 vendor/dagger.io/dagger/README.md delete mode 100644 vendor/dagger.io/dagger/client.go delete mode 100644 vendor/dagger.io/dagger/dagger.gen.go delete mode 100644 vendor/dagger.io/dagger/fs.go delete mode 100644 vendor/dagger.io/dagger/generate.go delete mode 100644 vendor/dagger.io/dagger/go.mod delete mode 100644 vendor/dagger.io/dagger/go.sum delete mode 100644 vendor/dagger.io/dagger/internal/engineconn/cli.go delete mode 100644 vendor/dagger.io/dagger/internal/engineconn/engineconn.go delete mode 100644 vendor/dagger.io/dagger/internal/engineconn/env.go delete mode 100644 vendor/dagger.io/dagger/internal/engineconn/session.go delete mode 100644 vendor/dagger.io/dagger/internal/engineconn/version.gen.go delete mode 100644 vendor/dagger.io/dagger/querybuilder/marshal.go delete mode 100644 vendor/dagger.io/dagger/querybuilder/querybuilder.go delete mode 100644 vendor/dagger.io/dagger/telemetry/attrs.go delete mode 100644 vendor/dagger.io/dagger/telemetry/batch_processor.go delete mode 100644 vendor/dagger.io/dagger/telemetry/init.go delete mode 100644 vendor/dagger.io/dagger/telemetry/processor.go delete mode 100644 vendor/dagger.io/dagger/telemetry/proxy.go delete mode 100644 vendor/dagger.io/dagger/telemetry/span.go delete mode 100644 vendor/github.com/99designs/gqlgen/LICENSE delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/any.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/bool.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/cache.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/coercion.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/context_field.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/context_operation.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/context_path.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/context_response.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/context_root_field.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/deferred.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/duration.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/error.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/executable_schema.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/executable_schema_mock.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/fieldset.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/float.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/handler.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/id.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/input.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/int.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/jsonw.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/map.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/omittable.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/oneshot.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/recovery.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/response.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/root.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/stats.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/string.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/time.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/uint.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/upload.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/uuid.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/version.go delete mode 100644 vendor/github.com/Khan/genqlient/LICENSE delete mode 100644 vendor/github.com/Khan/genqlient/graphql/client.go delete mode 100644 vendor/github.com/Khan/genqlient/graphql/util.go delete mode 100644 vendor/github.com/adrg/xdg/CODE_OF_CONDUCT.md delete mode 100644 vendor/github.com/adrg/xdg/CONTRIBUTING.md delete mode 100644 vendor/github.com/adrg/xdg/LICENSE delete mode 100644 vendor/github.com/adrg/xdg/README.md delete mode 100644 vendor/github.com/adrg/xdg/base_dirs.go delete mode 100644 vendor/github.com/adrg/xdg/codecov.yml delete mode 100644 vendor/github.com/adrg/xdg/doc.go delete mode 100644 vendor/github.com/adrg/xdg/internal/pathutil/pathutil.go delete mode 100644 vendor/github.com/adrg/xdg/internal/pathutil/pathutil_plan9.go delete mode 100644 vendor/github.com/adrg/xdg/internal/pathutil/pathutil_unix.go delete mode 100644 vendor/github.com/adrg/xdg/internal/pathutil/pathutil_windows.go delete mode 100644 vendor/github.com/adrg/xdg/paths_darwin.go delete mode 100644 vendor/github.com/adrg/xdg/paths_plan9.go delete mode 100644 vendor/github.com/adrg/xdg/paths_unix.go delete mode 100644 vendor/github.com/adrg/xdg/paths_windows.go delete mode 100644 vendor/github.com/adrg/xdg/user_dirs.go delete mode 100644 vendor/github.com/adrg/xdg/xdg.go delete mode 100644 vendor/github.com/go-logr/logr/.golangci.yaml delete mode 100644 vendor/github.com/go-logr/logr/CHANGELOG.md delete mode 100644 vendor/github.com/go-logr/logr/CONTRIBUTING.md delete mode 100644 vendor/github.com/go-logr/logr/LICENSE delete mode 100644 vendor/github.com/go-logr/logr/README.md delete mode 100644 vendor/github.com/go-logr/logr/SECURITY.md delete mode 100644 vendor/github.com/go-logr/logr/context.go delete mode 100644 vendor/github.com/go-logr/logr/context_noslog.go delete mode 100644 vendor/github.com/go-logr/logr/context_slog.go delete mode 100644 vendor/github.com/go-logr/logr/discard.go delete mode 100644 vendor/github.com/go-logr/logr/funcr/funcr.go delete mode 100644 vendor/github.com/go-logr/logr/funcr/slogsink.go delete mode 100644 vendor/github.com/go-logr/logr/logr.go delete mode 100644 vendor/github.com/go-logr/logr/sloghandler.go delete mode 100644 vendor/github.com/go-logr/logr/slogr.go delete mode 100644 vendor/github.com/go-logr/logr/slogsink.go delete mode 100644 vendor/github.com/go-logr/stdr/LICENSE delete mode 100644 vendor/github.com/go-logr/stdr/README.md delete mode 100644 vendor/github.com/go-logr/stdr/stdr.go delete mode 100644 vendor/github.com/google/uuid/CHANGELOG.md delete mode 100644 vendor/github.com/google/uuid/CONTRIBUTING.md delete mode 100644 vendor/github.com/google/uuid/CONTRIBUTORS delete mode 100644 vendor/github.com/google/uuid/LICENSE delete mode 100644 vendor/github.com/google/uuid/README.md delete mode 100644 vendor/github.com/google/uuid/dce.go delete mode 100644 vendor/github.com/google/uuid/doc.go delete mode 100644 vendor/github.com/google/uuid/hash.go delete mode 100644 vendor/github.com/google/uuid/marshal.go delete mode 100644 vendor/github.com/google/uuid/node.go delete mode 100644 vendor/github.com/google/uuid/node_js.go delete mode 100644 vendor/github.com/google/uuid/node_net.go delete mode 100644 vendor/github.com/google/uuid/null.go delete mode 100644 vendor/github.com/google/uuid/sql.go delete mode 100644 vendor/github.com/google/uuid/time.go delete mode 100644 vendor/github.com/google/uuid/util.go delete mode 100644 vendor/github.com/google/uuid/uuid.go delete mode 100644 vendor/github.com/google/uuid/version1.go delete mode 100644 vendor/github.com/google/uuid/version4.go delete mode 100644 vendor/github.com/google/uuid/version6.go delete mode 100644 vendor/github.com/google/uuid/version7.go delete mode 100644 vendor/github.com/mitchellh/go-homedir/LICENSE delete mode 100644 vendor/github.com/mitchellh/go-homedir/README.md delete mode 100644 vendor/github.com/mitchellh/go-homedir/homedir.go delete mode 100644 vendor/github.com/sosodev/duration/.gitignore delete mode 100644 vendor/github.com/sosodev/duration/LICENSE delete mode 100644 vendor/github.com/sosodev/duration/duration.go delete mode 100644 vendor/github.com/sosodev/duration/readme.md delete mode 100644 vendor/github.com/vektah/gqlparser/v2/LICENSE delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/argmap.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/collections.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/comment.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/decode.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/definition.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/directive.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/document.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/dumper.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/fragment.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/operation.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/path.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/selection.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/source.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/type.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/value.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/gqlerror/error.go delete mode 100644 vendor/go.opentelemetry.io/otel/.codespellignore delete mode 100644 vendor/go.opentelemetry.io/otel/.codespellrc delete mode 100644 vendor/go.opentelemetry.io/otel/.gitattributes delete mode 100644 vendor/go.opentelemetry.io/otel/.gitignore delete mode 100644 vendor/go.opentelemetry.io/otel/.gitmodules delete mode 100644 vendor/go.opentelemetry.io/otel/.golangci.yml delete mode 100644 vendor/go.opentelemetry.io/otel/.lycheeignore delete mode 100644 vendor/go.opentelemetry.io/otel/.markdownlint.yaml delete mode 100644 vendor/go.opentelemetry.io/otel/CHANGELOG.md delete mode 100644 vendor/go.opentelemetry.io/otel/CODEOWNERS delete mode 100644 vendor/go.opentelemetry.io/otel/CONTRIBUTING.md delete mode 100644 vendor/go.opentelemetry.io/otel/LICENSE delete mode 100644 vendor/go.opentelemetry.io/otel/Makefile delete mode 100644 vendor/go.opentelemetry.io/otel/README.md delete mode 100644 vendor/go.opentelemetry.io/otel/RELEASING.md delete mode 100644 vendor/go.opentelemetry.io/otel/VERSIONING.md delete mode 100644 vendor/go.opentelemetry.io/otel/attribute/doc.go delete mode 100644 vendor/go.opentelemetry.io/otel/attribute/encoder.go delete mode 100644 vendor/go.opentelemetry.io/otel/attribute/filter.go delete mode 100644 vendor/go.opentelemetry.io/otel/attribute/iterator.go delete mode 100644 vendor/go.opentelemetry.io/otel/attribute/key.go delete mode 100644 vendor/go.opentelemetry.io/otel/attribute/kv.go delete mode 100644 vendor/go.opentelemetry.io/otel/attribute/set.go delete mode 100644 vendor/go.opentelemetry.io/otel/attribute/type_string.go delete mode 100644 vendor/go.opentelemetry.io/otel/attribute/value.go delete mode 100644 vendor/go.opentelemetry.io/otel/baggage/baggage.go delete mode 100644 vendor/go.opentelemetry.io/otel/baggage/context.go delete mode 100644 vendor/go.opentelemetry.io/otel/baggage/doc.go delete mode 100644 vendor/go.opentelemetry.io/otel/codes/codes.go delete mode 100644 vendor/go.opentelemetry.io/otel/codes/doc.go delete mode 100644 vendor/go.opentelemetry.io/otel/doc.go delete mode 100644 vendor/go.opentelemetry.io/otel/error_handler.go delete mode 100644 vendor/go.opentelemetry.io/otel/get_main_pkgs.sh delete mode 100644 vendor/go.opentelemetry.io/otel/handler.go delete mode 100644 vendor/go.opentelemetry.io/otel/internal/attribute/attribute.go delete mode 100644 vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go delete mode 100644 vendor/go.opentelemetry.io/otel/internal/baggage/context.go delete mode 100644 vendor/go.opentelemetry.io/otel/internal/gen.go delete mode 100644 vendor/go.opentelemetry.io/otel/internal/global/handler.go delete mode 100644 vendor/go.opentelemetry.io/otel/internal/global/instruments.go delete mode 100644 vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go delete mode 100644 vendor/go.opentelemetry.io/otel/internal/global/meter.go delete mode 100644 vendor/go.opentelemetry.io/otel/internal/global/propagator.go delete mode 100644 vendor/go.opentelemetry.io/otel/internal/global/state.go delete mode 100644 vendor/go.opentelemetry.io/otel/internal/global/trace.go delete mode 100644 vendor/go.opentelemetry.io/otel/internal/rawhelpers.go delete mode 100644 vendor/go.opentelemetry.io/otel/internal_logging.go delete mode 100644 vendor/go.opentelemetry.io/otel/metric.go delete mode 100644 vendor/go.opentelemetry.io/otel/metric/LICENSE delete mode 100644 vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go delete mode 100644 vendor/go.opentelemetry.io/otel/metric/asyncint64.go delete mode 100644 vendor/go.opentelemetry.io/otel/metric/config.go delete mode 100644 vendor/go.opentelemetry.io/otel/metric/doc.go delete mode 100644 vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go delete mode 100644 vendor/go.opentelemetry.io/otel/metric/instrument.go delete mode 100644 vendor/go.opentelemetry.io/otel/metric/meter.go delete mode 100644 vendor/go.opentelemetry.io/otel/metric/syncfloat64.go delete mode 100644 vendor/go.opentelemetry.io/otel/metric/syncint64.go delete mode 100644 vendor/go.opentelemetry.io/otel/propagation.go delete mode 100644 vendor/go.opentelemetry.io/otel/propagation/baggage.go delete mode 100644 vendor/go.opentelemetry.io/otel/propagation/doc.go delete mode 100644 vendor/go.opentelemetry.io/otel/propagation/propagation.go delete mode 100644 vendor/go.opentelemetry.io/otel/propagation/trace_context.go delete mode 100644 vendor/go.opentelemetry.io/otel/requirements.txt delete mode 100644 vendor/go.opentelemetry.io/otel/trace.go delete mode 100644 vendor/go.opentelemetry.io/otel/trace/LICENSE delete mode 100644 vendor/go.opentelemetry.io/otel/trace/config.go delete mode 100644 vendor/go.opentelemetry.io/otel/trace/context.go delete mode 100644 vendor/go.opentelemetry.io/otel/trace/doc.go delete mode 100644 vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go delete mode 100644 vendor/go.opentelemetry.io/otel/trace/nonrecording.go delete mode 100644 vendor/go.opentelemetry.io/otel/trace/noop.go delete mode 100644 vendor/go.opentelemetry.io/otel/trace/trace.go delete mode 100644 vendor/go.opentelemetry.io/otel/trace/tracestate.go delete mode 100644 vendor/go.opentelemetry.io/otel/verify_examples.sh delete mode 100644 vendor/go.opentelemetry.io/otel/version.go delete mode 100644 vendor/go.opentelemetry.io/otel/versions.yaml delete mode 100644 vendor/golang.org/x/sync/LICENSE delete mode 100644 vendor/golang.org/x/sync/PATENTS delete mode 100644 vendor/golang.org/x/sync/errgroup/errgroup.go delete mode 100644 vendor/golang.org/x/sync/errgroup/go120.go delete mode 100644 vendor/golang.org/x/sync/errgroup/pre_go120.go diff --git a/go.mod b/go.mod index 4147a61d..eabdeb8a 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,6 @@ module github.com/launchdarkly/ld-find-code-refs/v2 go 1.21 require ( - dagger.io/dagger v0.11.4 github.com/bmatcuk/doublestar/v4 v4.6.1 github.com/go-git/go-git/v5 v5.10.1 github.com/hashicorp/go-retryablehttp v0.7.5 @@ -22,11 +21,8 @@ require ( require ( dario.cat/mergo v1.0.0 // indirect - github.com/99designs/gqlgen v0.17.44 // indirect - github.com/Khan/genqlient v0.7.0 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect - github.com/adrg/xdg v0.4.0 // indirect github.com/cloudflare/circl v1.3.3 // indirect github.com/cyphar/filepath-securejoin v0.2.4 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -34,19 +30,16 @@ require ( github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/go-billy/v5 v5.5.0 // indirect - github.com/go-logr/logr v1.4.1 // indirect - github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.4 // indirect - github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect github.com/magiconair/properties v1.8.7 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect - github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect @@ -55,16 +48,11 @@ require ( github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sergi/go-diff v1.3.1 // indirect github.com/skeema/knownhosts v1.2.1 // indirect - github.com/sosodev/duration v1.2.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.6.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/vektah/gqlparser/v2 v2.5.11 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect - go.opentelemetry.io/otel v1.24.0 // indirect - go.opentelemetry.io/otel/metric v1.24.0 // indirect - go.opentelemetry.io/otel/trace v1.24.0 // indirect go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.9.0 // indirect golang.org/x/crypto v0.19.0 // indirect diff --git a/go.sum b/go.sum index e0138a8a..225624fb 100644 --- a/go.sum +++ b/go.sum @@ -30,26 +30,16 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -dagger.io/dagger v0.11.4 h1:br81yt7S/KWrxieajFyzleOMBccevhi3TSSxmBp2lu0= -dagger.io/dagger v0.11.4/go.mod h1:YyHN9NpFZ0U70vLfGR9RQw1ppwxzXG7q/DPn7kn25Oc= dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/99designs/gqlgen v0.17.44 h1:OS2wLk/67Y+vXM75XHbwRnNYJcbuJd4OBL76RX3NQQA= -github.com/99designs/gqlgen v0.17.44/go.mod h1:UTCu3xpK2mLI5qcMNw+HKDiEL77it/1XtAjisC4sLwM= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/Khan/genqlient v0.7.0 h1:GZ1meyRnzcDTK48EjqB8t3bcfYvHArCUUvgOwpz1D4w= -github.com/Khan/genqlient v0.7.0/go.mod h1:HNyy3wZvuYwmW3Y7mkoQLZsa/R5n5yIRajS1kPBvSFM= github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 h1:kkhsdkhsCvIsutKu5zLMgWtgh9YxGCNAw8Ad8hjwfYg= github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= -github.com/adrg/xdg v0.4.0 h1:RzRqFcjH4nE5C6oTAxhBtoE2IRyjBSa62SCbyPidvls= -github.com/adrg/xdg v0.4.0/go.mod h1:N6ag73EX4wyxeaoeHctc1mas01KZgsj5tYiAIwqJE/E= -github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= -github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= @@ -99,11 +89,6 @@ github.com/go-git/go-git/v5 v5.10.1/go.mod h1:uEuHjxkHap8kAl//V5F/nNWwqIYtP/402d github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= -github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -156,8 +141,6 @@ github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= @@ -202,8 +185,6 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 h1:n6/2gBQ3RWajuToeY6ZtZTIKv2v7ThUy5KKusIT0yc0= @@ -237,8 +218,6 @@ github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NF github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/skeema/knownhosts v1.2.1 h1:SHWdIUa82uGZz+F+47k8SY4QhhI291cXCpopT1lK2AQ= github.com/skeema/knownhosts v1.2.1/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo= -github.com/sosodev/duration v1.2.0 h1:pqK/FLSjsAADWY74SyWDCjOcd5l7H8GSnnOGEB9A1Us= -github.com/sosodev/duration v1.2.0/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg= github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= @@ -257,7 +236,6 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= @@ -265,8 +243,6 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/vektah/gqlparser/v2 v2.5.11 h1:JJxLtXIoN7+3x6MBdtIP59TP1RANnY7pXOaDnADQSf8= -github.com/vektah/gqlparser/v2 v2.5.11/go.mod h1:1rCcfwB2ekJofmluGWXMSEnPMZgbxzwj6FaZ/4OT8Cc= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -278,12 +254,6 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= -go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= -go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= -go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= -go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= -go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= @@ -419,7 +389,6 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/vendor/dagger.io/dagger/.changie.yaml b/vendor/dagger.io/dagger/.changie.yaml deleted file mode 100644 index 062def8e..00000000 --- a/vendor/dagger.io/dagger/.changie.yaml +++ /dev/null @@ -1,40 +0,0 @@ -changesDir: .changes -unreleasedDir: unreleased -headerPath: header.tpl.md -changelogPath: CHANGELOG.md -versionExt: md -versionFormat: '## sdk/go/{{.Version}} - {{.Time.Format "2006-01-02"}}' -kindFormat: '### {{.Kind}}' -changeFormat: '- {{.Body}} by @{{.Custom.Author}} in https://github.com/dagger/dagger/pull/{{.Custom.PR}}' -custom: - - key: PR - label: GitHub PR - type: int - - key: Author - label: GitHub Author - type: string -kinds: - - label: Breaking - format: '### 🔥 Breaking Changes' - - label: Added - - label: Changed - - label: Deprecated - - label: Removed - - label: Fixed - - label: Security - - label: Dependencies -headerFormat: | - This SDK uses 🚙 Engine + 🚗 CLI version `{{.Env.ENGINE_VERSION}}`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/{{.Env.ENGINE_VERSION}}). - - 🐹 https://pkg.go.dev/dagger.io/dagger@{{.Version}} -footerFormat: | - ### What to do next - - Read the [documentation](https://docs.dagger.io/sdk/go) - - Join our [Discord server](https://discord.gg/dagger-io) - - Follow us on [Twitter](https://twitter.com/dagger_io) -newlines: - beforeChangelogVersion: 3 - afterVersion: 1 - beforeKind: 1 - beforeFooterTemplate: 1 -envPrefix: CHANGIE_ diff --git a/vendor/dagger.io/dagger/.gitattributes b/vendor/dagger.io/dagger/.gitattributes deleted file mode 100644 index 9b7f9ae2..00000000 --- a/vendor/dagger.io/dagger/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -/dagger.gen.go linguist-generated=true diff --git a/vendor/dagger.io/dagger/.gitignore b/vendor/dagger.io/dagger/.gitignore deleted file mode 100644 index d874ad67..00000000 --- a/vendor/dagger.io/dagger/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.tar diff --git a/vendor/dagger.io/dagger/CHANGELOG.md b/vendor/dagger.io/dagger/CHANGELOG.md deleted file mode 100644 index 2c66b72b..00000000 --- a/vendor/dagger.io/dagger/CHANGELOG.md +++ /dev/null @@ -1,578 +0,0 @@ -# Changelog -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), -and is generated by [Changie](https://github.com/miniscruff/changie). - - - -## sdk/go/v0.11.4 - 2024-05-09 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.11.4`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.11.4). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.11.4 - - -### Dependencies -- Bump Engine to v0.11.4 by @github-actions in https://github.com/dagger/dagger/pull/7345 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.11.3 - 2024-05-08 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.11.3`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.11.3). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.11.3 - - -### Fixed -- Respect existing go.mod during module initialization by @jedevc in https://github.com/dagger/dagger/pull/7194 - -### Dependencies -- Bump Engine to v0.11.3 by @github-actions in https://github.com/dagger/dagger/pull/7318 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.11.2 - 2024-04-26 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.11.2`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.11.2). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.11.2 - -### Fixed -- Allow windows CRLF line-endings in go pragmas by @jedevc in https://github.com/dagger/dagger/pull/7121 - -### Dependencies -- Bump Engine to v0.11.2 by @github-actions in https://github.com/dagger/dagger/pull/7204 -- Bump Dagger Modules go version to 1.22 by @jedevc in https://github.com/dagger/dagger/pull/7109 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.11.1 - 2024-04-16 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.11.1`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.11.1). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.11.1 - -### Fixed -- Automatically add `internal/telemetry` directory to generated `.gitignore` files by @yann-soubeyrand in https://github.com/dagger/dagger/issues/7019 - -### Dependencies -- Bump Engine to v0.11.1 by @github-actions in https://github.com/dagger/dagger/pull/7100 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.11.0 - 2024-04-04 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.11.0`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.11.0). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.11.0 - - -### Dependencies -- Bump Engine to v0.11.0 by @github-actions in https://github.com/dagger/dagger/pull/7016 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.10.3 - 2024-03-26 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.10.3`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.10.3). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.10.3 - - -### Dependencies -- Bump Engine to v0.10.3 by @github-actions in https://github.com/dagger/dagger/pull/6936 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.10.2 - 2024-03-12 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.10.2`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.10.2). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.10.2 - - -### Dependencies -- Bump Engine to v0.10.2 by @github-actions in https://github.com/dagger/dagger/pull/6871 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.10.1 - 2024-03-05 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.10.1`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.10.1). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.10.1 - - -### Dependencies -- Bump Engine to v0.10.1 by @github-actions in https://github.com/dagger/dagger/pull/6826 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.10.0 - 2024-02-27 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.10.0`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.10.0). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.10.0 - - -### Dependencies -- Bump Engine to v0.10.0 by @github-actions in https://github.com/dagger/dagger/pull/6758 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.9.11 - 2024-02-20 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.9.11`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.9.11). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.9.11 - - -### Dependencies -- Bump Engine to v0.9.11 by @github-actions in https://github.com/dagger/dagger/pull/6700 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.9.10 - 2024-02-13 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.9.10`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.9.10). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.9.10 - - -### Dependencies -- Bump Engine to v0.9.10 by @github-actions in https://github.com/dagger/dagger/pull/6656 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.9.9 - 2024-02-09 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.9.9`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.9.9). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.9.9 - - -### Dependencies -- Bump Engine to v0.9.9 by @github-actions in https://github.com/dagger/dagger/pull/6636 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.9.8 - 2024-02-01 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.9.8`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.9.8). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.9.8 - - -### Dependencies -- Bump Engine to v0.9.8 by @github-actions in https://github.com/dagger/dagger/pull/6557 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.9.7 - 2024-01-19 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.9.7`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.9.7). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.9.7 - - -### Dependencies -- Bump Engine to v0.9.7 by @github-actions in https://github.com/dagger/dagger/pull/6460 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.9.6 - 2024-01-12 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.9.6`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.9.6). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.9.6 - - -### Added -- Add a default global client at dagger.io/dagger/dag by @jedevc in https://github.com/dagger/dagger/pull/6326 - -### Dependencies -- Bump Engine to v0.9.6 by @github-actions in https://github.com/dagger/dagger/pull/6410 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.9.5 - 2023-12-21 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.9.5`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.9.5). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.9.5 - - -### Dependencies -- Bump Engine to v0.9.5 by @github-actions in https://github.com/dagger/dagger/pull/6309 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.9.4 - 2023-12-08 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.9.4`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.9.4). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.9.4 - - -### Dependencies -- Bump Engine to v0.9.4 by @github-actions in https://github.com/dagger/dagger/pull/6239 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.9.3 - 2023-11-03 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.9.3`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.9.3). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.9.3 - - -### Dependencies -- Bump Engine to v0.9.3 by @github-actions in https://github.com/dagger/dagger/pull/6061 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.9.2 - 2023-10-30 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.9.2`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.9.2). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.9.2 - -### Dependencies - -- Bump Engine to v0.9.2 by @github-actions in https://github.com/dagger/dagger/pull/6024 - -### What to do next - -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.9.1 - 2023-10-26 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.9.1`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.9.1). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.9.1 - - -### Dependencies -- Bump Engine to v0.9.1 by @github-actions in https://github.com/dagger/dagger/pull/5969 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.9.0 - 2023-10-20 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.9.0`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.9.0). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.9.0 - -### 🔥 Breaking Changes - -- engine: new services API with container <=> host networking, explicit start/stop by @vito in https://github.com/dagger/dagger/pull/5557 -- implement new conventions for IDable objects by @vito in https://github.com/dagger/dagger/pull/5881 - -### Dependencies - -- Bump Engine to v0.9.0 by @github-actions in https://github.com/dagger/dagger/pull/5940 - -### What to do next - -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.8.8 - 2023-10-11 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.8.8`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.8.8). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.8.8 - - -### Dependencies -- Bump Engine to v0.8.8 by @github-actions in https://github.com/dagger/dagger/pull/5877 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.8.7 - 2023-09-18 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.8.7`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.8.7). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.8.7 - - -### Dependencies -- Bump Engine to v0.8.7 by @github-actions in https://github.com/dagger/dagger/pull/5799 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.8.6 - 2023-09-18 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.8.6`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.8.6). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.8.6 - - -### Fixed -- Check and panic if a nil pointer is sent as argument to a query by @TomChv in https://github.com/dagger/dagger/pull/5785 - -### Dependencies -- Bump Engine to v0.8.6 by @github-actions in https://github.com/dagger/dagger/pull/5795 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.8.5 - 2023-09-13 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.8.5`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.8.5). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.8.5 - - -### Dependencies -- Bump Engine to v0.8.5 by @github-actions in https://github.com/dagger/dagger/pull/5779 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.8.4 - 2023-08-17 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.8.4`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.8.4). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.8.4 - - -### Dependencies -- Bump Engine to v0.8.4 by @github-actions in https://github.com/dagger/dagger/pull/5657 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.8.3 - 2023-08-16 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.8.3`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.8.3). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.8.3 - - -### Dependencies -- Bump Engine to v0.8.3 by @github-actions in https://github.com/dagger/dagger/pull/5643 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.8.2 - 2023-08-10 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.8.2`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.8.2). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.8.2 - - -### Fixed -- Expand `~` to home when using custom CLI path by @wingyplus in https://github.com/dagger/dagger/pull/5555 - -### Dependencies -- Bump Engine to v0.8.2 by @github-actions in https://github.com/dagger/dagger/pull/5613 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.8.1 - 2023-08-04 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.8.1`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.8.1). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.8.1 - - -### Dependencies -- Bump Engine to v0.8.1 by @github-actions in https://github.com/dagger/dagger/pull/5581 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.8.0 - 2023-08-03 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.8.0`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.8.0). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.8.0 - -### Added -- Print progress status during automatic Engine provisioning and establishing client connection by @TomChv in https://github.com/dagger/dagger/pull/5488 -- Show warning on version mismatch between Engine and SDK by @TomChv in https://github.com/dagger/dagger/pull/5315 - -### Dependencies -- Bump Engine to v0.8.0 by @github-actions in https://github.com/dagger/dagger/pull/5567 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.7.4 - 2023-07-19 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.6.4`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.6.4). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.7.4 - -### Added -- Added the `With` method to more types by @helderco in https://github.com/dagger/dagger/pull/5447 - -### Dependencies -- Bump Engine to v0.6.4 by @github-actions in https://github.com/dagger/dagger/pull/5489 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) - - - -## sdk/go/v0.7.3 - 2023-07-04 - -This SDK uses 🚙 Engine + 🚗 CLI version `v0.6.3`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.6.3). - -🐹 https://pkg.go.dev/dagger.io/dagger@v0.7.3 - -### Dependencies -- Bump Engine to v0.6.3 by @github-actions in https://github.com/dagger/dagger/pull/5407 - -### What to do next -- Read the [documentation](https://docs.dagger.io/sdk/go) -- Join our [Discord server](https://discord.gg/dagger-io) -- Follow us on [Twitter](https://twitter.com/dagger_io) diff --git a/vendor/dagger.io/dagger/LICENSE b/vendor/dagger.io/dagger/LICENSE deleted file mode 100644 index 17b2ba29..00000000 --- a/vendor/dagger.io/dagger/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - Copyright 2022 Dagger, Inc. - - 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. diff --git a/vendor/dagger.io/dagger/README.md b/vendor/dagger.io/dagger/README.md deleted file mode 100644 index 56cc5f37..00000000 --- a/vendor/dagger.io/dagger/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# Dagger Go SDK - -The Dagger Go SDK contains everything you need to develop CI/CD pipelines in Go, and run them with the [Dagger Engine](https://dagger.io). - -This SDK contains: - -* A Go package: `dagger.io/dagger` -* The [`dagger` CLI][cli] -* [Examples][examples] -* [Documentation][docs] - - -## Contributing - -The Dagger Go SDK is open-source, and we welcome contributions. Its source code lives in the [Dagger Engine repository][source]. - -> **NOTE**: please do NOT contribute to `github.com/dagger/dagger-go-sdk`: that is a read-only mirror which only exists to satisfy the requirements of the Go package management system. Instead, please visit the repository linked above. - -[cli]: https://docs.dagger.io/cli -[examples]: https://github.com/dagger/examples/tree/main/go -[docs]: https://docs.dagger.io/sdk/go -[source]: https://github.com/dagger/dagger/tree/main/sdk/go \ No newline at end of file diff --git a/vendor/dagger.io/dagger/client.go b/vendor/dagger.io/dagger/client.go deleted file mode 100644 index c45e5bc2..00000000 --- a/vendor/dagger.io/dagger/client.go +++ /dev/null @@ -1,172 +0,0 @@ -package dagger - -import ( - "context" - "fmt" - "io" - "os" - - "github.com/Khan/genqlient/graphql" - "github.com/vektah/gqlparser/v2/gqlerror" - - "dagger.io/dagger/internal/engineconn" - "dagger.io/dagger/querybuilder" -) - -// Client is the Dagger Engine Client -type Client struct { - conn engineconn.EngineConn - - query *querybuilder.Selection - client graphql.Client -} - -// ClientOpt holds a client option -type ClientOpt interface { - setClientOpt(cfg *engineconn.Config) -} - -type clientOptFunc func(cfg *engineconn.Config) - -func (fn clientOptFunc) setClientOpt(cfg *engineconn.Config) { - fn(cfg) -} - -// WithWorkdir sets the engine workdir -func WithWorkdir(path string) ClientOpt { - return clientOptFunc(func(cfg *engineconn.Config) { - cfg.Workdir = path - }) -} - -// WithLogOutput sets the progress writer -func WithLogOutput(writer io.Writer) ClientOpt { - return clientOptFunc(func(cfg *engineconn.Config) { - cfg.LogOutput = writer - }) -} - -// WithConn sets the engine connection explicitly -func WithConn(conn engineconn.EngineConn) ClientOpt { - return clientOptFunc(func(cfg *engineconn.Config) { - cfg.Conn = conn - }) -} - -// WithSkipCompatibilityCheck disables the version compatibility check -func WithSkipCompatibilityCheck() ClientOpt { - return clientOptFunc(func(cfg *engineconn.Config) { - cfg.SkipCompatibilityCheck = true - }) -} - -// Connect to a Dagger Engine -func Connect(ctx context.Context, opts ...ClientOpt) (*Client, error) { - cfg := &engineconn.Config{} - - for _, o := range opts { - o.setClientOpt(cfg) - } - - conn, err := engineconn.Get(ctx, cfg) - if err != nil { - return nil, err - } - gql := errorWrappedClient{graphql.NewClient("http://"+conn.Host()+"/query", conn)} - - c := &Client{ - query: querybuilder.Query().Client(gql), - client: gql, - conn: conn, - } - - if !cfg.SkipCompatibilityCheck { - // Call version compatibility. - // If versions are not compatible, a warning will be displayed. - if _, err = c.CheckVersionCompatibility(ctx, engineconn.CLIVersion); err != nil { - fmt.Fprintln(os.Stderr, "failed to check version compatibility:", err) - } - } - - return c, nil -} - -// GraphQLClient returns the underlying graphql.Client -func (c *Client) GraphQLClient() graphql.Client { - return c.client -} - -// Close the engine connection -func (c *Client) Close() error { - if c.conn != nil { - return c.conn.Close() - } - return nil -} - -// Do sends a GraphQL request to the engine -func (c *Client) Do(ctx context.Context, req *Request, resp *Response) error { - r := graphql.Response{} - if resp != nil { - r.Data = resp.Data - r.Errors = resp.Errors - r.Extensions = resp.Extensions - } - return c.client.MakeRequest(ctx, &graphql.Request{ - Query: req.Query, - Variables: req.Variables, - OpName: req.OpName, - }, &r) -} - -// Request contains all the values required to build queries executed by -// the graphql.Client. -// -// Typically, GraphQL APIs will accept a JSON payload of the form -// -// {"query": "query myQuery { ... }", "variables": {...}}` -// -// and Request marshals to this format. However, MakeRequest may -// marshal the data in some other way desired by the backend. -type Request struct { - // The literal string representing the GraphQL query, e.g. - // `query myQuery { myField }`. - Query string `json:"query"` - // A JSON-marshalable value containing the variables to be sent - // along with the query, or nil if there are none. - Variables interface{} `json:"variables,omitempty"` - // The GraphQL operation name. The server typically doesn't - // require this unless there are multiple queries in the - // document, but genqlient sets it unconditionally anyway. - OpName string `json:"operationName"` -} - -// Response that contains data returned by the GraphQL API. -// -// Typically, GraphQL APIs will return a JSON payload of the form -// -// {"data": {...}, "errors": {...}} -// -// It may additionally contain a key named "extensions", that -// might hold GraphQL protocol extensions. Extensions and Errors -// are optional, depending on the values returned by the server. -type Response struct { - Data interface{} `json:"data"` - Extensions map[string]interface{} `json:"extensions,omitempty"` - Errors gqlerror.List `json:"errors,omitempty"` -} - -type errorWrappedClient struct { - graphql.Client -} - -func (c errorWrappedClient) MakeRequest(ctx context.Context, req *graphql.Request, resp *graphql.Response) error { - err := c.Client.MakeRequest(ctx, req, resp) - if err != nil { - if e := getCustomError(err); e != nil { - return e - } - return err - } - return nil -} diff --git a/vendor/dagger.io/dagger/dagger.gen.go b/vendor/dagger.io/dagger/dagger.gen.go deleted file mode 100644 index 0e51e52f..00000000 --- a/vendor/dagger.io/dagger/dagger.gen.go +++ /dev/null @@ -1,6967 +0,0 @@ -// Code generated by dagger. DO NOT EDIT. - -package dagger - -import ( - "context" - "encoding/json" - "errors" - "fmt" - "reflect" - "strings" - - "github.com/vektah/gqlparser/v2/gqlerror" - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/trace" - - "dagger.io/dagger/querybuilder" -) - -func Tracer() trace.Tracer { - return otel.Tracer("dagger.io/sdk.go") -} - -// reassigned at runtime after the span is initialized -var marshalCtx = context.Background() - -// assertNotNil panic if the given value is nil. -// This function is used to validate that input with pointer type are not nil. -// See https://github.com/dagger/dagger/issues/5696 for more context. -func assertNotNil(argName string, value any) { - // We use reflect because just comparing value to nil is not working since - // the value is wrapped into a type when passed as parameter. - // E.g., nil become (*dagger.File)(nil). - if reflect.ValueOf(value).IsNil() { - panic(fmt.Sprintf("unexpected nil pointer for argument %q", argName)) - } -} - -type DaggerObject querybuilder.GraphQLMarshaller - -// getCustomError parses a GraphQL error into a more specific error type. -func getCustomError(err error) error { - var gqlErr *gqlerror.Error - - if !errors.As(err, &gqlErr) { - return nil - } - - ext := gqlErr.Extensions - - typ, ok := ext["_type"].(string) - if !ok { - return nil - } - - if typ == "EXEC_ERROR" { - e := &ExecError{ - original: err, - } - if code, ok := ext["exitCode"].(float64); ok { - e.ExitCode = int(code) - } - if args, ok := ext["cmd"].([]interface{}); ok { - cmd := make([]string, len(args)) - for i, v := range args { - cmd[i] = v.(string) - } - e.Cmd = cmd - } - if stdout, ok := ext["stdout"].(string); ok { - e.Stdout = stdout - } - if stderr, ok := ext["stderr"].(string); ok { - e.Stderr = stderr - } - return e - } - - return nil -} - -// ExecError is an API error from an exec operation. -type ExecError struct { - original error - Cmd []string - ExitCode int - Stdout string - Stderr string -} - -func (e *ExecError) Error() string { - // As a default when just printing the error, include the stdout - // and stderr for visibility - msg := e.Message() - if strings.TrimSpace(e.Stdout) != "" { - msg += "\nStdout:\n" + e.Stdout - } - if strings.TrimSpace(e.Stderr) != "" { - msg += "\nStderr:\n" + e.Stderr - } - return msg -} - -func (e *ExecError) Message() string { - return e.original.Error() -} - -func (e *ExecError) Unwrap() error { - return e.original -} - -// The `CacheVolumeID` scalar type represents an identifier for an object of type CacheVolume. -type CacheVolumeID string - -// The `ContainerID` scalar type represents an identifier for an object of type Container. -type ContainerID string - -// The `CurrentModuleID` scalar type represents an identifier for an object of type CurrentModule. -type CurrentModuleID string - -// The `DirectoryID` scalar type represents an identifier for an object of type Directory. -type DirectoryID string - -// The `EnvVariableID` scalar type represents an identifier for an object of type EnvVariable. -type EnvVariableID string - -// The `FieldTypeDefID` scalar type represents an identifier for an object of type FieldTypeDef. -type FieldTypeDefID string - -// The `FileID` scalar type represents an identifier for an object of type File. -type FileID string - -// The `FunctionArgID` scalar type represents an identifier for an object of type FunctionArg. -type FunctionArgID string - -// The `FunctionCallArgValueID` scalar type represents an identifier for an object of type FunctionCallArgValue. -type FunctionCallArgValueID string - -// The `FunctionCallID` scalar type represents an identifier for an object of type FunctionCall. -type FunctionCallID string - -// The `FunctionID` scalar type represents an identifier for an object of type Function. -type FunctionID string - -// The `GeneratedCodeID` scalar type represents an identifier for an object of type GeneratedCode. -type GeneratedCodeID string - -// The `GitModuleSourceID` scalar type represents an identifier for an object of type GitModuleSource. -type GitModuleSourceID string - -// The `GitRefID` scalar type represents an identifier for an object of type GitRef. -type GitRefID string - -// The `GitRepositoryID` scalar type represents an identifier for an object of type GitRepository. -type GitRepositoryID string - -// The `HostID` scalar type represents an identifier for an object of type Host. -type HostID string - -// The `InputTypeDefID` scalar type represents an identifier for an object of type InputTypeDef. -type InputTypeDefID string - -// The `InterfaceTypeDefID` scalar type represents an identifier for an object of type InterfaceTypeDef. -type InterfaceTypeDefID string - -// An arbitrary JSON-encoded value. -type JSON string - -// The `LabelID` scalar type represents an identifier for an object of type Label. -type LabelID string - -// The `ListTypeDefID` scalar type represents an identifier for an object of type ListTypeDef. -type ListTypeDefID string - -// The `LocalModuleSourceID` scalar type represents an identifier for an object of type LocalModuleSource. -type LocalModuleSourceID string - -// The `ModuleDependencyID` scalar type represents an identifier for an object of type ModuleDependency. -type ModuleDependencyID string - -// The `ModuleID` scalar type represents an identifier for an object of type Module. -type ModuleID string - -// The `ModuleSourceID` scalar type represents an identifier for an object of type ModuleSource. -type ModuleSourceID string - -// The `ModuleSourceViewID` scalar type represents an identifier for an object of type ModuleSourceView. -type ModuleSourceViewID string - -// The `ObjectTypeDefID` scalar type represents an identifier for an object of type ObjectTypeDef. -type ObjectTypeDefID string - -// The platform config OS and architecture in a Container. -// -// The format is [os]/[platform]/[version] (e.g., "darwin/arm64/v7", "windows/amd64", "linux/arm64"). -type Platform string - -// The `PortID` scalar type represents an identifier for an object of type Port. -type PortID string - -// The `ScalarTypeDefID` scalar type represents an identifier for an object of type ScalarTypeDef. -type ScalarTypeDefID string - -// The `SecretID` scalar type represents an identifier for an object of type Secret. -type SecretID string - -// The `ServiceID` scalar type represents an identifier for an object of type Service. -type ServiceID string - -// The `SocketID` scalar type represents an identifier for an object of type Socket. -type SocketID string - -// The `TerminalID` scalar type represents an identifier for an object of type Terminal. -type TerminalID string - -// The `TypeDefID` scalar type represents an identifier for an object of type TypeDef. -type TypeDefID string - -// The absence of a value. -// -// A Null Void is used as a placeholder for resolvers that do not return anything. -type Void string - -// Key value object that represents a build argument. -type BuildArg struct { - // The build argument name. - Name string `json:"name"` - - // The build argument value. - Value string `json:"value"` -} - -// Key value object that represents a pipeline label. -type PipelineLabel struct { - // Label name. - Name string `json:"name"` - - // Label value. - Value string `json:"value"` -} - -// Port forwarding rules for tunneling network traffic. -type PortForward struct { - // Destination port for traffic. - Backend int `json:"backend"` - - // Port to expose to clients. If unspecified, a default will be chosen. - Frontend int `json:"frontend"` - - // Transport layer protocol to use for traffic. - Protocol NetworkProtocol `json:"protocol,omitempty"` -} - -// A directory whose contents persist across runs. -type CacheVolume struct { - query *querybuilder.Selection - - id *CacheVolumeID -} - -func (r *CacheVolume) WithGraphQLQuery(q *querybuilder.Selection) *CacheVolume { - return &CacheVolume{ - query: q, - } -} - -// A unique identifier for this CacheVolume. -func (r *CacheVolume) ID(ctx context.Context) (CacheVolumeID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response CacheVolumeID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *CacheVolume) XXX_GraphQLType() string { - return "CacheVolume" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *CacheVolume) XXX_GraphQLIDType() string { - return "CacheVolumeID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *CacheVolume) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *CacheVolume) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// An OCI-compatible container, also known as a Docker container. -type Container struct { - query *querybuilder.Selection - - envVariable *string - export *bool - id *ContainerID - imageRef *string - label *string - platform *Platform - publish *string - stderr *string - stdout *string - sync *ContainerID - user *string - workdir *string -} -type WithContainerFunc func(r *Container) *Container - -// With calls the provided function with current Container. -// -// This is useful for reusability and readability by not breaking the calling chain. -func (r *Container) With(f WithContainerFunc) *Container { - return f(r) -} - -func (r *Container) WithGraphQLQuery(q *querybuilder.Selection) *Container { - return &Container{ - query: q, - } -} - -// Turn the container into a Service. -// -// Be sure to set any exposed ports before this conversion. -func (r *Container) AsService() *Service { - q := r.query.Select("asService") - - return &Service{ - query: q, - } -} - -// ContainerAsTarballOpts contains options for Container.AsTarball -type ContainerAsTarballOpts struct { - // Identifiers for other platform specific containers. - // - // Used for multi-platform images. - PlatformVariants []*Container - // Force each layer of the image to use the specified compression algorithm. - // - // If this is unset, then if a layer already has a compressed blob in the engine's cache, that will be used (this can result in a mix of compression algorithms for different layers). If this is unset and a layer has no compressed blob in the engine's cache, then it will be compressed using Gzip. - ForcedCompression ImageLayerCompression - // Use the specified media types for the image's layers. - // - // Defaults to OCI, which is largely compatible with most recent container runtimes, but Docker may be needed for older runtimes without OCI support. - MediaTypes ImageMediaTypes -} - -// Returns a File representing the container serialized to a tarball. -func (r *Container) AsTarball(opts ...ContainerAsTarballOpts) *File { - q := r.query.Select("asTarball") - for i := len(opts) - 1; i >= 0; i-- { - // `platformVariants` optional argument - if !querybuilder.IsZeroValue(opts[i].PlatformVariants) { - q = q.Arg("platformVariants", opts[i].PlatformVariants) - } - // `forcedCompression` optional argument - if !querybuilder.IsZeroValue(opts[i].ForcedCompression) { - q = q.Arg("forcedCompression", opts[i].ForcedCompression) - } - // `mediaTypes` optional argument - if !querybuilder.IsZeroValue(opts[i].MediaTypes) { - q = q.Arg("mediaTypes", opts[i].MediaTypes) - } - } - - return &File{ - query: q, - } -} - -// ContainerBuildOpts contains options for Container.Build -type ContainerBuildOpts struct { - // Path to the Dockerfile to use. - Dockerfile string - // Target build stage to build. - Target string - // Additional build arguments. - BuildArgs []BuildArg - // Secrets to pass to the build. - // - // They will be mounted at /run/secrets/[secret-name] in the build container - // - // They can be accessed in the Dockerfile using the "secret" mount type and mount path /run/secrets/[secret-name], e.g. RUN --mount=type=secret,id=my-secret curl [http://example.com?token=$(cat /run/secrets/my-secret)](http://example.com?token=$(cat /run/secrets/my-secret)) - Secrets []*Secret -} - -// Initializes this container from a Dockerfile build. -func (r *Container) Build(context *Directory, opts ...ContainerBuildOpts) *Container { - assertNotNil("context", context) - q := r.query.Select("build") - for i := len(opts) - 1; i >= 0; i-- { - // `dockerfile` optional argument - if !querybuilder.IsZeroValue(opts[i].Dockerfile) { - q = q.Arg("dockerfile", opts[i].Dockerfile) - } - // `target` optional argument - if !querybuilder.IsZeroValue(opts[i].Target) { - q = q.Arg("target", opts[i].Target) - } - // `buildArgs` optional argument - if !querybuilder.IsZeroValue(opts[i].BuildArgs) { - q = q.Arg("buildArgs", opts[i].BuildArgs) - } - // `secrets` optional argument - if !querybuilder.IsZeroValue(opts[i].Secrets) { - q = q.Arg("secrets", opts[i].Secrets) - } - } - q = q.Arg("context", context) - - return &Container{ - query: q, - } -} - -// Retrieves default arguments for future commands. -func (r *Container) DefaultArgs(ctx context.Context) ([]string, error) { - q := r.query.Select("defaultArgs") - - var response []string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Retrieves a directory at the given path. -// -// Mounts are included. -func (r *Container) Directory(path string) *Directory { - q := r.query.Select("directory") - q = q.Arg("path", path) - - return &Directory{ - query: q, - } -} - -// Retrieves entrypoint to be prepended to the arguments of all commands. -func (r *Container) Entrypoint(ctx context.Context) ([]string, error) { - q := r.query.Select("entrypoint") - - var response []string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Retrieves the value of the specified environment variable. -func (r *Container) EnvVariable(ctx context.Context, name string) (string, error) { - if r.envVariable != nil { - return *r.envVariable, nil - } - q := r.query.Select("envVariable") - q = q.Arg("name", name) - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Retrieves the list of environment variables passed to commands. -func (r *Container) EnvVariables(ctx context.Context) ([]EnvVariable, error) { - q := r.query.Select("envVariables") - - q = q.Select("id") - - type envVariables struct { - Id EnvVariableID - } - - convert := func(fields []envVariables) []EnvVariable { - out := []EnvVariable{} - - for i := range fields { - val := EnvVariable{id: &fields[i].Id} - val.query = q.Root().Select("loadEnvVariableFromID").Arg("id", fields[i].Id) - out = append(out, val) - } - - return out - } - var response []envVariables - - q = q.Bind(&response) - - err := q.Execute(ctx) - if err != nil { - return nil, err - } - - return convert(response), nil -} - -// EXPERIMENTAL API! Subject to change/removal at any time. -// -// Configures all available GPUs on the host to be accessible to this container. -// -// This currently works for Nvidia devices only. -func (r *Container) ExperimentalWithAllGPUs() *Container { - q := r.query.Select("experimentalWithAllGPUs") - - return &Container{ - query: q, - } -} - -// EXPERIMENTAL API! Subject to change/removal at any time. -// -// Configures the provided list of devices to be accessible to this container. -// -// This currently works for Nvidia devices only. -func (r *Container) ExperimentalWithGPU(devices []string) *Container { - q := r.query.Select("experimentalWithGPU") - q = q.Arg("devices", devices) - - return &Container{ - query: q, - } -} - -// ContainerExportOpts contains options for Container.Export -type ContainerExportOpts struct { - // Identifiers for other platform specific containers. - // - // Used for multi-platform image. - PlatformVariants []*Container - // Force each layer of the exported image to use the specified compression algorithm. - // - // If this is unset, then if a layer already has a compressed blob in the engine's cache, that will be used (this can result in a mix of compression algorithms for different layers). If this is unset and a layer has no compressed blob in the engine's cache, then it will be compressed using Gzip. - ForcedCompression ImageLayerCompression - // Use the specified media types for the exported image's layers. - // - // Defaults to OCI, which is largely compatible with most recent container runtimes, but Docker may be needed for older runtimes without OCI support. - MediaTypes ImageMediaTypes -} - -// Writes the container as an OCI tarball to the destination file path on the host. -// -// Return true on success. -// -// It can also export platform variants. -func (r *Container) Export(ctx context.Context, path string, opts ...ContainerExportOpts) (bool, error) { - if r.export != nil { - return *r.export, nil - } - q := r.query.Select("export") - for i := len(opts) - 1; i >= 0; i-- { - // `platformVariants` optional argument - if !querybuilder.IsZeroValue(opts[i].PlatformVariants) { - q = q.Arg("platformVariants", opts[i].PlatformVariants) - } - // `forcedCompression` optional argument - if !querybuilder.IsZeroValue(opts[i].ForcedCompression) { - q = q.Arg("forcedCompression", opts[i].ForcedCompression) - } - // `mediaTypes` optional argument - if !querybuilder.IsZeroValue(opts[i].MediaTypes) { - q = q.Arg("mediaTypes", opts[i].MediaTypes) - } - } - q = q.Arg("path", path) - - var response bool - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Retrieves the list of exposed ports. -// -// This includes ports already exposed by the image, even if not explicitly added with dagger. -func (r *Container) ExposedPorts(ctx context.Context) ([]Port, error) { - q := r.query.Select("exposedPorts") - - q = q.Select("id") - - type exposedPorts struct { - Id PortID - } - - convert := func(fields []exposedPorts) []Port { - out := []Port{} - - for i := range fields { - val := Port{id: &fields[i].Id} - val.query = q.Root().Select("loadPortFromID").Arg("id", fields[i].Id) - out = append(out, val) - } - - return out - } - var response []exposedPorts - - q = q.Bind(&response) - - err := q.Execute(ctx) - if err != nil { - return nil, err - } - - return convert(response), nil -} - -// Retrieves a file at the given path. -// -// Mounts are included. -func (r *Container) File(path string) *File { - q := r.query.Select("file") - q = q.Arg("path", path) - - return &File{ - query: q, - } -} - -// Initializes this container from a pulled base image. -func (r *Container) From(address string) *Container { - q := r.query.Select("from") - q = q.Arg("address", address) - - return &Container{ - query: q, - } -} - -// A unique identifier for this Container. -func (r *Container) ID(ctx context.Context) (ContainerID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response ContainerID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *Container) XXX_GraphQLType() string { - return "Container" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *Container) XXX_GraphQLIDType() string { - return "ContainerID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *Container) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *Container) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// The unique image reference which can only be retrieved immediately after the 'Container.From' call. -func (r *Container) ImageRef(ctx context.Context) (string, error) { - if r.imageRef != nil { - return *r.imageRef, nil - } - q := r.query.Select("imageRef") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// ContainerImportOpts contains options for Container.Import -type ContainerImportOpts struct { - // Identifies the tag to import from the archive, if the archive bundles multiple tags. - Tag string -} - -// Reads the container from an OCI tarball. -func (r *Container) Import(source *File, opts ...ContainerImportOpts) *Container { - assertNotNil("source", source) - q := r.query.Select("import") - for i := len(opts) - 1; i >= 0; i-- { - // `tag` optional argument - if !querybuilder.IsZeroValue(opts[i].Tag) { - q = q.Arg("tag", opts[i].Tag) - } - } - q = q.Arg("source", source) - - return &Container{ - query: q, - } -} - -// Retrieves the value of the specified label. -func (r *Container) Label(ctx context.Context, name string) (string, error) { - if r.label != nil { - return *r.label, nil - } - q := r.query.Select("label") - q = q.Arg("name", name) - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Retrieves the list of labels passed to container. -func (r *Container) Labels(ctx context.Context) ([]Label, error) { - q := r.query.Select("labels") - - q = q.Select("id") - - type labels struct { - Id LabelID - } - - convert := func(fields []labels) []Label { - out := []Label{} - - for i := range fields { - val := Label{id: &fields[i].Id} - val.query = q.Root().Select("loadLabelFromID").Arg("id", fields[i].Id) - out = append(out, val) - } - - return out - } - var response []labels - - q = q.Bind(&response) - - err := q.Execute(ctx) - if err != nil { - return nil, err - } - - return convert(response), nil -} - -// Retrieves the list of paths where a directory is mounted. -func (r *Container) Mounts(ctx context.Context) ([]string, error) { - q := r.query.Select("mounts") - - var response []string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// ContainerPipelineOpts contains options for Container.Pipeline -type ContainerPipelineOpts struct { - // Description of the sub-pipeline. - Description string - // Labels to apply to the sub-pipeline. - Labels []PipelineLabel -} - -// Creates a named sub-pipeline. -func (r *Container) Pipeline(name string, opts ...ContainerPipelineOpts) *Container { - q := r.query.Select("pipeline") - for i := len(opts) - 1; i >= 0; i-- { - // `description` optional argument - if !querybuilder.IsZeroValue(opts[i].Description) { - q = q.Arg("description", opts[i].Description) - } - // `labels` optional argument - if !querybuilder.IsZeroValue(opts[i].Labels) { - q = q.Arg("labels", opts[i].Labels) - } - } - q = q.Arg("name", name) - - return &Container{ - query: q, - } -} - -// The platform this container executes and publishes as. -func (r *Container) Platform(ctx context.Context) (Platform, error) { - if r.platform != nil { - return *r.platform, nil - } - q := r.query.Select("platform") - - var response Platform - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// ContainerPublishOpts contains options for Container.Publish -type ContainerPublishOpts struct { - // Identifiers for other platform specific containers. - // - // Used for multi-platform image. - PlatformVariants []*Container - // Force each layer of the published image to use the specified compression algorithm. - // - // If this is unset, then if a layer already has a compressed blob in the engine's cache, that will be used (this can result in a mix of compression algorithms for different layers). If this is unset and a layer has no compressed blob in the engine's cache, then it will be compressed using Gzip. - ForcedCompression ImageLayerCompression - // Use the specified media types for the published image's layers. - // - // Defaults to OCI, which is largely compatible with most recent registries, but Docker may be needed for older registries without OCI support. - MediaTypes ImageMediaTypes -} - -// Publishes this container as a new image to the specified address. -// -// Publish returns a fully qualified ref. -// -// It can also publish platform variants. -func (r *Container) Publish(ctx context.Context, address string, opts ...ContainerPublishOpts) (string, error) { - if r.publish != nil { - return *r.publish, nil - } - q := r.query.Select("publish") - for i := len(opts) - 1; i >= 0; i-- { - // `platformVariants` optional argument - if !querybuilder.IsZeroValue(opts[i].PlatformVariants) { - q = q.Arg("platformVariants", opts[i].PlatformVariants) - } - // `forcedCompression` optional argument - if !querybuilder.IsZeroValue(opts[i].ForcedCompression) { - q = q.Arg("forcedCompression", opts[i].ForcedCompression) - } - // `mediaTypes` optional argument - if !querybuilder.IsZeroValue(opts[i].MediaTypes) { - q = q.Arg("mediaTypes", opts[i].MediaTypes) - } - } - q = q.Arg("address", address) - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Retrieves this container's root filesystem. Mounts are not included. -func (r *Container) Rootfs() *Directory { - q := r.query.Select("rootfs") - - return &Directory{ - query: q, - } -} - -// The error stream of the last executed command. -// -// Will execute default command if none is set, or error if there's no default. -func (r *Container) Stderr(ctx context.Context) (string, error) { - if r.stderr != nil { - return *r.stderr, nil - } - q := r.query.Select("stderr") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// The output stream of the last executed command. -// -// Will execute default command if none is set, or error if there's no default. -func (r *Container) Stdout(ctx context.Context) (string, error) { - if r.stdout != nil { - return *r.stdout, nil - } - q := r.query.Select("stdout") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Forces evaluation of the pipeline in the engine. -// -// It doesn't run the default command if no exec has been set. -func (r *Container) Sync(ctx context.Context) (*Container, error) { - q := r.query.Select("sync") - - return r, q.Execute(ctx) -} - -// ContainerTerminalOpts contains options for Container.Terminal -type ContainerTerminalOpts struct { - // If set, override the container's default terminal command and invoke these command arguments instead. - Cmd []string - // Provides Dagger access to the executed command. - // - // Do not use this option unless you trust the command being executed; the command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM. - ExperimentalPrivilegedNesting bool - // Execute the command with all root capabilities. This is similar to running a command with "sudo" or executing "docker run" with the "--privileged" flag. Containerization does not provide any security guarantees when using this option. It should only be used when absolutely necessary and only with trusted commands. - InsecureRootCapabilities bool -} - -// Return an interactive terminal for this container using its configured default terminal command if not overridden by args (or sh as a fallback default). -func (r *Container) Terminal(opts ...ContainerTerminalOpts) *Terminal { - q := r.query.Select("terminal") - for i := len(opts) - 1; i >= 0; i-- { - // `cmd` optional argument - if !querybuilder.IsZeroValue(opts[i].Cmd) { - q = q.Arg("cmd", opts[i].Cmd) - } - // `experimentalPrivilegedNesting` optional argument - if !querybuilder.IsZeroValue(opts[i].ExperimentalPrivilegedNesting) { - q = q.Arg("experimentalPrivilegedNesting", opts[i].ExperimentalPrivilegedNesting) - } - // `insecureRootCapabilities` optional argument - if !querybuilder.IsZeroValue(opts[i].InsecureRootCapabilities) { - q = q.Arg("insecureRootCapabilities", opts[i].InsecureRootCapabilities) - } - } - - return &Terminal{ - query: q, - } -} - -// Retrieves the user to be set for all commands. -func (r *Container) User(ctx context.Context) (string, error) { - if r.user != nil { - return *r.user, nil - } - q := r.query.Select("user") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Configures default arguments for future commands. -func (r *Container) WithDefaultArgs(args []string) *Container { - q := r.query.Select("withDefaultArgs") - q = q.Arg("args", args) - - return &Container{ - query: q, - } -} - -// ContainerWithDefaultTerminalCmdOpts contains options for Container.WithDefaultTerminalCmd -type ContainerWithDefaultTerminalCmdOpts struct { - // Provides Dagger access to the executed command. - // - // Do not use this option unless you trust the command being executed; the command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM. - ExperimentalPrivilegedNesting bool - // Execute the command with all root capabilities. This is similar to running a command with "sudo" or executing "docker run" with the "--privileged" flag. Containerization does not provide any security guarantees when using this option. It should only be used when absolutely necessary and only with trusted commands. - InsecureRootCapabilities bool -} - -// Set the default command to invoke for the container's terminal API. -func (r *Container) WithDefaultTerminalCmd(args []string, opts ...ContainerWithDefaultTerminalCmdOpts) *Container { - q := r.query.Select("withDefaultTerminalCmd") - for i := len(opts) - 1; i >= 0; i-- { - // `experimentalPrivilegedNesting` optional argument - if !querybuilder.IsZeroValue(opts[i].ExperimentalPrivilegedNesting) { - q = q.Arg("experimentalPrivilegedNesting", opts[i].ExperimentalPrivilegedNesting) - } - // `insecureRootCapabilities` optional argument - if !querybuilder.IsZeroValue(opts[i].InsecureRootCapabilities) { - q = q.Arg("insecureRootCapabilities", opts[i].InsecureRootCapabilities) - } - } - q = q.Arg("args", args) - - return &Container{ - query: q, - } -} - -// ContainerWithDirectoryOpts contains options for Container.WithDirectory -type ContainerWithDirectoryOpts struct { - // Patterns to exclude in the written directory (e.g. ["node_modules/**", ".gitignore", ".git/"]). - Exclude []string - // Patterns to include in the written directory (e.g. ["*.go", "go.mod", "go.sum"]). - Include []string - // A user:group to set for the directory and its contents. - // - // The user and group can either be an ID (1000:1000) or a name (foo:bar). - // - // If the group is omitted, it defaults to the same as the user. - Owner string -} - -// Retrieves this container plus a directory written at the given path. -func (r *Container) WithDirectory(path string, directory *Directory, opts ...ContainerWithDirectoryOpts) *Container { - assertNotNil("directory", directory) - q := r.query.Select("withDirectory") - for i := len(opts) - 1; i >= 0; i-- { - // `exclude` optional argument - if !querybuilder.IsZeroValue(opts[i].Exclude) { - q = q.Arg("exclude", opts[i].Exclude) - } - // `include` optional argument - if !querybuilder.IsZeroValue(opts[i].Include) { - q = q.Arg("include", opts[i].Include) - } - // `owner` optional argument - if !querybuilder.IsZeroValue(opts[i].Owner) { - q = q.Arg("owner", opts[i].Owner) - } - } - q = q.Arg("path", path) - q = q.Arg("directory", directory) - - return &Container{ - query: q, - } -} - -// ContainerWithEntrypointOpts contains options for Container.WithEntrypoint -type ContainerWithEntrypointOpts struct { - // Don't remove the default arguments when setting the entrypoint. - KeepDefaultArgs bool -} - -// Retrieves this container but with a different command entrypoint. -func (r *Container) WithEntrypoint(args []string, opts ...ContainerWithEntrypointOpts) *Container { - q := r.query.Select("withEntrypoint") - for i := len(opts) - 1; i >= 0; i-- { - // `keepDefaultArgs` optional argument - if !querybuilder.IsZeroValue(opts[i].KeepDefaultArgs) { - q = q.Arg("keepDefaultArgs", opts[i].KeepDefaultArgs) - } - } - q = q.Arg("args", args) - - return &Container{ - query: q, - } -} - -// ContainerWithEnvVariableOpts contains options for Container.WithEnvVariable -type ContainerWithEnvVariableOpts struct { - // Replace `${VAR}` or `$VAR` in the value according to the current environment variables defined in the container (e.g., "/opt/bin:$PATH"). - Expand bool -} - -// Retrieves this container plus the given environment variable. -func (r *Container) WithEnvVariable(name string, value string, opts ...ContainerWithEnvVariableOpts) *Container { - q := r.query.Select("withEnvVariable") - for i := len(opts) - 1; i >= 0; i-- { - // `expand` optional argument - if !querybuilder.IsZeroValue(opts[i].Expand) { - q = q.Arg("expand", opts[i].Expand) - } - } - q = q.Arg("name", name) - q = q.Arg("value", value) - - return &Container{ - query: q, - } -} - -// ContainerWithExecOpts contains options for Container.WithExec -type ContainerWithExecOpts struct { - // If the container has an entrypoint, ignore it for args rather than using it to wrap them. - SkipEntrypoint bool - // Content to write to the command's standard input before closing (e.g., "Hello world"). - Stdin string - // Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout"). - RedirectStdout string - // Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr"). - RedirectStderr string - // Provides Dagger access to the executed command. - // - // Do not use this option unless you trust the command being executed; the command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM. - ExperimentalPrivilegedNesting bool - // Execute the command with all root capabilities. This is similar to running a command with "sudo" or executing "docker run" with the "--privileged" flag. Containerization does not provide any security guarantees when using this option. It should only be used when absolutely necessary and only with trusted commands. - InsecureRootCapabilities bool -} - -// Retrieves this container after executing the specified command inside it. -func (r *Container) WithExec(args []string, opts ...ContainerWithExecOpts) *Container { - q := r.query.Select("withExec") - for i := len(opts) - 1; i >= 0; i-- { - // `skipEntrypoint` optional argument - if !querybuilder.IsZeroValue(opts[i].SkipEntrypoint) { - q = q.Arg("skipEntrypoint", opts[i].SkipEntrypoint) - } - // `stdin` optional argument - if !querybuilder.IsZeroValue(opts[i].Stdin) { - q = q.Arg("stdin", opts[i].Stdin) - } - // `redirectStdout` optional argument - if !querybuilder.IsZeroValue(opts[i].RedirectStdout) { - q = q.Arg("redirectStdout", opts[i].RedirectStdout) - } - // `redirectStderr` optional argument - if !querybuilder.IsZeroValue(opts[i].RedirectStderr) { - q = q.Arg("redirectStderr", opts[i].RedirectStderr) - } - // `experimentalPrivilegedNesting` optional argument - if !querybuilder.IsZeroValue(opts[i].ExperimentalPrivilegedNesting) { - q = q.Arg("experimentalPrivilegedNesting", opts[i].ExperimentalPrivilegedNesting) - } - // `insecureRootCapabilities` optional argument - if !querybuilder.IsZeroValue(opts[i].InsecureRootCapabilities) { - q = q.Arg("insecureRootCapabilities", opts[i].InsecureRootCapabilities) - } - } - q = q.Arg("args", args) - - return &Container{ - query: q, - } -} - -// ContainerWithExposedPortOpts contains options for Container.WithExposedPort -type ContainerWithExposedPortOpts struct { - // Transport layer network protocol - Protocol NetworkProtocol - // Optional port description - Description string - // Skip the health check when run as a service. - ExperimentalSkipHealthcheck bool -} - -// Expose a network port. -// -// Exposed ports serve two purposes: -// -// - For health checks and introspection, when running services -// -// - For setting the EXPOSE OCI field when publishing the container -func (r *Container) WithExposedPort(port int, opts ...ContainerWithExposedPortOpts) *Container { - q := r.query.Select("withExposedPort") - for i := len(opts) - 1; i >= 0; i-- { - // `protocol` optional argument - if !querybuilder.IsZeroValue(opts[i].Protocol) { - q = q.Arg("protocol", opts[i].Protocol) - } - // `description` optional argument - if !querybuilder.IsZeroValue(opts[i].Description) { - q = q.Arg("description", opts[i].Description) - } - // `experimentalSkipHealthcheck` optional argument - if !querybuilder.IsZeroValue(opts[i].ExperimentalSkipHealthcheck) { - q = q.Arg("experimentalSkipHealthcheck", opts[i].ExperimentalSkipHealthcheck) - } - } - q = q.Arg("port", port) - - return &Container{ - query: q, - } -} - -// ContainerWithFileOpts contains options for Container.WithFile -type ContainerWithFileOpts struct { - // Permission given to the copied file (e.g., 0600). - Permissions int - // A user:group to set for the file. - // - // The user and group can either be an ID (1000:1000) or a name (foo:bar). - // - // If the group is omitted, it defaults to the same as the user. - Owner string -} - -// Retrieves this container plus the contents of the given file copied to the given path. -func (r *Container) WithFile(path string, source *File, opts ...ContainerWithFileOpts) *Container { - assertNotNil("source", source) - q := r.query.Select("withFile") - for i := len(opts) - 1; i >= 0; i-- { - // `permissions` optional argument - if !querybuilder.IsZeroValue(opts[i].Permissions) { - q = q.Arg("permissions", opts[i].Permissions) - } - // `owner` optional argument - if !querybuilder.IsZeroValue(opts[i].Owner) { - q = q.Arg("owner", opts[i].Owner) - } - } - q = q.Arg("path", path) - q = q.Arg("source", source) - - return &Container{ - query: q, - } -} - -// ContainerWithFilesOpts contains options for Container.WithFiles -type ContainerWithFilesOpts struct { - // Permission given to the copied files (e.g., 0600). - Permissions int - // A user:group to set for the files. - // - // The user and group can either be an ID (1000:1000) or a name (foo:bar). - // - // If the group is omitted, it defaults to the same as the user. - Owner string -} - -// Retrieves this container plus the contents of the given files copied to the given path. -func (r *Container) WithFiles(path string, sources []*File, opts ...ContainerWithFilesOpts) *Container { - q := r.query.Select("withFiles") - for i := len(opts) - 1; i >= 0; i-- { - // `permissions` optional argument - if !querybuilder.IsZeroValue(opts[i].Permissions) { - q = q.Arg("permissions", opts[i].Permissions) - } - // `owner` optional argument - if !querybuilder.IsZeroValue(opts[i].Owner) { - q = q.Arg("owner", opts[i].Owner) - } - } - q = q.Arg("path", path) - q = q.Arg("sources", sources) - - return &Container{ - query: q, - } -} - -// Indicate that subsequent operations should be featured more prominently in the UI. -func (r *Container) WithFocus() *Container { - q := r.query.Select("withFocus") - - return &Container{ - query: q, - } -} - -// Retrieves this container plus the given label. -func (r *Container) WithLabel(name string, value string) *Container { - q := r.query.Select("withLabel") - q = q.Arg("name", name) - q = q.Arg("value", value) - - return &Container{ - query: q, - } -} - -// ContainerWithMountedCacheOpts contains options for Container.WithMountedCache -type ContainerWithMountedCacheOpts struct { - // Identifier of the directory to use as the cache volume's root. - Source *Directory - // Sharing mode of the cache volume. - Sharing CacheSharingMode - // A user:group to set for the mounted cache directory. - // - // Note that this changes the ownership of the specified mount along with the initial filesystem provided by source (if any). It does not have any effect if/when the cache has already been created. - // - // The user and group can either be an ID (1000:1000) or a name (foo:bar). - // - // If the group is omitted, it defaults to the same as the user. - Owner string -} - -// Retrieves this container plus a cache volume mounted at the given path. -func (r *Container) WithMountedCache(path string, cache *CacheVolume, opts ...ContainerWithMountedCacheOpts) *Container { - assertNotNil("cache", cache) - q := r.query.Select("withMountedCache") - for i := len(opts) - 1; i >= 0; i-- { - // `source` optional argument - if !querybuilder.IsZeroValue(opts[i].Source) { - q = q.Arg("source", opts[i].Source) - } - // `sharing` optional argument - if !querybuilder.IsZeroValue(opts[i].Sharing) { - q = q.Arg("sharing", opts[i].Sharing) - } - // `owner` optional argument - if !querybuilder.IsZeroValue(opts[i].Owner) { - q = q.Arg("owner", opts[i].Owner) - } - } - q = q.Arg("path", path) - q = q.Arg("cache", cache) - - return &Container{ - query: q, - } -} - -// ContainerWithMountedDirectoryOpts contains options for Container.WithMountedDirectory -type ContainerWithMountedDirectoryOpts struct { - // A user:group to set for the mounted directory and its contents. - // - // The user and group can either be an ID (1000:1000) or a name (foo:bar). - // - // If the group is omitted, it defaults to the same as the user. - Owner string -} - -// Retrieves this container plus a directory mounted at the given path. -func (r *Container) WithMountedDirectory(path string, source *Directory, opts ...ContainerWithMountedDirectoryOpts) *Container { - assertNotNil("source", source) - q := r.query.Select("withMountedDirectory") - for i := len(opts) - 1; i >= 0; i-- { - // `owner` optional argument - if !querybuilder.IsZeroValue(opts[i].Owner) { - q = q.Arg("owner", opts[i].Owner) - } - } - q = q.Arg("path", path) - q = q.Arg("source", source) - - return &Container{ - query: q, - } -} - -// ContainerWithMountedFileOpts contains options for Container.WithMountedFile -type ContainerWithMountedFileOpts struct { - // A user or user:group to set for the mounted file. - // - // The user and group can either be an ID (1000:1000) or a name (foo:bar). - // - // If the group is omitted, it defaults to the same as the user. - Owner string -} - -// Retrieves this container plus a file mounted at the given path. -func (r *Container) WithMountedFile(path string, source *File, opts ...ContainerWithMountedFileOpts) *Container { - assertNotNil("source", source) - q := r.query.Select("withMountedFile") - for i := len(opts) - 1; i >= 0; i-- { - // `owner` optional argument - if !querybuilder.IsZeroValue(opts[i].Owner) { - q = q.Arg("owner", opts[i].Owner) - } - } - q = q.Arg("path", path) - q = q.Arg("source", source) - - return &Container{ - query: q, - } -} - -// ContainerWithMountedSecretOpts contains options for Container.WithMountedSecret -type ContainerWithMountedSecretOpts struct { - // A user:group to set for the mounted secret. - // - // The user and group can either be an ID (1000:1000) or a name (foo:bar). - // - // If the group is omitted, it defaults to the same as the user. - Owner string - // Permission given to the mounted secret (e.g., 0600). - // - // This option requires an owner to be set to be active. - Mode int -} - -// Retrieves this container plus a secret mounted into a file at the given path. -func (r *Container) WithMountedSecret(path string, source *Secret, opts ...ContainerWithMountedSecretOpts) *Container { - assertNotNil("source", source) - q := r.query.Select("withMountedSecret") - for i := len(opts) - 1; i >= 0; i-- { - // `owner` optional argument - if !querybuilder.IsZeroValue(opts[i].Owner) { - q = q.Arg("owner", opts[i].Owner) - } - // `mode` optional argument - if !querybuilder.IsZeroValue(opts[i].Mode) { - q = q.Arg("mode", opts[i].Mode) - } - } - q = q.Arg("path", path) - q = q.Arg("source", source) - - return &Container{ - query: q, - } -} - -// Retrieves this container plus a temporary directory mounted at the given path. Any writes will be ephemeral to a single withExec call; they will not be persisted to subsequent withExecs. -func (r *Container) WithMountedTemp(path string) *Container { - q := r.query.Select("withMountedTemp") - q = q.Arg("path", path) - - return &Container{ - query: q, - } -} - -// ContainerWithNewFileOpts contains options for Container.WithNewFile -type ContainerWithNewFileOpts struct { - // Content of the file to write (e.g., "Hello world!"). - Contents string - // Permission given to the written file (e.g., 0600). - Permissions int - // A user:group to set for the file. - // - // The user and group can either be an ID (1000:1000) or a name (foo:bar). - // - // If the group is omitted, it defaults to the same as the user. - Owner string -} - -// Retrieves this container plus a new file written at the given path. -func (r *Container) WithNewFile(path string, opts ...ContainerWithNewFileOpts) *Container { - q := r.query.Select("withNewFile") - for i := len(opts) - 1; i >= 0; i-- { - // `contents` optional argument - if !querybuilder.IsZeroValue(opts[i].Contents) { - q = q.Arg("contents", opts[i].Contents) - } - // `permissions` optional argument - if !querybuilder.IsZeroValue(opts[i].Permissions) { - q = q.Arg("permissions", opts[i].Permissions) - } - // `owner` optional argument - if !querybuilder.IsZeroValue(opts[i].Owner) { - q = q.Arg("owner", opts[i].Owner) - } - } - q = q.Arg("path", path) - - return &Container{ - query: q, - } -} - -// Retrieves this container with a registry authentication for a given address. -func (r *Container) WithRegistryAuth(address string, username string, secret *Secret) *Container { - assertNotNil("secret", secret) - q := r.query.Select("withRegistryAuth") - q = q.Arg("address", address) - q = q.Arg("username", username) - q = q.Arg("secret", secret) - - return &Container{ - query: q, - } -} - -// Retrieves the container with the given directory mounted to /. -func (r *Container) WithRootfs(directory *Directory) *Container { - assertNotNil("directory", directory) - q := r.query.Select("withRootfs") - q = q.Arg("directory", directory) - - return &Container{ - query: q, - } -} - -// Retrieves this container plus an env variable containing the given secret. -func (r *Container) WithSecretVariable(name string, secret *Secret) *Container { - assertNotNil("secret", secret) - q := r.query.Select("withSecretVariable") - q = q.Arg("name", name) - q = q.Arg("secret", secret) - - return &Container{ - query: q, - } -} - -// Establish a runtime dependency on a service. -// -// The service will be started automatically when needed and detached when it is no longer needed, executing the default command if none is set. -// -// The service will be reachable from the container via the provided hostname alias. -// -// The service dependency will also convey to any files or directories produced by the container. -func (r *Container) WithServiceBinding(alias string, service *Service) *Container { - assertNotNil("service", service) - q := r.query.Select("withServiceBinding") - q = q.Arg("alias", alias) - q = q.Arg("service", service) - - return &Container{ - query: q, - } -} - -// ContainerWithUnixSocketOpts contains options for Container.WithUnixSocket -type ContainerWithUnixSocketOpts struct { - // A user:group to set for the mounted socket. - // - // The user and group can either be an ID (1000:1000) or a name (foo:bar). - // - // If the group is omitted, it defaults to the same as the user. - Owner string -} - -// Retrieves this container plus a socket forwarded to the given Unix socket path. -func (r *Container) WithUnixSocket(path string, source *Socket, opts ...ContainerWithUnixSocketOpts) *Container { - assertNotNil("source", source) - q := r.query.Select("withUnixSocket") - for i := len(opts) - 1; i >= 0; i-- { - // `owner` optional argument - if !querybuilder.IsZeroValue(opts[i].Owner) { - q = q.Arg("owner", opts[i].Owner) - } - } - q = q.Arg("path", path) - q = q.Arg("source", source) - - return &Container{ - query: q, - } -} - -// Retrieves this container with a different command user. -func (r *Container) WithUser(name string) *Container { - q := r.query.Select("withUser") - q = q.Arg("name", name) - - return &Container{ - query: q, - } -} - -// Retrieves this container with a different working directory. -func (r *Container) WithWorkdir(path string) *Container { - q := r.query.Select("withWorkdir") - q = q.Arg("path", path) - - return &Container{ - query: q, - } -} - -// Retrieves this container with unset default arguments for future commands. -func (r *Container) WithoutDefaultArgs() *Container { - q := r.query.Select("withoutDefaultArgs") - - return &Container{ - query: q, - } -} - -// Retrieves this container with the directory at the given path removed. -func (r *Container) WithoutDirectory(path string) *Container { - q := r.query.Select("withoutDirectory") - q = q.Arg("path", path) - - return &Container{ - query: q, - } -} - -// ContainerWithoutEntrypointOpts contains options for Container.WithoutEntrypoint -type ContainerWithoutEntrypointOpts struct { - // Don't remove the default arguments when unsetting the entrypoint. - KeepDefaultArgs bool -} - -// Retrieves this container with an unset command entrypoint. -func (r *Container) WithoutEntrypoint(opts ...ContainerWithoutEntrypointOpts) *Container { - q := r.query.Select("withoutEntrypoint") - for i := len(opts) - 1; i >= 0; i-- { - // `keepDefaultArgs` optional argument - if !querybuilder.IsZeroValue(opts[i].KeepDefaultArgs) { - q = q.Arg("keepDefaultArgs", opts[i].KeepDefaultArgs) - } - } - - return &Container{ - query: q, - } -} - -// Retrieves this container minus the given environment variable. -func (r *Container) WithoutEnvVariable(name string) *Container { - q := r.query.Select("withoutEnvVariable") - q = q.Arg("name", name) - - return &Container{ - query: q, - } -} - -// ContainerWithoutExposedPortOpts contains options for Container.WithoutExposedPort -type ContainerWithoutExposedPortOpts struct { - // Port protocol to unexpose - Protocol NetworkProtocol -} - -// Unexpose a previously exposed port. -func (r *Container) WithoutExposedPort(port int, opts ...ContainerWithoutExposedPortOpts) *Container { - q := r.query.Select("withoutExposedPort") - for i := len(opts) - 1; i >= 0; i-- { - // `protocol` optional argument - if !querybuilder.IsZeroValue(opts[i].Protocol) { - q = q.Arg("protocol", opts[i].Protocol) - } - } - q = q.Arg("port", port) - - return &Container{ - query: q, - } -} - -// Retrieves this container with the file at the given path removed. -func (r *Container) WithoutFile(path string) *Container { - q := r.query.Select("withoutFile") - q = q.Arg("path", path) - - return &Container{ - query: q, - } -} - -// Indicate that subsequent operations should not be featured more prominently in the UI. -// -// This is the initial state of all containers. -func (r *Container) WithoutFocus() *Container { - q := r.query.Select("withoutFocus") - - return &Container{ - query: q, - } -} - -// Retrieves this container minus the given environment label. -func (r *Container) WithoutLabel(name string) *Container { - q := r.query.Select("withoutLabel") - q = q.Arg("name", name) - - return &Container{ - query: q, - } -} - -// Retrieves this container after unmounting everything at the given path. -func (r *Container) WithoutMount(path string) *Container { - q := r.query.Select("withoutMount") - q = q.Arg("path", path) - - return &Container{ - query: q, - } -} - -// Retrieves this container without the registry authentication of a given address. -func (r *Container) WithoutRegistryAuth(address string) *Container { - q := r.query.Select("withoutRegistryAuth") - q = q.Arg("address", address) - - return &Container{ - query: q, - } -} - -// Retrieves this container minus the given environment variable containing the secret. -func (r *Container) WithoutSecretVariable(name string) *Container { - q := r.query.Select("withoutSecretVariable") - q = q.Arg("name", name) - - return &Container{ - query: q, - } -} - -// Retrieves this container with a previously added Unix socket removed. -func (r *Container) WithoutUnixSocket(path string) *Container { - q := r.query.Select("withoutUnixSocket") - q = q.Arg("path", path) - - return &Container{ - query: q, - } -} - -// Retrieves this container with an unset command user. -// -// Should default to root. -func (r *Container) WithoutUser() *Container { - q := r.query.Select("withoutUser") - - return &Container{ - query: q, - } -} - -// Retrieves this container with an unset working directory. -// -// Should default to "/". -func (r *Container) WithoutWorkdir() *Container { - q := r.query.Select("withoutWorkdir") - - return &Container{ - query: q, - } -} - -// Retrieves the working directory for all commands. -func (r *Container) Workdir(ctx context.Context) (string, error) { - if r.workdir != nil { - return *r.workdir, nil - } - q := r.query.Select("workdir") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Reflective module API provided to functions at runtime. -type CurrentModule struct { - query *querybuilder.Selection - - id *CurrentModuleID - name *string -} - -func (r *CurrentModule) WithGraphQLQuery(q *querybuilder.Selection) *CurrentModule { - return &CurrentModule{ - query: q, - } -} - -// A unique identifier for this CurrentModule. -func (r *CurrentModule) ID(ctx context.Context) (CurrentModuleID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response CurrentModuleID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *CurrentModule) XXX_GraphQLType() string { - return "CurrentModule" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *CurrentModule) XXX_GraphQLIDType() string { - return "CurrentModuleID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *CurrentModule) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *CurrentModule) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// The name of the module being executed in -func (r *CurrentModule) Name(ctx context.Context) (string, error) { - if r.name != nil { - return *r.name, nil - } - q := r.query.Select("name") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// The directory containing the module's source code loaded into the engine (plus any generated code that may have been created). -func (r *CurrentModule) Source() *Directory { - q := r.query.Select("source") - - return &Directory{ - query: q, - } -} - -// CurrentModuleWorkdirOpts contains options for CurrentModule.Workdir -type CurrentModuleWorkdirOpts struct { - // Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]). - Exclude []string - // Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]). - Include []string -} - -// Load a directory from the module's scratch working directory, including any changes that may have been made to it during module function execution. -func (r *CurrentModule) Workdir(path string, opts ...CurrentModuleWorkdirOpts) *Directory { - q := r.query.Select("workdir") - for i := len(opts) - 1; i >= 0; i-- { - // `exclude` optional argument - if !querybuilder.IsZeroValue(opts[i].Exclude) { - q = q.Arg("exclude", opts[i].Exclude) - } - // `include` optional argument - if !querybuilder.IsZeroValue(opts[i].Include) { - q = q.Arg("include", opts[i].Include) - } - } - q = q.Arg("path", path) - - return &Directory{ - query: q, - } -} - -// Load a file from the module's scratch working directory, including any changes that may have been made to it during module function execution.Load a file from the module's scratch working directory, including any changes that may have been made to it during module function execution. -func (r *CurrentModule) WorkdirFile(path string) *File { - q := r.query.Select("workdirFile") - q = q.Arg("path", path) - - return &File{ - query: q, - } -} - -// A directory. -type Directory struct { - query *querybuilder.Selection - - export *bool - id *DirectoryID - sync *DirectoryID -} -type WithDirectoryFunc func(r *Directory) *Directory - -// With calls the provided function with current Directory. -// -// This is useful for reusability and readability by not breaking the calling chain. -func (r *Directory) With(f WithDirectoryFunc) *Directory { - return f(r) -} - -func (r *Directory) WithGraphQLQuery(q *querybuilder.Selection) *Directory { - return &Directory{ - query: q, - } -} - -// DirectoryAsModuleOpts contains options for Directory.AsModule -type DirectoryAsModuleOpts struct { - // An optional subpath of the directory which contains the module's configuration file. - // - // This is needed when the module code is in a subdirectory but requires parent directories to be loaded in order to execute. For example, the module source code may need a go.mod, project.toml, package.json, etc. file from a parent directory. - // - // If not set, the module source code is loaded from the root of the directory. - SourceRootPath string -} - -// Load the directory as a Dagger module -func (r *Directory) AsModule(opts ...DirectoryAsModuleOpts) *Module { - q := r.query.Select("asModule") - for i := len(opts) - 1; i >= 0; i-- { - // `sourceRootPath` optional argument - if !querybuilder.IsZeroValue(opts[i].SourceRootPath) { - q = q.Arg("sourceRootPath", opts[i].SourceRootPath) - } - } - - return &Module{ - query: q, - } -} - -// Gets the difference between this directory and an another directory. -func (r *Directory) Diff(other *Directory) *Directory { - assertNotNil("other", other) - q := r.query.Select("diff") - q = q.Arg("other", other) - - return &Directory{ - query: q, - } -} - -// Retrieves a directory at the given path. -func (r *Directory) Directory(path string) *Directory { - q := r.query.Select("directory") - q = q.Arg("path", path) - - return &Directory{ - query: q, - } -} - -// DirectoryDockerBuildOpts contains options for Directory.DockerBuild -type DirectoryDockerBuildOpts struct { - // The platform to build. - Platform Platform - // Path to the Dockerfile to use (e.g., "frontend.Dockerfile"). - Dockerfile string - // Target build stage to build. - Target string - // Build arguments to use in the build. - BuildArgs []BuildArg - // Secrets to pass to the build. - // - // They will be mounted at /run/secrets/[secret-name]. - Secrets []*Secret -} - -// Builds a new Docker container from this directory. -func (r *Directory) DockerBuild(opts ...DirectoryDockerBuildOpts) *Container { - q := r.query.Select("dockerBuild") - for i := len(opts) - 1; i >= 0; i-- { - // `platform` optional argument - if !querybuilder.IsZeroValue(opts[i].Platform) { - q = q.Arg("platform", opts[i].Platform) - } - // `dockerfile` optional argument - if !querybuilder.IsZeroValue(opts[i].Dockerfile) { - q = q.Arg("dockerfile", opts[i].Dockerfile) - } - // `target` optional argument - if !querybuilder.IsZeroValue(opts[i].Target) { - q = q.Arg("target", opts[i].Target) - } - // `buildArgs` optional argument - if !querybuilder.IsZeroValue(opts[i].BuildArgs) { - q = q.Arg("buildArgs", opts[i].BuildArgs) - } - // `secrets` optional argument - if !querybuilder.IsZeroValue(opts[i].Secrets) { - q = q.Arg("secrets", opts[i].Secrets) - } - } - - return &Container{ - query: q, - } -} - -// DirectoryEntriesOpts contains options for Directory.Entries -type DirectoryEntriesOpts struct { - // Location of the directory to look at (e.g., "/src"). - Path string -} - -// Returns a list of files and directories at the given path. -func (r *Directory) Entries(ctx context.Context, opts ...DirectoryEntriesOpts) ([]string, error) { - q := r.query.Select("entries") - for i := len(opts) - 1; i >= 0; i-- { - // `path` optional argument - if !querybuilder.IsZeroValue(opts[i].Path) { - q = q.Arg("path", opts[i].Path) - } - } - - var response []string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// DirectoryExportOpts contains options for Directory.Export -type DirectoryExportOpts struct { - // If true, then the host directory will be wiped clean before exporting so that it exactly matches the directory being exported; this means it will delete any files on the host that aren't in the exported dir. If false (the default), the contents of the directory will be merged with any existing contents of the host directory, leaving any existing files on the host that aren't in the exported directory alone. - Wipe bool -} - -// Writes the contents of the directory to a path on the host. -func (r *Directory) Export(ctx context.Context, path string, opts ...DirectoryExportOpts) (bool, error) { - if r.export != nil { - return *r.export, nil - } - q := r.query.Select("export") - for i := len(opts) - 1; i >= 0; i-- { - // `wipe` optional argument - if !querybuilder.IsZeroValue(opts[i].Wipe) { - q = q.Arg("wipe", opts[i].Wipe) - } - } - q = q.Arg("path", path) - - var response bool - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Retrieves a file at the given path. -func (r *Directory) File(path string) *File { - q := r.query.Select("file") - q = q.Arg("path", path) - - return &File{ - query: q, - } -} - -// Returns a list of files and directories that matche the given pattern. -func (r *Directory) Glob(ctx context.Context, pattern string) ([]string, error) { - q := r.query.Select("glob") - q = q.Arg("pattern", pattern) - - var response []string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A unique identifier for this Directory. -func (r *Directory) ID(ctx context.Context) (DirectoryID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response DirectoryID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *Directory) XXX_GraphQLType() string { - return "Directory" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *Directory) XXX_GraphQLIDType() string { - return "DirectoryID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *Directory) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *Directory) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// DirectoryPipelineOpts contains options for Directory.Pipeline -type DirectoryPipelineOpts struct { - // Description of the sub-pipeline. - Description string - // Labels to apply to the sub-pipeline. - Labels []PipelineLabel -} - -// Creates a named sub-pipeline. -func (r *Directory) Pipeline(name string, opts ...DirectoryPipelineOpts) *Directory { - q := r.query.Select("pipeline") - for i := len(opts) - 1; i >= 0; i-- { - // `description` optional argument - if !querybuilder.IsZeroValue(opts[i].Description) { - q = q.Arg("description", opts[i].Description) - } - // `labels` optional argument - if !querybuilder.IsZeroValue(opts[i].Labels) { - q = q.Arg("labels", opts[i].Labels) - } - } - q = q.Arg("name", name) - - return &Directory{ - query: q, - } -} - -// Force evaluation in the engine. -func (r *Directory) Sync(ctx context.Context) (*Directory, error) { - q := r.query.Select("sync") - - return r, q.Execute(ctx) -} - -// DirectoryWithDirectoryOpts contains options for Directory.WithDirectory -type DirectoryWithDirectoryOpts struct { - // Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]). - Exclude []string - // Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]). - Include []string -} - -// Retrieves this directory plus a directory written at the given path. -func (r *Directory) WithDirectory(path string, directory *Directory, opts ...DirectoryWithDirectoryOpts) *Directory { - assertNotNil("directory", directory) - q := r.query.Select("withDirectory") - for i := len(opts) - 1; i >= 0; i-- { - // `exclude` optional argument - if !querybuilder.IsZeroValue(opts[i].Exclude) { - q = q.Arg("exclude", opts[i].Exclude) - } - // `include` optional argument - if !querybuilder.IsZeroValue(opts[i].Include) { - q = q.Arg("include", opts[i].Include) - } - } - q = q.Arg("path", path) - q = q.Arg("directory", directory) - - return &Directory{ - query: q, - } -} - -// DirectoryWithFileOpts contains options for Directory.WithFile -type DirectoryWithFileOpts struct { - // Permission given to the copied file (e.g., 0600). - Permissions int -} - -// Retrieves this directory plus the contents of the given file copied to the given path. -func (r *Directory) WithFile(path string, source *File, opts ...DirectoryWithFileOpts) *Directory { - assertNotNil("source", source) - q := r.query.Select("withFile") - for i := len(opts) - 1; i >= 0; i-- { - // `permissions` optional argument - if !querybuilder.IsZeroValue(opts[i].Permissions) { - q = q.Arg("permissions", opts[i].Permissions) - } - } - q = q.Arg("path", path) - q = q.Arg("source", source) - - return &Directory{ - query: q, - } -} - -// DirectoryWithFilesOpts contains options for Directory.WithFiles -type DirectoryWithFilesOpts struct { - // Permission given to the copied files (e.g., 0600). - Permissions int -} - -// Retrieves this directory plus the contents of the given files copied to the given path. -func (r *Directory) WithFiles(path string, sources []*File, opts ...DirectoryWithFilesOpts) *Directory { - q := r.query.Select("withFiles") - for i := len(opts) - 1; i >= 0; i-- { - // `permissions` optional argument - if !querybuilder.IsZeroValue(opts[i].Permissions) { - q = q.Arg("permissions", opts[i].Permissions) - } - } - q = q.Arg("path", path) - q = q.Arg("sources", sources) - - return &Directory{ - query: q, - } -} - -// DirectoryWithNewDirectoryOpts contains options for Directory.WithNewDirectory -type DirectoryWithNewDirectoryOpts struct { - // Permission granted to the created directory (e.g., 0777). - Permissions int -} - -// Retrieves this directory plus a new directory created at the given path. -func (r *Directory) WithNewDirectory(path string, opts ...DirectoryWithNewDirectoryOpts) *Directory { - q := r.query.Select("withNewDirectory") - for i := len(opts) - 1; i >= 0; i-- { - // `permissions` optional argument - if !querybuilder.IsZeroValue(opts[i].Permissions) { - q = q.Arg("permissions", opts[i].Permissions) - } - } - q = q.Arg("path", path) - - return &Directory{ - query: q, - } -} - -// DirectoryWithNewFileOpts contains options for Directory.WithNewFile -type DirectoryWithNewFileOpts struct { - // Permission given to the copied file (e.g., 0600). - Permissions int -} - -// Retrieves this directory plus a new file written at the given path. -func (r *Directory) WithNewFile(path string, contents string, opts ...DirectoryWithNewFileOpts) *Directory { - q := r.query.Select("withNewFile") - for i := len(opts) - 1; i >= 0; i-- { - // `permissions` optional argument - if !querybuilder.IsZeroValue(opts[i].Permissions) { - q = q.Arg("permissions", opts[i].Permissions) - } - } - q = q.Arg("path", path) - q = q.Arg("contents", contents) - - return &Directory{ - query: q, - } -} - -// Retrieves this directory with all file/dir timestamps set to the given time. -func (r *Directory) WithTimestamps(timestamp int) *Directory { - q := r.query.Select("withTimestamps") - q = q.Arg("timestamp", timestamp) - - return &Directory{ - query: q, - } -} - -// Retrieves this directory with the directory at the given path removed. -func (r *Directory) WithoutDirectory(path string) *Directory { - q := r.query.Select("withoutDirectory") - q = q.Arg("path", path) - - return &Directory{ - query: q, - } -} - -// Retrieves this directory with the file at the given path removed. -func (r *Directory) WithoutFile(path string) *Directory { - q := r.query.Select("withoutFile") - q = q.Arg("path", path) - - return &Directory{ - query: q, - } -} - -// An environment variable name and value. -type EnvVariable struct { - query *querybuilder.Selection - - id *EnvVariableID - name *string - value *string -} - -func (r *EnvVariable) WithGraphQLQuery(q *querybuilder.Selection) *EnvVariable { - return &EnvVariable{ - query: q, - } -} - -// A unique identifier for this EnvVariable. -func (r *EnvVariable) ID(ctx context.Context) (EnvVariableID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response EnvVariableID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *EnvVariable) XXX_GraphQLType() string { - return "EnvVariable" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *EnvVariable) XXX_GraphQLIDType() string { - return "EnvVariableID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *EnvVariable) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *EnvVariable) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// The environment variable name. -func (r *EnvVariable) Name(ctx context.Context) (string, error) { - if r.name != nil { - return *r.name, nil - } - q := r.query.Select("name") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// The environment variable value. -func (r *EnvVariable) Value(ctx context.Context) (string, error) { - if r.value != nil { - return *r.value, nil - } - q := r.query.Select("value") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A definition of a field on a custom object defined in a Module. -// -// A field on an object has a static value, as opposed to a function on an object whose value is computed by invoking code (and can accept arguments). -type FieldTypeDef struct { - query *querybuilder.Selection - - description *string - id *FieldTypeDefID - name *string -} - -func (r *FieldTypeDef) WithGraphQLQuery(q *querybuilder.Selection) *FieldTypeDef { - return &FieldTypeDef{ - query: q, - } -} - -// A doc string for the field, if any. -func (r *FieldTypeDef) Description(ctx context.Context) (string, error) { - if r.description != nil { - return *r.description, nil - } - q := r.query.Select("description") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A unique identifier for this FieldTypeDef. -func (r *FieldTypeDef) ID(ctx context.Context) (FieldTypeDefID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response FieldTypeDefID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *FieldTypeDef) XXX_GraphQLType() string { - return "FieldTypeDef" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *FieldTypeDef) XXX_GraphQLIDType() string { - return "FieldTypeDefID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *FieldTypeDef) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *FieldTypeDef) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// The name of the field in lowerCamelCase format. -func (r *FieldTypeDef) Name(ctx context.Context) (string, error) { - if r.name != nil { - return *r.name, nil - } - q := r.query.Select("name") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// The type of the field. -func (r *FieldTypeDef) TypeDef() *TypeDef { - q := r.query.Select("typeDef") - - return &TypeDef{ - query: q, - } -} - -// A file. -type File struct { - query *querybuilder.Selection - - contents *string - export *bool - id *FileID - name *string - size *int - sync *FileID -} -type WithFileFunc func(r *File) *File - -// With calls the provided function with current File. -// -// This is useful for reusability and readability by not breaking the calling chain. -func (r *File) With(f WithFileFunc) *File { - return f(r) -} - -func (r *File) WithGraphQLQuery(q *querybuilder.Selection) *File { - return &File{ - query: q, - } -} - -// Retrieves the contents of the file. -func (r *File) Contents(ctx context.Context) (string, error) { - if r.contents != nil { - return *r.contents, nil - } - q := r.query.Select("contents") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// FileExportOpts contains options for File.Export -type FileExportOpts struct { - // If allowParentDirPath is true, the path argument can be a directory path, in which case the file will be created in that directory. - AllowParentDirPath bool -} - -// Writes the file to a file path on the host. -func (r *File) Export(ctx context.Context, path string, opts ...FileExportOpts) (bool, error) { - if r.export != nil { - return *r.export, nil - } - q := r.query.Select("export") - for i := len(opts) - 1; i >= 0; i-- { - // `allowParentDirPath` optional argument - if !querybuilder.IsZeroValue(opts[i].AllowParentDirPath) { - q = q.Arg("allowParentDirPath", opts[i].AllowParentDirPath) - } - } - q = q.Arg("path", path) - - var response bool - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A unique identifier for this File. -func (r *File) ID(ctx context.Context) (FileID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response FileID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *File) XXX_GraphQLType() string { - return "File" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *File) XXX_GraphQLIDType() string { - return "FileID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *File) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *File) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// Retrieves the name of the file. -func (r *File) Name(ctx context.Context) (string, error) { - if r.name != nil { - return *r.name, nil - } - q := r.query.Select("name") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Retrieves the size of the file, in bytes. -func (r *File) Size(ctx context.Context) (int, error) { - if r.size != nil { - return *r.size, nil - } - q := r.query.Select("size") - - var response int - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Force evaluation in the engine. -func (r *File) Sync(ctx context.Context) (*File, error) { - q := r.query.Select("sync") - - return r, q.Execute(ctx) -} - -// Retrieves this file with its created/modified timestamps set to the given time. -func (r *File) WithTimestamps(timestamp int) *File { - q := r.query.Select("withTimestamps") - q = q.Arg("timestamp", timestamp) - - return &File{ - query: q, - } -} - -// Function represents a resolver provided by a Module. -// -// A function always evaluates against a parent object and is given a set of named arguments. -type Function struct { - query *querybuilder.Selection - - description *string - id *FunctionID - name *string -} -type WithFunctionFunc func(r *Function) *Function - -// With calls the provided function with current Function. -// -// This is useful for reusability and readability by not breaking the calling chain. -func (r *Function) With(f WithFunctionFunc) *Function { - return f(r) -} - -func (r *Function) WithGraphQLQuery(q *querybuilder.Selection) *Function { - return &Function{ - query: q, - } -} - -// Arguments accepted by the function, if any. -func (r *Function) Args(ctx context.Context) ([]FunctionArg, error) { - q := r.query.Select("args") - - q = q.Select("id") - - type args struct { - Id FunctionArgID - } - - convert := func(fields []args) []FunctionArg { - out := []FunctionArg{} - - for i := range fields { - val := FunctionArg{id: &fields[i].Id} - val.query = q.Root().Select("loadFunctionArgFromID").Arg("id", fields[i].Id) - out = append(out, val) - } - - return out - } - var response []args - - q = q.Bind(&response) - - err := q.Execute(ctx) - if err != nil { - return nil, err - } - - return convert(response), nil -} - -// A doc string for the function, if any. -func (r *Function) Description(ctx context.Context) (string, error) { - if r.description != nil { - return *r.description, nil - } - q := r.query.Select("description") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A unique identifier for this Function. -func (r *Function) ID(ctx context.Context) (FunctionID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response FunctionID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *Function) XXX_GraphQLType() string { - return "Function" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *Function) XXX_GraphQLIDType() string { - return "FunctionID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *Function) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *Function) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// The name of the function. -func (r *Function) Name(ctx context.Context) (string, error) { - if r.name != nil { - return *r.name, nil - } - q := r.query.Select("name") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// The type returned by the function. -func (r *Function) ReturnType() *TypeDef { - q := r.query.Select("returnType") - - return &TypeDef{ - query: q, - } -} - -// FunctionWithArgOpts contains options for Function.WithArg -type FunctionWithArgOpts struct { - // A doc string for the argument, if any - Description string - // A default value to use for this argument if not explicitly set by the caller, if any - DefaultValue JSON -} - -// Returns the function with the provided argument -func (r *Function) WithArg(name string, typeDef *TypeDef, opts ...FunctionWithArgOpts) *Function { - assertNotNil("typeDef", typeDef) - q := r.query.Select("withArg") - for i := len(opts) - 1; i >= 0; i-- { - // `description` optional argument - if !querybuilder.IsZeroValue(opts[i].Description) { - q = q.Arg("description", opts[i].Description) - } - // `defaultValue` optional argument - if !querybuilder.IsZeroValue(opts[i].DefaultValue) { - q = q.Arg("defaultValue", opts[i].DefaultValue) - } - } - q = q.Arg("name", name) - q = q.Arg("typeDef", typeDef) - - return &Function{ - query: q, - } -} - -// Returns the function with the given doc string. -func (r *Function) WithDescription(description string) *Function { - q := r.query.Select("withDescription") - q = q.Arg("description", description) - - return &Function{ - query: q, - } -} - -// An argument accepted by a function. -// -// This is a specification for an argument at function definition time, not an argument passed at function call time. -type FunctionArg struct { - query *querybuilder.Selection - - defaultValue *JSON - description *string - id *FunctionArgID - name *string -} - -func (r *FunctionArg) WithGraphQLQuery(q *querybuilder.Selection) *FunctionArg { - return &FunctionArg{ - query: q, - } -} - -// A default value to use for this argument when not explicitly set by the caller, if any. -func (r *FunctionArg) DefaultValue(ctx context.Context) (JSON, error) { - if r.defaultValue != nil { - return *r.defaultValue, nil - } - q := r.query.Select("defaultValue") - - var response JSON - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A doc string for the argument, if any. -func (r *FunctionArg) Description(ctx context.Context) (string, error) { - if r.description != nil { - return *r.description, nil - } - q := r.query.Select("description") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A unique identifier for this FunctionArg. -func (r *FunctionArg) ID(ctx context.Context) (FunctionArgID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response FunctionArgID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *FunctionArg) XXX_GraphQLType() string { - return "FunctionArg" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *FunctionArg) XXX_GraphQLIDType() string { - return "FunctionArgID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *FunctionArg) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *FunctionArg) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// The name of the argument in lowerCamelCase format. -func (r *FunctionArg) Name(ctx context.Context) (string, error) { - if r.name != nil { - return *r.name, nil - } - q := r.query.Select("name") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// The type of the argument. -func (r *FunctionArg) TypeDef() *TypeDef { - q := r.query.Select("typeDef") - - return &TypeDef{ - query: q, - } -} - -// An active function call. -type FunctionCall struct { - query *querybuilder.Selection - - id *FunctionCallID - name *string - parent *JSON - parentName *string - returnValue *Void -} - -func (r *FunctionCall) WithGraphQLQuery(q *querybuilder.Selection) *FunctionCall { - return &FunctionCall{ - query: q, - } -} - -// A unique identifier for this FunctionCall. -func (r *FunctionCall) ID(ctx context.Context) (FunctionCallID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response FunctionCallID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *FunctionCall) XXX_GraphQLType() string { - return "FunctionCall" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *FunctionCall) XXX_GraphQLIDType() string { - return "FunctionCallID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *FunctionCall) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *FunctionCall) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// The argument values the function is being invoked with. -func (r *FunctionCall) InputArgs(ctx context.Context) ([]FunctionCallArgValue, error) { - q := r.query.Select("inputArgs") - - q = q.Select("id") - - type inputArgs struct { - Id FunctionCallArgValueID - } - - convert := func(fields []inputArgs) []FunctionCallArgValue { - out := []FunctionCallArgValue{} - - for i := range fields { - val := FunctionCallArgValue{id: &fields[i].Id} - val.query = q.Root().Select("loadFunctionCallArgValueFromID").Arg("id", fields[i].Id) - out = append(out, val) - } - - return out - } - var response []inputArgs - - q = q.Bind(&response) - - err := q.Execute(ctx) - if err != nil { - return nil, err - } - - return convert(response), nil -} - -// The name of the function being called. -func (r *FunctionCall) Name(ctx context.Context) (string, error) { - if r.name != nil { - return *r.name, nil - } - q := r.query.Select("name") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// The value of the parent object of the function being called. If the function is top-level to the module, this is always an empty object. -func (r *FunctionCall) Parent(ctx context.Context) (JSON, error) { - if r.parent != nil { - return *r.parent, nil - } - q := r.query.Select("parent") - - var response JSON - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// The name of the parent object of the function being called. If the function is top-level to the module, this is the name of the module. -func (r *FunctionCall) ParentName(ctx context.Context) (string, error) { - if r.parentName != nil { - return *r.parentName, nil - } - q := r.query.Select("parentName") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Set the return value of the function call to the provided value. -func (r *FunctionCall) ReturnValue(ctx context.Context, value JSON) (Void, error) { - if r.returnValue != nil { - return *r.returnValue, nil - } - q := r.query.Select("returnValue") - q = q.Arg("value", value) - - var response Void - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A value passed as a named argument to a function call. -type FunctionCallArgValue struct { - query *querybuilder.Selection - - id *FunctionCallArgValueID - name *string - value *JSON -} - -func (r *FunctionCallArgValue) WithGraphQLQuery(q *querybuilder.Selection) *FunctionCallArgValue { - return &FunctionCallArgValue{ - query: q, - } -} - -// A unique identifier for this FunctionCallArgValue. -func (r *FunctionCallArgValue) ID(ctx context.Context) (FunctionCallArgValueID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response FunctionCallArgValueID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *FunctionCallArgValue) XXX_GraphQLType() string { - return "FunctionCallArgValue" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *FunctionCallArgValue) XXX_GraphQLIDType() string { - return "FunctionCallArgValueID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *FunctionCallArgValue) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *FunctionCallArgValue) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// The name of the argument. -func (r *FunctionCallArgValue) Name(ctx context.Context) (string, error) { - if r.name != nil { - return *r.name, nil - } - q := r.query.Select("name") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// The value of the argument represented as a JSON serialized string. -func (r *FunctionCallArgValue) Value(ctx context.Context) (JSON, error) { - if r.value != nil { - return *r.value, nil - } - q := r.query.Select("value") - - var response JSON - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// The result of running an SDK's codegen. -type GeneratedCode struct { - query *querybuilder.Selection - - id *GeneratedCodeID -} -type WithGeneratedCodeFunc func(r *GeneratedCode) *GeneratedCode - -// With calls the provided function with current GeneratedCode. -// -// This is useful for reusability and readability by not breaking the calling chain. -func (r *GeneratedCode) With(f WithGeneratedCodeFunc) *GeneratedCode { - return f(r) -} - -func (r *GeneratedCode) WithGraphQLQuery(q *querybuilder.Selection) *GeneratedCode { - return &GeneratedCode{ - query: q, - } -} - -// The directory containing the generated code. -func (r *GeneratedCode) Code() *Directory { - q := r.query.Select("code") - - return &Directory{ - query: q, - } -} - -// A unique identifier for this GeneratedCode. -func (r *GeneratedCode) ID(ctx context.Context) (GeneratedCodeID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response GeneratedCodeID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *GeneratedCode) XXX_GraphQLType() string { - return "GeneratedCode" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *GeneratedCode) XXX_GraphQLIDType() string { - return "GeneratedCodeID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *GeneratedCode) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *GeneratedCode) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// List of paths to mark generated in version control (i.e. .gitattributes). -func (r *GeneratedCode) VcsGeneratedPaths(ctx context.Context) ([]string, error) { - q := r.query.Select("vcsGeneratedPaths") - - var response []string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// List of paths to ignore in version control (i.e. .gitignore). -func (r *GeneratedCode) VcsIgnoredPaths(ctx context.Context) ([]string, error) { - q := r.query.Select("vcsIgnoredPaths") - - var response []string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Set the list of paths to mark generated in version control. -func (r *GeneratedCode) WithVCSGeneratedPaths(paths []string) *GeneratedCode { - q := r.query.Select("withVCSGeneratedPaths") - q = q.Arg("paths", paths) - - return &GeneratedCode{ - query: q, - } -} - -// Set the list of paths to ignore in version control. -func (r *GeneratedCode) WithVCSIgnoredPaths(paths []string) *GeneratedCode { - q := r.query.Select("withVCSIgnoredPaths") - q = q.Arg("paths", paths) - - return &GeneratedCode{ - query: q, - } -} - -// Module source originating from a git repo. -type GitModuleSource struct { - query *querybuilder.Selection - - cloneURL *string - commit *string - htmlURL *string - id *GitModuleSourceID - rootSubpath *string - version *string -} - -func (r *GitModuleSource) WithGraphQLQuery(q *querybuilder.Selection) *GitModuleSource { - return &GitModuleSource{ - query: q, - } -} - -// The URL from which the source's git repo can be cloned. -func (r *GitModuleSource) CloneURL(ctx context.Context) (string, error) { - if r.cloneURL != nil { - return *r.cloneURL, nil - } - q := r.query.Select("cloneURL") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// The resolved commit of the git repo this source points to. -func (r *GitModuleSource) Commit(ctx context.Context) (string, error) { - if r.commit != nil { - return *r.commit, nil - } - q := r.query.Select("commit") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// The directory containing everything needed to load load and use the module. -func (r *GitModuleSource) ContextDirectory() *Directory { - q := r.query.Select("contextDirectory") - - return &Directory{ - query: q, - } -} - -// The URL to the source's git repo in a web browser -func (r *GitModuleSource) HTMLURL(ctx context.Context) (string, error) { - if r.htmlURL != nil { - return *r.htmlURL, nil - } - q := r.query.Select("htmlURL") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A unique identifier for this GitModuleSource. -func (r *GitModuleSource) ID(ctx context.Context) (GitModuleSourceID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response GitModuleSourceID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *GitModuleSource) XXX_GraphQLType() string { - return "GitModuleSource" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *GitModuleSource) XXX_GraphQLIDType() string { - return "GitModuleSourceID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *GitModuleSource) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *GitModuleSource) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// The path to the root of the module source under the context directory. This directory contains its configuration file. It also contains its source code (possibly as a subdirectory). -func (r *GitModuleSource) RootSubpath(ctx context.Context) (string, error) { - if r.rootSubpath != nil { - return *r.rootSubpath, nil - } - q := r.query.Select("rootSubpath") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// The specified version of the git repo this source points to. -func (r *GitModuleSource) Version(ctx context.Context) (string, error) { - if r.version != nil { - return *r.version, nil - } - q := r.query.Select("version") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A git ref (tag, branch, or commit). -type GitRef struct { - query *querybuilder.Selection - - commit *string - id *GitRefID -} - -func (r *GitRef) WithGraphQLQuery(q *querybuilder.Selection) *GitRef { - return &GitRef{ - query: q, - } -} - -// The resolved commit id at this ref. -func (r *GitRef) Commit(ctx context.Context) (string, error) { - if r.commit != nil { - return *r.commit, nil - } - q := r.query.Select("commit") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A unique identifier for this GitRef. -func (r *GitRef) ID(ctx context.Context) (GitRefID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response GitRefID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *GitRef) XXX_GraphQLType() string { - return "GitRef" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *GitRef) XXX_GraphQLIDType() string { - return "GitRefID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *GitRef) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *GitRef) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// GitRefTreeOpts contains options for GitRef.Tree -type GitRefTreeOpts struct { - // DEPRECATED: This option should be passed to `git` instead. - SSHKnownHosts string - // DEPRECATED: This option should be passed to `git` instead. - SSHAuthSocket *Socket -} - -// The filesystem tree at this ref. -func (r *GitRef) Tree(opts ...GitRefTreeOpts) *Directory { - q := r.query.Select("tree") - for i := len(opts) - 1; i >= 0; i-- { - // `sshKnownHosts` optional argument - if !querybuilder.IsZeroValue(opts[i].SSHKnownHosts) { - q = q.Arg("sshKnownHosts", opts[i].SSHKnownHosts) - } - // `sshAuthSocket` optional argument - if !querybuilder.IsZeroValue(opts[i].SSHAuthSocket) { - q = q.Arg("sshAuthSocket", opts[i].SSHAuthSocket) - } - } - - return &Directory{ - query: q, - } -} - -// A git repository. -type GitRepository struct { - query *querybuilder.Selection - - id *GitRepositoryID -} -type WithGitRepositoryFunc func(r *GitRepository) *GitRepository - -// With calls the provided function with current GitRepository. -// -// This is useful for reusability and readability by not breaking the calling chain. -func (r *GitRepository) With(f WithGitRepositoryFunc) *GitRepository { - return f(r) -} - -func (r *GitRepository) WithGraphQLQuery(q *querybuilder.Selection) *GitRepository { - return &GitRepository{ - query: q, - } -} - -// Returns details of a branch. -func (r *GitRepository) Branch(name string) *GitRef { - q := r.query.Select("branch") - q = q.Arg("name", name) - - return &GitRef{ - query: q, - } -} - -// Returns details of a commit. -func (r *GitRepository) Commit(id string) *GitRef { - q := r.query.Select("commit") - q = q.Arg("id", id) - - return &GitRef{ - query: q, - } -} - -// Returns details for HEAD. -func (r *GitRepository) Head() *GitRef { - q := r.query.Select("head") - - return &GitRef{ - query: q, - } -} - -// A unique identifier for this GitRepository. -func (r *GitRepository) ID(ctx context.Context) (GitRepositoryID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response GitRepositoryID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *GitRepository) XXX_GraphQLType() string { - return "GitRepository" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *GitRepository) XXX_GraphQLIDType() string { - return "GitRepositoryID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *GitRepository) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *GitRepository) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// Returns details of a ref. -func (r *GitRepository) Ref(name string) *GitRef { - q := r.query.Select("ref") - q = q.Arg("name", name) - - return &GitRef{ - query: q, - } -} - -// Returns details of a tag. -func (r *GitRepository) Tag(name string) *GitRef { - q := r.query.Select("tag") - q = q.Arg("name", name) - - return &GitRef{ - query: q, - } -} - -// Header to authenticate the remote with. -func (r *GitRepository) WithAuthHeader(header *Secret) *GitRepository { - assertNotNil("header", header) - q := r.query.Select("withAuthHeader") - q = q.Arg("header", header) - - return &GitRepository{ - query: q, - } -} - -// Token to authenticate the remote with. -func (r *GitRepository) WithAuthToken(token *Secret) *GitRepository { - assertNotNil("token", token) - q := r.query.Select("withAuthToken") - q = q.Arg("token", token) - - return &GitRepository{ - query: q, - } -} - -// Information about the host environment. -type Host struct { - query *querybuilder.Selection - - id *HostID -} - -func (r *Host) WithGraphQLQuery(q *querybuilder.Selection) *Host { - return &Host{ - query: q, - } -} - -// HostDirectoryOpts contains options for Host.Directory -type HostDirectoryOpts struct { - // Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]). - Exclude []string - // Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]). - Include []string -} - -// Accesses a directory on the host. -func (r *Host) Directory(path string, opts ...HostDirectoryOpts) *Directory { - q := r.query.Select("directory") - for i := len(opts) - 1; i >= 0; i-- { - // `exclude` optional argument - if !querybuilder.IsZeroValue(opts[i].Exclude) { - q = q.Arg("exclude", opts[i].Exclude) - } - // `include` optional argument - if !querybuilder.IsZeroValue(opts[i].Include) { - q = q.Arg("include", opts[i].Include) - } - } - q = q.Arg("path", path) - - return &Directory{ - query: q, - } -} - -// Accesses a file on the host. -func (r *Host) File(path string) *File { - q := r.query.Select("file") - q = q.Arg("path", path) - - return &File{ - query: q, - } -} - -// A unique identifier for this Host. -func (r *Host) ID(ctx context.Context) (HostID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response HostID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *Host) XXX_GraphQLType() string { - return "Host" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *Host) XXX_GraphQLIDType() string { - return "HostID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *Host) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *Host) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// HostServiceOpts contains options for Host.Service -type HostServiceOpts struct { - // Upstream host to forward traffic to. - Host string -} - -// Creates a service that forwards traffic to a specified address via the host. -func (r *Host) Service(ports []PortForward, opts ...HostServiceOpts) *Service { - q := r.query.Select("service") - for i := len(opts) - 1; i >= 0; i-- { - // `host` optional argument - if !querybuilder.IsZeroValue(opts[i].Host) { - q = q.Arg("host", opts[i].Host) - } - } - q = q.Arg("ports", ports) - - return &Service{ - query: q, - } -} - -// Sets a secret given a user-defined name and the file path on the host, and returns the secret. -// -// The file is limited to a size of 512000 bytes. -func (r *Host) SetSecretFile(name string, path string) *Secret { - q := r.query.Select("setSecretFile") - q = q.Arg("name", name) - q = q.Arg("path", path) - - return &Secret{ - query: q, - } -} - -// HostTunnelOpts contains options for Host.Tunnel -type HostTunnelOpts struct { - // Configure explicit port forwarding rules for the tunnel. - // - // If a port's frontend is unspecified or 0, a random port will be chosen by the host. - // - // If no ports are given, all of the service's ports are forwarded. If native is true, each port maps to the same port on the host. If native is false, each port maps to a random port chosen by the host. - // - // If ports are given and native is true, the ports are additive. - Ports []PortForward - // Map each service port to the same port on the host, as if the service were running natively. - // - // Note: enabling may result in port conflicts. - Native bool -} - -// Creates a tunnel that forwards traffic from the host to a service. -func (r *Host) Tunnel(service *Service, opts ...HostTunnelOpts) *Service { - assertNotNil("service", service) - q := r.query.Select("tunnel") - for i := len(opts) - 1; i >= 0; i-- { - // `ports` optional argument - if !querybuilder.IsZeroValue(opts[i].Ports) { - q = q.Arg("ports", opts[i].Ports) - } - // `native` optional argument - if !querybuilder.IsZeroValue(opts[i].Native) { - q = q.Arg("native", opts[i].Native) - } - } - q = q.Arg("service", service) - - return &Service{ - query: q, - } -} - -// Accesses a Unix socket on the host. -func (r *Host) UnixSocket(path string) *Socket { - q := r.query.Select("unixSocket") - q = q.Arg("path", path) - - return &Socket{ - query: q, - } -} - -// A graphql input type, which is essentially just a group of named args. -// This is currently only used to represent pre-existing usage of graphql input types -// in the core API. It is not used by user modules and shouldn't ever be as user -// module accept input objects via their id rather than graphql input types. -type InputTypeDef struct { - query *querybuilder.Selection - - id *InputTypeDefID - name *string -} - -func (r *InputTypeDef) WithGraphQLQuery(q *querybuilder.Selection) *InputTypeDef { - return &InputTypeDef{ - query: q, - } -} - -// Static fields defined on this input object, if any. -func (r *InputTypeDef) Fields(ctx context.Context) ([]FieldTypeDef, error) { - q := r.query.Select("fields") - - q = q.Select("id") - - type fields struct { - Id FieldTypeDefID - } - - convert := func(fields []fields) []FieldTypeDef { - out := []FieldTypeDef{} - - for i := range fields { - val := FieldTypeDef{id: &fields[i].Id} - val.query = q.Root().Select("loadFieldTypeDefFromID").Arg("id", fields[i].Id) - out = append(out, val) - } - - return out - } - var response []fields - - q = q.Bind(&response) - - err := q.Execute(ctx) - if err != nil { - return nil, err - } - - return convert(response), nil -} - -// A unique identifier for this InputTypeDef. -func (r *InputTypeDef) ID(ctx context.Context) (InputTypeDefID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response InputTypeDefID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *InputTypeDef) XXX_GraphQLType() string { - return "InputTypeDef" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *InputTypeDef) XXX_GraphQLIDType() string { - return "InputTypeDefID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *InputTypeDef) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *InputTypeDef) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// The name of the input object. -func (r *InputTypeDef) Name(ctx context.Context) (string, error) { - if r.name != nil { - return *r.name, nil - } - q := r.query.Select("name") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A definition of a custom interface defined in a Module. -type InterfaceTypeDef struct { - query *querybuilder.Selection - - description *string - id *InterfaceTypeDefID - name *string - sourceModuleName *string -} - -func (r *InterfaceTypeDef) WithGraphQLQuery(q *querybuilder.Selection) *InterfaceTypeDef { - return &InterfaceTypeDef{ - query: q, - } -} - -// The doc string for the interface, if any. -func (r *InterfaceTypeDef) Description(ctx context.Context) (string, error) { - if r.description != nil { - return *r.description, nil - } - q := r.query.Select("description") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Functions defined on this interface, if any. -func (r *InterfaceTypeDef) Functions(ctx context.Context) ([]Function, error) { - q := r.query.Select("functions") - - q = q.Select("id") - - type functions struct { - Id FunctionID - } - - convert := func(fields []functions) []Function { - out := []Function{} - - for i := range fields { - val := Function{id: &fields[i].Id} - val.query = q.Root().Select("loadFunctionFromID").Arg("id", fields[i].Id) - out = append(out, val) - } - - return out - } - var response []functions - - q = q.Bind(&response) - - err := q.Execute(ctx) - if err != nil { - return nil, err - } - - return convert(response), nil -} - -// A unique identifier for this InterfaceTypeDef. -func (r *InterfaceTypeDef) ID(ctx context.Context) (InterfaceTypeDefID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response InterfaceTypeDefID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *InterfaceTypeDef) XXX_GraphQLType() string { - return "InterfaceTypeDef" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *InterfaceTypeDef) XXX_GraphQLIDType() string { - return "InterfaceTypeDefID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *InterfaceTypeDef) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *InterfaceTypeDef) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// The name of the interface. -func (r *InterfaceTypeDef) Name(ctx context.Context) (string, error) { - if r.name != nil { - return *r.name, nil - } - q := r.query.Select("name") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// If this InterfaceTypeDef is associated with a Module, the name of the module. Unset otherwise. -func (r *InterfaceTypeDef) SourceModuleName(ctx context.Context) (string, error) { - if r.sourceModuleName != nil { - return *r.sourceModuleName, nil - } - q := r.query.Select("sourceModuleName") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A simple key value object that represents a label. -type Label struct { - query *querybuilder.Selection - - id *LabelID - name *string - value *string -} - -func (r *Label) WithGraphQLQuery(q *querybuilder.Selection) *Label { - return &Label{ - query: q, - } -} - -// A unique identifier for this Label. -func (r *Label) ID(ctx context.Context) (LabelID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response LabelID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *Label) XXX_GraphQLType() string { - return "Label" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *Label) XXX_GraphQLIDType() string { - return "LabelID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *Label) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *Label) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// The label name. -func (r *Label) Name(ctx context.Context) (string, error) { - if r.name != nil { - return *r.name, nil - } - q := r.query.Select("name") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// The label value. -func (r *Label) Value(ctx context.Context) (string, error) { - if r.value != nil { - return *r.value, nil - } - q := r.query.Select("value") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A definition of a list type in a Module. -type ListTypeDef struct { - query *querybuilder.Selection - - id *ListTypeDefID -} - -func (r *ListTypeDef) WithGraphQLQuery(q *querybuilder.Selection) *ListTypeDef { - return &ListTypeDef{ - query: q, - } -} - -// The type of the elements in the list. -func (r *ListTypeDef) ElementTypeDef() *TypeDef { - q := r.query.Select("elementTypeDef") - - return &TypeDef{ - query: q, - } -} - -// A unique identifier for this ListTypeDef. -func (r *ListTypeDef) ID(ctx context.Context) (ListTypeDefID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response ListTypeDefID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *ListTypeDef) XXX_GraphQLType() string { - return "ListTypeDef" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *ListTypeDef) XXX_GraphQLIDType() string { - return "ListTypeDefID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *ListTypeDef) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *ListTypeDef) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// Module source that that originates from a path locally relative to an arbitrary directory. -type LocalModuleSource struct { - query *querybuilder.Selection - - id *LocalModuleSourceID - rootSubpath *string -} - -func (r *LocalModuleSource) WithGraphQLQuery(q *querybuilder.Selection) *LocalModuleSource { - return &LocalModuleSource{ - query: q, - } -} - -// The directory containing everything needed to load load and use the module. -func (r *LocalModuleSource) ContextDirectory() *Directory { - q := r.query.Select("contextDirectory") - - return &Directory{ - query: q, - } -} - -// A unique identifier for this LocalModuleSource. -func (r *LocalModuleSource) ID(ctx context.Context) (LocalModuleSourceID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response LocalModuleSourceID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *LocalModuleSource) XXX_GraphQLType() string { - return "LocalModuleSource" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *LocalModuleSource) XXX_GraphQLIDType() string { - return "LocalModuleSourceID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *LocalModuleSource) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *LocalModuleSource) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// The path to the root of the module source under the context directory. This directory contains its configuration file. It also contains its source code (possibly as a subdirectory). -func (r *LocalModuleSource) RootSubpath(ctx context.Context) (string, error) { - if r.rootSubpath != nil { - return *r.rootSubpath, nil - } - q := r.query.Select("rootSubpath") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A Dagger module. -type Module struct { - query *querybuilder.Selection - - description *string - id *ModuleID - name *string - sdk *string - serve *Void -} -type WithModuleFunc func(r *Module) *Module - -// With calls the provided function with current Module. -// -// This is useful for reusability and readability by not breaking the calling chain. -func (r *Module) With(f WithModuleFunc) *Module { - return f(r) -} - -func (r *Module) WithGraphQLQuery(q *querybuilder.Selection) *Module { - return &Module{ - query: q, - } -} - -// Modules used by this module. -func (r *Module) Dependencies(ctx context.Context) ([]Module, error) { - q := r.query.Select("dependencies") - - q = q.Select("id") - - type dependencies struct { - Id ModuleID - } - - convert := func(fields []dependencies) []Module { - out := []Module{} - - for i := range fields { - val := Module{id: &fields[i].Id} - val.query = q.Root().Select("loadModuleFromID").Arg("id", fields[i].Id) - out = append(out, val) - } - - return out - } - var response []dependencies - - q = q.Bind(&response) - - err := q.Execute(ctx) - if err != nil { - return nil, err - } - - return convert(response), nil -} - -// The dependencies as configured by the module. -func (r *Module) DependencyConfig(ctx context.Context) ([]ModuleDependency, error) { - q := r.query.Select("dependencyConfig") - - q = q.Select("id") - - type dependencyConfig struct { - Id ModuleDependencyID - } - - convert := func(fields []dependencyConfig) []ModuleDependency { - out := []ModuleDependency{} - - for i := range fields { - val := ModuleDependency{id: &fields[i].Id} - val.query = q.Root().Select("loadModuleDependencyFromID").Arg("id", fields[i].Id) - out = append(out, val) - } - - return out - } - var response []dependencyConfig - - q = q.Bind(&response) - - err := q.Execute(ctx) - if err != nil { - return nil, err - } - - return convert(response), nil -} - -// The doc string of the module, if any -func (r *Module) Description(ctx context.Context) (string, error) { - if r.description != nil { - return *r.description, nil - } - q := r.query.Select("description") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// The generated files and directories made on top of the module source's context directory. -func (r *Module) GeneratedContextDiff() *Directory { - q := r.query.Select("generatedContextDiff") - - return &Directory{ - query: q, - } -} - -// The module source's context plus any configuration and source files created by codegen. -func (r *Module) GeneratedContextDirectory() *Directory { - q := r.query.Select("generatedContextDirectory") - - return &Directory{ - query: q, - } -} - -// A unique identifier for this Module. -func (r *Module) ID(ctx context.Context) (ModuleID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response ModuleID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *Module) XXX_GraphQLType() string { - return "Module" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *Module) XXX_GraphQLIDType() string { - return "ModuleID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *Module) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *Module) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// Retrieves the module with the objects loaded via its SDK. -func (r *Module) Initialize() *Module { - q := r.query.Select("initialize") - - return &Module{ - query: q, - } -} - -// Interfaces served by this module. -func (r *Module) Interfaces(ctx context.Context) ([]TypeDef, error) { - q := r.query.Select("interfaces") - - q = q.Select("id") - - type interfaces struct { - Id TypeDefID - } - - convert := func(fields []interfaces) []TypeDef { - out := []TypeDef{} - - for i := range fields { - val := TypeDef{id: &fields[i].Id} - val.query = q.Root().Select("loadTypeDefFromID").Arg("id", fields[i].Id) - out = append(out, val) - } - - return out - } - var response []interfaces - - q = q.Bind(&response) - - err := q.Execute(ctx) - if err != nil { - return nil, err - } - - return convert(response), nil -} - -// The name of the module -func (r *Module) Name(ctx context.Context) (string, error) { - if r.name != nil { - return *r.name, nil - } - q := r.query.Select("name") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Objects served by this module. -func (r *Module) Objects(ctx context.Context) ([]TypeDef, error) { - q := r.query.Select("objects") - - q = q.Select("id") - - type objects struct { - Id TypeDefID - } - - convert := func(fields []objects) []TypeDef { - out := []TypeDef{} - - for i := range fields { - val := TypeDef{id: &fields[i].Id} - val.query = q.Root().Select("loadTypeDefFromID").Arg("id", fields[i].Id) - out = append(out, val) - } - - return out - } - var response []objects - - q = q.Bind(&response) - - err := q.Execute(ctx) - if err != nil { - return nil, err - } - - return convert(response), nil -} - -// The container that runs the module's entrypoint. It will fail to execute if the module doesn't compile. -func (r *Module) Runtime() *Container { - q := r.query.Select("runtime") - - return &Container{ - query: q, - } -} - -// The SDK used by this module. Either a name of a builtin SDK or a module source ref string pointing to the SDK's implementation. -func (r *Module) SDK(ctx context.Context) (string, error) { - if r.sdk != nil { - return *r.sdk, nil - } - q := r.query.Select("sdk") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Serve a module's API in the current session. -// -// Note: this can only be called once per session. In the future, it could return a stream or service to remove the side effect. -func (r *Module) Serve(ctx context.Context) (Void, error) { - if r.serve != nil { - return *r.serve, nil - } - q := r.query.Select("serve") - - var response Void - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// The source for the module. -func (r *Module) Source() *ModuleSource { - q := r.query.Select("source") - - return &ModuleSource{ - query: q, - } -} - -// Retrieves the module with the given description -func (r *Module) WithDescription(description string) *Module { - q := r.query.Select("withDescription") - q = q.Arg("description", description) - - return &Module{ - query: q, - } -} - -// This module plus the given Interface type and associated functions -func (r *Module) WithInterface(iface *TypeDef) *Module { - assertNotNil("iface", iface) - q := r.query.Select("withInterface") - q = q.Arg("iface", iface) - - return &Module{ - query: q, - } -} - -// This module plus the given Object type and associated functions. -func (r *Module) WithObject(object *TypeDef) *Module { - assertNotNil("object", object) - q := r.query.Select("withObject") - q = q.Arg("object", object) - - return &Module{ - query: q, - } -} - -// Retrieves the module with basic configuration loaded if present. -func (r *Module) WithSource(source *ModuleSource) *Module { - assertNotNil("source", source) - q := r.query.Select("withSource") - q = q.Arg("source", source) - - return &Module{ - query: q, - } -} - -// The configuration of dependency of a module. -type ModuleDependency struct { - query *querybuilder.Selection - - id *ModuleDependencyID - name *string -} - -func (r *ModuleDependency) WithGraphQLQuery(q *querybuilder.Selection) *ModuleDependency { - return &ModuleDependency{ - query: q, - } -} - -// A unique identifier for this ModuleDependency. -func (r *ModuleDependency) ID(ctx context.Context) (ModuleDependencyID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response ModuleDependencyID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *ModuleDependency) XXX_GraphQLType() string { - return "ModuleDependency" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *ModuleDependency) XXX_GraphQLIDType() string { - return "ModuleDependencyID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *ModuleDependency) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *ModuleDependency) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// The name of the dependency module. -func (r *ModuleDependency) Name(ctx context.Context) (string, error) { - if r.name != nil { - return *r.name, nil - } - q := r.query.Select("name") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// The source for the dependency module. -func (r *ModuleDependency) Source() *ModuleSource { - q := r.query.Select("source") - - return &ModuleSource{ - query: q, - } -} - -// The source needed to load and run a module, along with any metadata about the source such as versions/urls/etc. -type ModuleSource struct { - query *querybuilder.Selection - - asString *string - configExists *bool - id *ModuleSourceID - kind *ModuleSourceKind - moduleName *string - moduleOriginalName *string - resolveContextPathFromCaller *string - sourceRootSubpath *string - sourceSubpath *string -} -type WithModuleSourceFunc func(r *ModuleSource) *ModuleSource - -// With calls the provided function with current ModuleSource. -// -// This is useful for reusability and readability by not breaking the calling chain. -func (r *ModuleSource) With(f WithModuleSourceFunc) *ModuleSource { - return f(r) -} - -func (r *ModuleSource) WithGraphQLQuery(q *querybuilder.Selection) *ModuleSource { - return &ModuleSource{ - query: q, - } -} - -// If the source is a of kind git, the git source representation of it. -func (r *ModuleSource) AsGitSource() *GitModuleSource { - q := r.query.Select("asGitSource") - - return &GitModuleSource{ - query: q, - } -} - -// If the source is of kind local, the local source representation of it. -func (r *ModuleSource) AsLocalSource() *LocalModuleSource { - q := r.query.Select("asLocalSource") - - return &LocalModuleSource{ - query: q, - } -} - -// Load the source as a module. If this is a local source, the parent directory must have been provided during module source creation -func (r *ModuleSource) AsModule() *Module { - q := r.query.Select("asModule") - - return &Module{ - query: q, - } -} - -// A human readable ref string representation of this module source. -func (r *ModuleSource) AsString(ctx context.Context) (string, error) { - if r.asString != nil { - return *r.asString, nil - } - q := r.query.Select("asString") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Returns whether the module source has a configuration file. -func (r *ModuleSource) ConfigExists(ctx context.Context) (bool, error) { - if r.configExists != nil { - return *r.configExists, nil - } - q := r.query.Select("configExists") - - var response bool - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// The directory containing everything needed to load load and use the module. -func (r *ModuleSource) ContextDirectory() *Directory { - q := r.query.Select("contextDirectory") - - return &Directory{ - query: q, - } -} - -// The dependencies of the module source. Includes dependencies from the configuration and any extras from withDependencies calls. -func (r *ModuleSource) Dependencies(ctx context.Context) ([]ModuleDependency, error) { - q := r.query.Select("dependencies") - - q = q.Select("id") - - type dependencies struct { - Id ModuleDependencyID - } - - convert := func(fields []dependencies) []ModuleDependency { - out := []ModuleDependency{} - - for i := range fields { - val := ModuleDependency{id: &fields[i].Id} - val.query = q.Root().Select("loadModuleDependencyFromID").Arg("id", fields[i].Id) - out = append(out, val) - } - - return out - } - var response []dependencies - - q = q.Bind(&response) - - err := q.Execute(ctx) - if err != nil { - return nil, err - } - - return convert(response), nil -} - -// The directory containing the module configuration and source code (source code may be in a subdir). -func (r *ModuleSource) Directory(path string) *Directory { - q := r.query.Select("directory") - q = q.Arg("path", path) - - return &Directory{ - query: q, - } -} - -// A unique identifier for this ModuleSource. -func (r *ModuleSource) ID(ctx context.Context) (ModuleSourceID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response ModuleSourceID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *ModuleSource) XXX_GraphQLType() string { - return "ModuleSource" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *ModuleSource) XXX_GraphQLIDType() string { - return "ModuleSourceID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *ModuleSource) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *ModuleSource) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// The kind of source (e.g. local, git, etc.) -func (r *ModuleSource) Kind(ctx context.Context) (ModuleSourceKind, error) { - if r.kind != nil { - return *r.kind, nil - } - q := r.query.Select("kind") - - var response ModuleSourceKind - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// If set, the name of the module this source references, including any overrides at runtime by callers. -func (r *ModuleSource) ModuleName(ctx context.Context) (string, error) { - if r.moduleName != nil { - return *r.moduleName, nil - } - q := r.query.Select("moduleName") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// The original name of the module this source references, as defined in the module configuration. -func (r *ModuleSource) ModuleOriginalName(ctx context.Context) (string, error) { - if r.moduleOriginalName != nil { - return *r.moduleOriginalName, nil - } - q := r.query.Select("moduleOriginalName") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// The path to the module source's context directory on the caller's filesystem. Only valid for local sources. -func (r *ModuleSource) ResolveContextPathFromCaller(ctx context.Context) (string, error) { - if r.resolveContextPathFromCaller != nil { - return *r.resolveContextPathFromCaller, nil - } - q := r.query.Select("resolveContextPathFromCaller") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Resolve the provided module source arg as a dependency relative to this module source. -func (r *ModuleSource) ResolveDependency(dep *ModuleSource) *ModuleSource { - assertNotNil("dep", dep) - q := r.query.Select("resolveDependency") - q = q.Arg("dep", dep) - - return &ModuleSource{ - query: q, - } -} - -// ModuleSourceResolveDirectoryFromCallerOpts contains options for ModuleSource.ResolveDirectoryFromCaller -type ModuleSourceResolveDirectoryFromCallerOpts struct { - // If set, the name of the view to apply to the path. - ViewName string -} - -// Load a directory from the caller optionally with a given view applied. -func (r *ModuleSource) ResolveDirectoryFromCaller(path string, opts ...ModuleSourceResolveDirectoryFromCallerOpts) *Directory { - q := r.query.Select("resolveDirectoryFromCaller") - for i := len(opts) - 1; i >= 0; i-- { - // `viewName` optional argument - if !querybuilder.IsZeroValue(opts[i].ViewName) { - q = q.Arg("viewName", opts[i].ViewName) - } - } - q = q.Arg("path", path) - - return &Directory{ - query: q, - } -} - -// Load the source from its path on the caller's filesystem, including only needed+configured files and directories. Only valid for local sources. -func (r *ModuleSource) ResolveFromCaller() *ModuleSource { - q := r.query.Select("resolveFromCaller") - - return &ModuleSource{ - query: q, - } -} - -// The path relative to context of the root of the module source, which contains dagger.json. It also contains the module implementation source code, but that may or may not being a subdir of this root. -func (r *ModuleSource) SourceRootSubpath(ctx context.Context) (string, error) { - if r.sourceRootSubpath != nil { - return *r.sourceRootSubpath, nil - } - q := r.query.Select("sourceRootSubpath") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// The path relative to context of the module implementation source code. -func (r *ModuleSource) SourceSubpath(ctx context.Context) (string, error) { - if r.sourceSubpath != nil { - return *r.sourceSubpath, nil - } - q := r.query.Select("sourceSubpath") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Retrieve a named view defined for this module source. -func (r *ModuleSource) View(name string) *ModuleSourceView { - q := r.query.Select("view") - q = q.Arg("name", name) - - return &ModuleSourceView{ - query: q, - } -} - -// The named views defined for this module source, which are sets of directory filters that can be applied to directory arguments provided to functions. -func (r *ModuleSource) Views(ctx context.Context) ([]ModuleSourceView, error) { - q := r.query.Select("views") - - q = q.Select("id") - - type views struct { - Id ModuleSourceViewID - } - - convert := func(fields []views) []ModuleSourceView { - out := []ModuleSourceView{} - - for i := range fields { - val := ModuleSourceView{id: &fields[i].Id} - val.query = q.Root().Select("loadModuleSourceViewFromID").Arg("id", fields[i].Id) - out = append(out, val) - } - - return out - } - var response []views - - q = q.Bind(&response) - - err := q.Execute(ctx) - if err != nil { - return nil, err - } - - return convert(response), nil -} - -// Update the module source with a new context directory. Only valid for local sources. -func (r *ModuleSource) WithContextDirectory(dir *Directory) *ModuleSource { - assertNotNil("dir", dir) - q := r.query.Select("withContextDirectory") - q = q.Arg("dir", dir) - - return &ModuleSource{ - query: q, - } -} - -// Append the provided dependencies to the module source's dependency list. -func (r *ModuleSource) WithDependencies(dependencies []*ModuleDependency) *ModuleSource { - q := r.query.Select("withDependencies") - q = q.Arg("dependencies", dependencies) - - return &ModuleSource{ - query: q, - } -} - -// Update the module source with a new name. -func (r *ModuleSource) WithName(name string) *ModuleSource { - q := r.query.Select("withName") - q = q.Arg("name", name) - - return &ModuleSource{ - query: q, - } -} - -// Update the module source with a new SDK. -func (r *ModuleSource) WithSDK(sdk string) *ModuleSource { - q := r.query.Select("withSDK") - q = q.Arg("sdk", sdk) - - return &ModuleSource{ - query: q, - } -} - -// Update the module source with a new source subpath. -func (r *ModuleSource) WithSourceSubpath(path string) *ModuleSource { - q := r.query.Select("withSourceSubpath") - q = q.Arg("path", path) - - return &ModuleSource{ - query: q, - } -} - -// Update the module source with a new named view. -func (r *ModuleSource) WithView(name string, patterns []string) *ModuleSource { - q := r.query.Select("withView") - q = q.Arg("name", name) - q = q.Arg("patterns", patterns) - - return &ModuleSource{ - query: q, - } -} - -// A named set of path filters that can be applied to directory arguments provided to functions. -type ModuleSourceView struct { - query *querybuilder.Selection - - id *ModuleSourceViewID - name *string -} - -func (r *ModuleSourceView) WithGraphQLQuery(q *querybuilder.Selection) *ModuleSourceView { - return &ModuleSourceView{ - query: q, - } -} - -// A unique identifier for this ModuleSourceView. -func (r *ModuleSourceView) ID(ctx context.Context) (ModuleSourceViewID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response ModuleSourceViewID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *ModuleSourceView) XXX_GraphQLType() string { - return "ModuleSourceView" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *ModuleSourceView) XXX_GraphQLIDType() string { - return "ModuleSourceViewID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *ModuleSourceView) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *ModuleSourceView) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// The name of the view -func (r *ModuleSourceView) Name(ctx context.Context) (string, error) { - if r.name != nil { - return *r.name, nil - } - q := r.query.Select("name") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// The patterns of the view used to filter paths -func (r *ModuleSourceView) Patterns(ctx context.Context) ([]string, error) { - q := r.query.Select("patterns") - - var response []string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A definition of a custom object defined in a Module. -type ObjectTypeDef struct { - query *querybuilder.Selection - - description *string - id *ObjectTypeDefID - name *string - sourceModuleName *string -} - -func (r *ObjectTypeDef) WithGraphQLQuery(q *querybuilder.Selection) *ObjectTypeDef { - return &ObjectTypeDef{ - query: q, - } -} - -// The function used to construct new instances of this object, if any -func (r *ObjectTypeDef) Constructor() *Function { - q := r.query.Select("constructor") - - return &Function{ - query: q, - } -} - -// The doc string for the object, if any. -func (r *ObjectTypeDef) Description(ctx context.Context) (string, error) { - if r.description != nil { - return *r.description, nil - } - q := r.query.Select("description") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Static fields defined on this object, if any. -func (r *ObjectTypeDef) Fields(ctx context.Context) ([]FieldTypeDef, error) { - q := r.query.Select("fields") - - q = q.Select("id") - - type fields struct { - Id FieldTypeDefID - } - - convert := func(fields []fields) []FieldTypeDef { - out := []FieldTypeDef{} - - for i := range fields { - val := FieldTypeDef{id: &fields[i].Id} - val.query = q.Root().Select("loadFieldTypeDefFromID").Arg("id", fields[i].Id) - out = append(out, val) - } - - return out - } - var response []fields - - q = q.Bind(&response) - - err := q.Execute(ctx) - if err != nil { - return nil, err - } - - return convert(response), nil -} - -// Functions defined on this object, if any. -func (r *ObjectTypeDef) Functions(ctx context.Context) ([]Function, error) { - q := r.query.Select("functions") - - q = q.Select("id") - - type functions struct { - Id FunctionID - } - - convert := func(fields []functions) []Function { - out := []Function{} - - for i := range fields { - val := Function{id: &fields[i].Id} - val.query = q.Root().Select("loadFunctionFromID").Arg("id", fields[i].Id) - out = append(out, val) - } - - return out - } - var response []functions - - q = q.Bind(&response) - - err := q.Execute(ctx) - if err != nil { - return nil, err - } - - return convert(response), nil -} - -// A unique identifier for this ObjectTypeDef. -func (r *ObjectTypeDef) ID(ctx context.Context) (ObjectTypeDefID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response ObjectTypeDefID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *ObjectTypeDef) XXX_GraphQLType() string { - return "ObjectTypeDef" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *ObjectTypeDef) XXX_GraphQLIDType() string { - return "ObjectTypeDefID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *ObjectTypeDef) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *ObjectTypeDef) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// The name of the object. -func (r *ObjectTypeDef) Name(ctx context.Context) (string, error) { - if r.name != nil { - return *r.name, nil - } - q := r.query.Select("name") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// If this ObjectTypeDef is associated with a Module, the name of the module. Unset otherwise. -func (r *ObjectTypeDef) SourceModuleName(ctx context.Context) (string, error) { - if r.sourceModuleName != nil { - return *r.sourceModuleName, nil - } - q := r.query.Select("sourceModuleName") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A port exposed by a container. -type Port struct { - query *querybuilder.Selection - - description *string - experimentalSkipHealthcheck *bool - id *PortID - port *int - protocol *NetworkProtocol -} - -func (r *Port) WithGraphQLQuery(q *querybuilder.Selection) *Port { - return &Port{ - query: q, - } -} - -// The port description. -func (r *Port) Description(ctx context.Context) (string, error) { - if r.description != nil { - return *r.description, nil - } - q := r.query.Select("description") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Skip the health check when run as a service. -func (r *Port) ExperimentalSkipHealthcheck(ctx context.Context) (bool, error) { - if r.experimentalSkipHealthcheck != nil { - return *r.experimentalSkipHealthcheck, nil - } - q := r.query.Select("experimentalSkipHealthcheck") - - var response bool - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A unique identifier for this Port. -func (r *Port) ID(ctx context.Context) (PortID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response PortID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *Port) XXX_GraphQLType() string { - return "Port" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *Port) XXX_GraphQLIDType() string { - return "PortID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *Port) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *Port) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// The port number. -func (r *Port) Port(ctx context.Context) (int, error) { - if r.port != nil { - return *r.port, nil - } - q := r.query.Select("port") - - var response int - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// The transport layer protocol. -func (r *Port) Protocol(ctx context.Context) (NetworkProtocol, error) { - if r.protocol != nil { - return *r.protocol, nil - } - q := r.query.Select("protocol") - - var response NetworkProtocol - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -type WithClientFunc func(r *Client) *Client - -// With calls the provided function with current Client. -// -// This is useful for reusability and readability by not breaking the calling chain. -func (r *Client) With(f WithClientFunc) *Client { - return f(r) -} - -func (r *Client) WithGraphQLQuery(q *querybuilder.Selection) *Client { - return &Client{ - query: q, - client: r.client, - } -} - -// Retrieves a content-addressed blob. -func (r *Client) Blob(digest string, size int, mediaType string, uncompressed string) *Directory { - q := r.query.Select("blob") - q = q.Arg("digest", digest) - q = q.Arg("size", size) - q = q.Arg("mediaType", mediaType) - q = q.Arg("uncompressed", uncompressed) - - return &Directory{ - query: q, - } -} - -// Retrieves a container builtin to the engine. -func (r *Client) BuiltinContainer(digest string) *Container { - q := r.query.Select("builtinContainer") - q = q.Arg("digest", digest) - - return &Container{ - query: q, - } -} - -// Constructs a cache volume for a given cache key. -func (r *Client) CacheVolume(key string) *CacheVolume { - q := r.query.Select("cacheVolume") - q = q.Arg("key", key) - - return &CacheVolume{ - query: q, - } -} - -// Checks if the current Dagger Engine is compatible with an SDK's required version. -func (r *Client) CheckVersionCompatibility(ctx context.Context, version string) (bool, error) { - q := r.query.Select("checkVersionCompatibility") - q = q.Arg("version", version) - - var response bool - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// ContainerOpts contains options for Client.Container -type ContainerOpts struct { - // DEPRECATED: Use `loadContainerFromID` instead. - ID ContainerID - // Platform to initialize the container with. - Platform Platform -} - -// Creates a scratch container. -// -// Optional platform argument initializes new containers to execute and publish as that platform. Platform defaults to that of the builder's host. -func (r *Client) Container(opts ...ContainerOpts) *Container { - q := r.query.Select("container") - for i := len(opts) - 1; i >= 0; i-- { - // `id` optional argument - if !querybuilder.IsZeroValue(opts[i].ID) { - q = q.Arg("id", opts[i].ID) - } - // `platform` optional argument - if !querybuilder.IsZeroValue(opts[i].Platform) { - q = q.Arg("platform", opts[i].Platform) - } - } - - return &Container{ - query: q, - } -} - -// The FunctionCall context that the SDK caller is currently executing in. -// -// If the caller is not currently executing in a function, this will return an error. -func (r *Client) CurrentFunctionCall() *FunctionCall { - q := r.query.Select("currentFunctionCall") - - return &FunctionCall{ - query: q, - } -} - -// The module currently being served in the session, if any. -func (r *Client) CurrentModule() *CurrentModule { - q := r.query.Select("currentModule") - - return &CurrentModule{ - query: q, - } -} - -// The TypeDef representations of the objects currently being served in the session. -func (r *Client) CurrentTypeDefs(ctx context.Context) ([]TypeDef, error) { - q := r.query.Select("currentTypeDefs") - - q = q.Select("id") - - type currentTypeDefs struct { - Id TypeDefID - } - - convert := func(fields []currentTypeDefs) []TypeDef { - out := []TypeDef{} - - for i := range fields { - val := TypeDef{id: &fields[i].Id} - val.query = q.Root().Select("loadTypeDefFromID").Arg("id", fields[i].Id) - out = append(out, val) - } - - return out - } - var response []currentTypeDefs - - q = q.Bind(&response) - - err := q.Execute(ctx) - if err != nil { - return nil, err - } - - return convert(response), nil -} - -// The default platform of the engine. -func (r *Client) DefaultPlatform(ctx context.Context) (Platform, error) { - q := r.query.Select("defaultPlatform") - - var response Platform - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// DirectoryOpts contains options for Client.Directory -type DirectoryOpts struct { - // DEPRECATED: Use `loadDirectoryFromID` instead. - ID DirectoryID -} - -// Creates an empty directory. -func (r *Client) Directory(opts ...DirectoryOpts) *Directory { - q := r.query.Select("directory") - for i := len(opts) - 1; i >= 0; i-- { - // `id` optional argument - if !querybuilder.IsZeroValue(opts[i].ID) { - q = q.Arg("id", opts[i].ID) - } - } - - return &Directory{ - query: q, - } -} - -// Deprecated: Use LoadFileFromID instead. -func (r *Client) File(id FileID) *File { - q := r.query.Select("file") - q = q.Arg("id", id) - - return &File{ - query: q, - } -} - -// Creates a function. -func (r *Client) Function(name string, returnType *TypeDef) *Function { - assertNotNil("returnType", returnType) - q := r.query.Select("function") - q = q.Arg("name", name) - q = q.Arg("returnType", returnType) - - return &Function{ - query: q, - } -} - -// Create a code generation result, given a directory containing the generated code. -func (r *Client) GeneratedCode(code *Directory) *GeneratedCode { - assertNotNil("code", code) - q := r.query.Select("generatedCode") - q = q.Arg("code", code) - - return &GeneratedCode{ - query: q, - } -} - -// GitOpts contains options for Client.Git -type GitOpts struct { - // Set to true to keep .git directory. - KeepGitDir bool - // A service which must be started before the repo is fetched. - ExperimentalServiceHost *Service - // Set SSH known hosts - SSHKnownHosts string - // Set SSH auth socket - SSHAuthSocket *Socket -} - -// Queries a Git repository. -func (r *Client) Git(url string, opts ...GitOpts) *GitRepository { - q := r.query.Select("git") - for i := len(opts) - 1; i >= 0; i-- { - // `keepGitDir` optional argument - if !querybuilder.IsZeroValue(opts[i].KeepGitDir) { - q = q.Arg("keepGitDir", opts[i].KeepGitDir) - } - // `experimentalServiceHost` optional argument - if !querybuilder.IsZeroValue(opts[i].ExperimentalServiceHost) { - q = q.Arg("experimentalServiceHost", opts[i].ExperimentalServiceHost) - } - // `sshKnownHosts` optional argument - if !querybuilder.IsZeroValue(opts[i].SSHKnownHosts) { - q = q.Arg("sshKnownHosts", opts[i].SSHKnownHosts) - } - // `sshAuthSocket` optional argument - if !querybuilder.IsZeroValue(opts[i].SSHAuthSocket) { - q = q.Arg("sshAuthSocket", opts[i].SSHAuthSocket) - } - } - q = q.Arg("url", url) - - return &GitRepository{ - query: q, - } -} - -// Queries the host environment. -func (r *Client) Host() *Host { - q := r.query.Select("host") - - return &Host{ - query: q, - } -} - -// HTTPOpts contains options for Client.HTTP -type HTTPOpts struct { - // A service which must be started before the URL is fetched. - ExperimentalServiceHost *Service -} - -// Returns a file containing an http remote url content. -func (r *Client) HTTP(url string, opts ...HTTPOpts) *File { - q := r.query.Select("http") - for i := len(opts) - 1; i >= 0; i-- { - // `experimentalServiceHost` optional argument - if !querybuilder.IsZeroValue(opts[i].ExperimentalServiceHost) { - q = q.Arg("experimentalServiceHost", opts[i].ExperimentalServiceHost) - } - } - q = q.Arg("url", url) - - return &File{ - query: q, - } -} - -// Load a CacheVolume from its ID. -func (r *Client) LoadCacheVolumeFromID(id CacheVolumeID) *CacheVolume { - q := r.query.Select("loadCacheVolumeFromID") - q = q.Arg("id", id) - - return &CacheVolume{ - query: q, - } -} - -// Load a Container from its ID. -func (r *Client) LoadContainerFromID(id ContainerID) *Container { - q := r.query.Select("loadContainerFromID") - q = q.Arg("id", id) - - return &Container{ - query: q, - } -} - -// Load a CurrentModule from its ID. -func (r *Client) LoadCurrentModuleFromID(id CurrentModuleID) *CurrentModule { - q := r.query.Select("loadCurrentModuleFromID") - q = q.Arg("id", id) - - return &CurrentModule{ - query: q, - } -} - -// Load a Directory from its ID. -func (r *Client) LoadDirectoryFromID(id DirectoryID) *Directory { - q := r.query.Select("loadDirectoryFromID") - q = q.Arg("id", id) - - return &Directory{ - query: q, - } -} - -// Load a EnvVariable from its ID. -func (r *Client) LoadEnvVariableFromID(id EnvVariableID) *EnvVariable { - q := r.query.Select("loadEnvVariableFromID") - q = q.Arg("id", id) - - return &EnvVariable{ - query: q, - } -} - -// Load a FieldTypeDef from its ID. -func (r *Client) LoadFieldTypeDefFromID(id FieldTypeDefID) *FieldTypeDef { - q := r.query.Select("loadFieldTypeDefFromID") - q = q.Arg("id", id) - - return &FieldTypeDef{ - query: q, - } -} - -// Load a File from its ID. -func (r *Client) LoadFileFromID(id FileID) *File { - q := r.query.Select("loadFileFromID") - q = q.Arg("id", id) - - return &File{ - query: q, - } -} - -// Load a FunctionArg from its ID. -func (r *Client) LoadFunctionArgFromID(id FunctionArgID) *FunctionArg { - q := r.query.Select("loadFunctionArgFromID") - q = q.Arg("id", id) - - return &FunctionArg{ - query: q, - } -} - -// Load a FunctionCallArgValue from its ID. -func (r *Client) LoadFunctionCallArgValueFromID(id FunctionCallArgValueID) *FunctionCallArgValue { - q := r.query.Select("loadFunctionCallArgValueFromID") - q = q.Arg("id", id) - - return &FunctionCallArgValue{ - query: q, - } -} - -// Load a FunctionCall from its ID. -func (r *Client) LoadFunctionCallFromID(id FunctionCallID) *FunctionCall { - q := r.query.Select("loadFunctionCallFromID") - q = q.Arg("id", id) - - return &FunctionCall{ - query: q, - } -} - -// Load a Function from its ID. -func (r *Client) LoadFunctionFromID(id FunctionID) *Function { - q := r.query.Select("loadFunctionFromID") - q = q.Arg("id", id) - - return &Function{ - query: q, - } -} - -// Load a GeneratedCode from its ID. -func (r *Client) LoadGeneratedCodeFromID(id GeneratedCodeID) *GeneratedCode { - q := r.query.Select("loadGeneratedCodeFromID") - q = q.Arg("id", id) - - return &GeneratedCode{ - query: q, - } -} - -// Load a GitModuleSource from its ID. -func (r *Client) LoadGitModuleSourceFromID(id GitModuleSourceID) *GitModuleSource { - q := r.query.Select("loadGitModuleSourceFromID") - q = q.Arg("id", id) - - return &GitModuleSource{ - query: q, - } -} - -// Load a GitRef from its ID. -func (r *Client) LoadGitRefFromID(id GitRefID) *GitRef { - q := r.query.Select("loadGitRefFromID") - q = q.Arg("id", id) - - return &GitRef{ - query: q, - } -} - -// Load a GitRepository from its ID. -func (r *Client) LoadGitRepositoryFromID(id GitRepositoryID) *GitRepository { - q := r.query.Select("loadGitRepositoryFromID") - q = q.Arg("id", id) - - return &GitRepository{ - query: q, - } -} - -// Load a Host from its ID. -func (r *Client) LoadHostFromID(id HostID) *Host { - q := r.query.Select("loadHostFromID") - q = q.Arg("id", id) - - return &Host{ - query: q, - } -} - -// Load a InputTypeDef from its ID. -func (r *Client) LoadInputTypeDefFromID(id InputTypeDefID) *InputTypeDef { - q := r.query.Select("loadInputTypeDefFromID") - q = q.Arg("id", id) - - return &InputTypeDef{ - query: q, - } -} - -// Load a InterfaceTypeDef from its ID. -func (r *Client) LoadInterfaceTypeDefFromID(id InterfaceTypeDefID) *InterfaceTypeDef { - q := r.query.Select("loadInterfaceTypeDefFromID") - q = q.Arg("id", id) - - return &InterfaceTypeDef{ - query: q, - } -} - -// Load a Label from its ID. -func (r *Client) LoadLabelFromID(id LabelID) *Label { - q := r.query.Select("loadLabelFromID") - q = q.Arg("id", id) - - return &Label{ - query: q, - } -} - -// Load a ListTypeDef from its ID. -func (r *Client) LoadListTypeDefFromID(id ListTypeDefID) *ListTypeDef { - q := r.query.Select("loadListTypeDefFromID") - q = q.Arg("id", id) - - return &ListTypeDef{ - query: q, - } -} - -// Load a LocalModuleSource from its ID. -func (r *Client) LoadLocalModuleSourceFromID(id LocalModuleSourceID) *LocalModuleSource { - q := r.query.Select("loadLocalModuleSourceFromID") - q = q.Arg("id", id) - - return &LocalModuleSource{ - query: q, - } -} - -// Load a ModuleDependency from its ID. -func (r *Client) LoadModuleDependencyFromID(id ModuleDependencyID) *ModuleDependency { - q := r.query.Select("loadModuleDependencyFromID") - q = q.Arg("id", id) - - return &ModuleDependency{ - query: q, - } -} - -// Load a Module from its ID. -func (r *Client) LoadModuleFromID(id ModuleID) *Module { - q := r.query.Select("loadModuleFromID") - q = q.Arg("id", id) - - return &Module{ - query: q, - } -} - -// Load a ModuleSource from its ID. -func (r *Client) LoadModuleSourceFromID(id ModuleSourceID) *ModuleSource { - q := r.query.Select("loadModuleSourceFromID") - q = q.Arg("id", id) - - return &ModuleSource{ - query: q, - } -} - -// Load a ModuleSourceView from its ID. -func (r *Client) LoadModuleSourceViewFromID(id ModuleSourceViewID) *ModuleSourceView { - q := r.query.Select("loadModuleSourceViewFromID") - q = q.Arg("id", id) - - return &ModuleSourceView{ - query: q, - } -} - -// Load a ObjectTypeDef from its ID. -func (r *Client) LoadObjectTypeDefFromID(id ObjectTypeDefID) *ObjectTypeDef { - q := r.query.Select("loadObjectTypeDefFromID") - q = q.Arg("id", id) - - return &ObjectTypeDef{ - query: q, - } -} - -// Load a Port from its ID. -func (r *Client) LoadPortFromID(id PortID) *Port { - q := r.query.Select("loadPortFromID") - q = q.Arg("id", id) - - return &Port{ - query: q, - } -} - -// Load a ScalarTypeDef from its ID. -func (r *Client) LoadScalarTypeDefFromID(id ScalarTypeDefID) *ScalarTypeDef { - q := r.query.Select("loadScalarTypeDefFromID") - q = q.Arg("id", id) - - return &ScalarTypeDef{ - query: q, - } -} - -// Load a Secret from its ID. -func (r *Client) LoadSecretFromID(id SecretID) *Secret { - q := r.query.Select("loadSecretFromID") - q = q.Arg("id", id) - - return &Secret{ - query: q, - } -} - -// Load a Service from its ID. -func (r *Client) LoadServiceFromID(id ServiceID) *Service { - q := r.query.Select("loadServiceFromID") - q = q.Arg("id", id) - - return &Service{ - query: q, - } -} - -// Load a Socket from its ID. -func (r *Client) LoadSocketFromID(id SocketID) *Socket { - q := r.query.Select("loadSocketFromID") - q = q.Arg("id", id) - - return &Socket{ - query: q, - } -} - -// Load a Terminal from its ID. -func (r *Client) LoadTerminalFromID(id TerminalID) *Terminal { - q := r.query.Select("loadTerminalFromID") - q = q.Arg("id", id) - - return &Terminal{ - query: q, - } -} - -// Load a TypeDef from its ID. -func (r *Client) LoadTypeDefFromID(id TypeDefID) *TypeDef { - q := r.query.Select("loadTypeDefFromID") - q = q.Arg("id", id) - - return &TypeDef{ - query: q, - } -} - -// Create a new module. -func (r *Client) Module() *Module { - q := r.query.Select("module") - - return &Module{ - query: q, - } -} - -// ModuleDependencyOpts contains options for Client.ModuleDependency -type ModuleDependencyOpts struct { - // If set, the name to use for the dependency. Otherwise, once installed to a parent module, the name of the dependency module will be used by default. - Name string -} - -// Create a new module dependency configuration from a module source and name -func (r *Client) ModuleDependency(source *ModuleSource, opts ...ModuleDependencyOpts) *ModuleDependency { - assertNotNil("source", source) - q := r.query.Select("moduleDependency") - for i := len(opts) - 1; i >= 0; i-- { - // `name` optional argument - if !querybuilder.IsZeroValue(opts[i].Name) { - q = q.Arg("name", opts[i].Name) - } - } - q = q.Arg("source", source) - - return &ModuleDependency{ - query: q, - } -} - -// ModuleSourceOpts contains options for Client.ModuleSource -type ModuleSourceOpts struct { - // If true, enforce that the source is a stable version for source kinds that support versioning. - Stable bool -} - -// Create a new module source instance from a source ref string. -func (r *Client) ModuleSource(refString string, opts ...ModuleSourceOpts) *ModuleSource { - q := r.query.Select("moduleSource") - for i := len(opts) - 1; i >= 0; i-- { - // `stable` optional argument - if !querybuilder.IsZeroValue(opts[i].Stable) { - q = q.Arg("stable", opts[i].Stable) - } - } - q = q.Arg("refString", refString) - - return &ModuleSource{ - query: q, - } -} - -// PipelineOpts contains options for Client.Pipeline -type PipelineOpts struct { - // Description of the sub-pipeline. - Description string - // Labels to apply to the sub-pipeline. - Labels []PipelineLabel -} - -// Creates a named sub-pipeline. -func (r *Client) Pipeline(name string, opts ...PipelineOpts) *Client { - q := r.query.Select("pipeline") - for i := len(opts) - 1; i >= 0; i-- { - // `description` optional argument - if !querybuilder.IsZeroValue(opts[i].Description) { - q = q.Arg("description", opts[i].Description) - } - // `labels` optional argument - if !querybuilder.IsZeroValue(opts[i].Labels) { - q = q.Arg("labels", opts[i].Labels) - } - } - q = q.Arg("name", name) - - return &Client{ - query: q, - client: r.client, - } -} - -// SecretOpts contains options for Client.Secret -type SecretOpts struct { - Accessor string -} - -// Reference a secret by name. -func (r *Client) Secret(name string, opts ...SecretOpts) *Secret { - q := r.query.Select("secret") - for i := len(opts) - 1; i >= 0; i-- { - // `accessor` optional argument - if !querybuilder.IsZeroValue(opts[i].Accessor) { - q = q.Arg("accessor", opts[i].Accessor) - } - } - q = q.Arg("name", name) - - return &Secret{ - query: q, - } -} - -// Sets a secret given a user defined name to its plaintext and returns the secret. -// -// The plaintext value is limited to a size of 128000 bytes. -func (r *Client) SetSecret(name string, plaintext string) *Secret { - q := r.query.Select("setSecret") - q = q.Arg("name", name) - q = q.Arg("plaintext", plaintext) - - return &Secret{ - query: q, - } -} - -// Loads a socket by its ID. -// -// Deprecated: Use LoadSocketFromID instead. -func (r *Client) Socket(id SocketID) *Socket { - q := r.query.Select("socket") - q = q.Arg("id", id) - - return &Socket{ - query: q, - } -} - -// Create a new TypeDef. -func (r *Client) TypeDef() *TypeDef { - q := r.query.Select("typeDef") - - return &TypeDef{ - query: q, - } -} - -// Get the current Dagger Engine version. -func (r *Client) Version(ctx context.Context) (string, error) { - q := r.query.Select("version") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A definition of a custom scalar defined in a Module. -type ScalarTypeDef struct { - query *querybuilder.Selection - - description *string - id *ScalarTypeDefID - name *string - sourceModuleName *string -} - -func (r *ScalarTypeDef) WithGraphQLQuery(q *querybuilder.Selection) *ScalarTypeDef { - return &ScalarTypeDef{ - query: q, - } -} - -// A doc string for the scalar, if any. -func (r *ScalarTypeDef) Description(ctx context.Context) (string, error) { - if r.description != nil { - return *r.description, nil - } - q := r.query.Select("description") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A unique identifier for this ScalarTypeDef. -func (r *ScalarTypeDef) ID(ctx context.Context) (ScalarTypeDefID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response ScalarTypeDefID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *ScalarTypeDef) XXX_GraphQLType() string { - return "ScalarTypeDef" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *ScalarTypeDef) XXX_GraphQLIDType() string { - return "ScalarTypeDefID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *ScalarTypeDef) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *ScalarTypeDef) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// The name of the scalar. -func (r *ScalarTypeDef) Name(ctx context.Context) (string, error) { - if r.name != nil { - return *r.name, nil - } - q := r.query.Select("name") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// If this ScalarTypeDef is associated with a Module, the name of the module. Unset otherwise. -func (r *ScalarTypeDef) SourceModuleName(ctx context.Context) (string, error) { - if r.sourceModuleName != nil { - return *r.sourceModuleName, nil - } - q := r.query.Select("sourceModuleName") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A reference to a secret value, which can be handled more safely than the value itself. -type Secret struct { - query *querybuilder.Selection - - id *SecretID - name *string - plaintext *string -} - -func (r *Secret) WithGraphQLQuery(q *querybuilder.Selection) *Secret { - return &Secret{ - query: q, - } -} - -// A unique identifier for this Secret. -func (r *Secret) ID(ctx context.Context) (SecretID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response SecretID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *Secret) XXX_GraphQLType() string { - return "Secret" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *Secret) XXX_GraphQLIDType() string { - return "SecretID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *Secret) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *Secret) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// The name of this secret. -func (r *Secret) Name(ctx context.Context) (string, error) { - if r.name != nil { - return *r.name, nil - } - q := r.query.Select("name") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// The value of this secret. -func (r *Secret) Plaintext(ctx context.Context) (string, error) { - if r.plaintext != nil { - return *r.plaintext, nil - } - q := r.query.Select("plaintext") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A content-addressed service providing TCP connectivity. -type Service struct { - query *querybuilder.Selection - - endpoint *string - hostname *string - id *ServiceID - start *ServiceID - stop *ServiceID - up *Void -} - -func (r *Service) WithGraphQLQuery(q *querybuilder.Selection) *Service { - return &Service{ - query: q, - } -} - -// ServiceEndpointOpts contains options for Service.Endpoint -type ServiceEndpointOpts struct { - // The exposed port number for the endpoint - Port int - // Return a URL with the given scheme, eg. http for http:// - Scheme string -} - -// Retrieves an endpoint that clients can use to reach this container. -// -// If no port is specified, the first exposed port is used. If none exist an error is returned. -// -// If a scheme is specified, a URL is returned. Otherwise, a host:port pair is returned. -func (r *Service) Endpoint(ctx context.Context, opts ...ServiceEndpointOpts) (string, error) { - if r.endpoint != nil { - return *r.endpoint, nil - } - q := r.query.Select("endpoint") - for i := len(opts) - 1; i >= 0; i-- { - // `port` optional argument - if !querybuilder.IsZeroValue(opts[i].Port) { - q = q.Arg("port", opts[i].Port) - } - // `scheme` optional argument - if !querybuilder.IsZeroValue(opts[i].Scheme) { - q = q.Arg("scheme", opts[i].Scheme) - } - } - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Retrieves a hostname which can be used by clients to reach this container. -func (r *Service) Hostname(ctx context.Context) (string, error) { - if r.hostname != nil { - return *r.hostname, nil - } - q := r.query.Select("hostname") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A unique identifier for this Service. -func (r *Service) ID(ctx context.Context) (ServiceID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response ServiceID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *Service) XXX_GraphQLType() string { - return "Service" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *Service) XXX_GraphQLIDType() string { - return "ServiceID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *Service) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *Service) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// Retrieves the list of ports provided by the service. -func (r *Service) Ports(ctx context.Context) ([]Port, error) { - q := r.query.Select("ports") - - q = q.Select("id") - - type ports struct { - Id PortID - } - - convert := func(fields []ports) []Port { - out := []Port{} - - for i := range fields { - val := Port{id: &fields[i].Id} - val.query = q.Root().Select("loadPortFromID").Arg("id", fields[i].Id) - out = append(out, val) - } - - return out - } - var response []ports - - q = q.Bind(&response) - - err := q.Execute(ctx) - if err != nil { - return nil, err - } - - return convert(response), nil -} - -// Start the service and wait for its health checks to succeed. -// -// Services bound to a Container do not need to be manually started. -func (r *Service) Start(ctx context.Context) (*Service, error) { - q := r.query.Select("start") - - return r, q.Execute(ctx) -} - -// ServiceStopOpts contains options for Service.Stop -type ServiceStopOpts struct { - // Immediately kill the service without waiting for a graceful exit - Kill bool -} - -// Stop the service. -func (r *Service) Stop(ctx context.Context, opts ...ServiceStopOpts) (*Service, error) { - q := r.query.Select("stop") - for i := len(opts) - 1; i >= 0; i-- { - // `kill` optional argument - if !querybuilder.IsZeroValue(opts[i].Kill) { - q = q.Arg("kill", opts[i].Kill) - } - } - - return r, q.Execute(ctx) -} - -// ServiceUpOpts contains options for Service.Up -type ServiceUpOpts struct { - // List of frontend/backend port mappings to forward. - // - // Frontend is the port accepting traffic on the host, backend is the service port. - Ports []PortForward - // Bind each tunnel port to a random port on the host. - Random bool -} - -// Creates a tunnel that forwards traffic from the caller's network to this service. -func (r *Service) Up(ctx context.Context, opts ...ServiceUpOpts) (Void, error) { - if r.up != nil { - return *r.up, nil - } - q := r.query.Select("up") - for i := len(opts) - 1; i >= 0; i-- { - // `ports` optional argument - if !querybuilder.IsZeroValue(opts[i].Ports) { - q = q.Arg("ports", opts[i].Ports) - } - // `random` optional argument - if !querybuilder.IsZeroValue(opts[i].Random) { - q = q.Arg("random", opts[i].Random) - } - } - - var response Void - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A Unix or TCP/IP socket that can be mounted into a container. -type Socket struct { - query *querybuilder.Selection - - id *SocketID -} - -func (r *Socket) WithGraphQLQuery(q *querybuilder.Selection) *Socket { - return &Socket{ - query: q, - } -} - -// A unique identifier for this Socket. -func (r *Socket) ID(ctx context.Context) (SocketID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response SocketID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *Socket) XXX_GraphQLType() string { - return "Socket" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *Socket) XXX_GraphQLIDType() string { - return "SocketID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *Socket) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *Socket) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// An interactive terminal that clients can connect to. -type Terminal struct { - query *querybuilder.Selection - - id *TerminalID - websocketEndpoint *string -} - -func (r *Terminal) WithGraphQLQuery(q *querybuilder.Selection) *Terminal { - return &Terminal{ - query: q, - } -} - -// A unique identifier for this Terminal. -func (r *Terminal) ID(ctx context.Context) (TerminalID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response TerminalID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *Terminal) XXX_GraphQLType() string { - return "Terminal" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *Terminal) XXX_GraphQLIDType() string { - return "TerminalID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *Terminal) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *Terminal) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// An http endpoint at which this terminal can be connected to over a websocket. -func (r *Terminal) WebsocketEndpoint(ctx context.Context) (string, error) { - if r.websocketEndpoint != nil { - return *r.websocketEndpoint, nil - } - q := r.query.Select("websocketEndpoint") - - var response string - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// A definition of a parameter or return type in a Module. -type TypeDef struct { - query *querybuilder.Selection - - id *TypeDefID - kind *TypeDefKind - optional *bool -} -type WithTypeDefFunc func(r *TypeDef) *TypeDef - -// With calls the provided function with current TypeDef. -// -// This is useful for reusability and readability by not breaking the calling chain. -func (r *TypeDef) With(f WithTypeDefFunc) *TypeDef { - return f(r) -} - -func (r *TypeDef) WithGraphQLQuery(q *querybuilder.Selection) *TypeDef { - return &TypeDef{ - query: q, - } -} - -// If kind is INPUT, the input-specific type definition. If kind is not INPUT, this will be null. -func (r *TypeDef) AsInput() *InputTypeDef { - q := r.query.Select("asInput") - - return &InputTypeDef{ - query: q, - } -} - -// If kind is INTERFACE, the interface-specific type definition. If kind is not INTERFACE, this will be null. -func (r *TypeDef) AsInterface() *InterfaceTypeDef { - q := r.query.Select("asInterface") - - return &InterfaceTypeDef{ - query: q, - } -} - -// If kind is LIST, the list-specific type definition. If kind is not LIST, this will be null. -func (r *TypeDef) AsList() *ListTypeDef { - q := r.query.Select("asList") - - return &ListTypeDef{ - query: q, - } -} - -// If kind is OBJECT, the object-specific type definition. If kind is not OBJECT, this will be null. -func (r *TypeDef) AsObject() *ObjectTypeDef { - q := r.query.Select("asObject") - - return &ObjectTypeDef{ - query: q, - } -} - -// If kind is SCALAR, the scalar-specific type definition. If kind is not SCALAR, this will be null. -func (r *TypeDef) AsScalar() *ScalarTypeDef { - q := r.query.Select("asScalar") - - return &ScalarTypeDef{ - query: q, - } -} - -// A unique identifier for this TypeDef. -func (r *TypeDef) ID(ctx context.Context) (TypeDefID, error) { - if r.id != nil { - return *r.id, nil - } - q := r.query.Select("id") - - var response TypeDefID - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// XXX_GraphQLType is an internal function. It returns the native GraphQL type name -func (r *TypeDef) XXX_GraphQLType() string { - return "TypeDef" -} - -// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object -func (r *TypeDef) XXX_GraphQLIDType() string { - return "TypeDefID" -} - -// XXX_GraphQLID is an internal function. It returns the underlying type ID -func (r *TypeDef) XXX_GraphQLID(ctx context.Context) (string, error) { - id, err := r.ID(ctx) - if err != nil { - return "", err - } - return string(id), nil -} - -func (r *TypeDef) MarshalJSON() ([]byte, error) { - id, err := r.ID(marshalCtx) - if err != nil { - return nil, err - } - return json.Marshal(id) -} - -// The kind of type this is (e.g. primitive, list, object). -func (r *TypeDef) Kind(ctx context.Context) (TypeDefKind, error) { - if r.kind != nil { - return *r.kind, nil - } - q := r.query.Select("kind") - - var response TypeDefKind - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Whether this type can be set to null. Defaults to false. -func (r *TypeDef) Optional(ctx context.Context) (bool, error) { - if r.optional != nil { - return *r.optional, nil - } - q := r.query.Select("optional") - - var response bool - - q = q.Bind(&response) - return response, q.Execute(ctx) -} - -// Adds a function for constructing a new instance of an Object TypeDef, failing if the type is not an object. -func (r *TypeDef) WithConstructor(function *Function) *TypeDef { - assertNotNil("function", function) - q := r.query.Select("withConstructor") - q = q.Arg("function", function) - - return &TypeDef{ - query: q, - } -} - -// TypeDefWithFieldOpts contains options for TypeDef.WithField -type TypeDefWithFieldOpts struct { - // A doc string for the field, if any - Description string -} - -// Adds a static field for an Object TypeDef, failing if the type is not an object. -func (r *TypeDef) WithField(name string, typeDef *TypeDef, opts ...TypeDefWithFieldOpts) *TypeDef { - assertNotNil("typeDef", typeDef) - q := r.query.Select("withField") - for i := len(opts) - 1; i >= 0; i-- { - // `description` optional argument - if !querybuilder.IsZeroValue(opts[i].Description) { - q = q.Arg("description", opts[i].Description) - } - } - q = q.Arg("name", name) - q = q.Arg("typeDef", typeDef) - - return &TypeDef{ - query: q, - } -} - -// Adds a function for an Object or Interface TypeDef, failing if the type is not one of those kinds. -func (r *TypeDef) WithFunction(function *Function) *TypeDef { - assertNotNil("function", function) - q := r.query.Select("withFunction") - q = q.Arg("function", function) - - return &TypeDef{ - query: q, - } -} - -// TypeDefWithInterfaceOpts contains options for TypeDef.WithInterface -type TypeDefWithInterfaceOpts struct { - Description string -} - -// Returns a TypeDef of kind Interface with the provided name. -func (r *TypeDef) WithInterface(name string, opts ...TypeDefWithInterfaceOpts) *TypeDef { - q := r.query.Select("withInterface") - for i := len(opts) - 1; i >= 0; i-- { - // `description` optional argument - if !querybuilder.IsZeroValue(opts[i].Description) { - q = q.Arg("description", opts[i].Description) - } - } - q = q.Arg("name", name) - - return &TypeDef{ - query: q, - } -} - -// Sets the kind of the type. -func (r *TypeDef) WithKind(kind TypeDefKind) *TypeDef { - q := r.query.Select("withKind") - q = q.Arg("kind", kind) - - return &TypeDef{ - query: q, - } -} - -// Returns a TypeDef of kind List with the provided type for its elements. -func (r *TypeDef) WithListOf(elementType *TypeDef) *TypeDef { - assertNotNil("elementType", elementType) - q := r.query.Select("withListOf") - q = q.Arg("elementType", elementType) - - return &TypeDef{ - query: q, - } -} - -// TypeDefWithObjectOpts contains options for TypeDef.WithObject -type TypeDefWithObjectOpts struct { - Description string -} - -// Returns a TypeDef of kind Object with the provided name. -// -// Note that an object's fields and functions may be omitted if the intent is only to refer to an object. This is how functions are able to return their own object, or any other circular reference. -func (r *TypeDef) WithObject(name string, opts ...TypeDefWithObjectOpts) *TypeDef { - q := r.query.Select("withObject") - for i := len(opts) - 1; i >= 0; i-- { - // `description` optional argument - if !querybuilder.IsZeroValue(opts[i].Description) { - q = q.Arg("description", opts[i].Description) - } - } - q = q.Arg("name", name) - - return &TypeDef{ - query: q, - } -} - -// Sets whether this type can be set to null. -func (r *TypeDef) WithOptional(optional bool) *TypeDef { - q := r.query.Select("withOptional") - q = q.Arg("optional", optional) - - return &TypeDef{ - query: q, - } -} - -// TypeDefWithScalarOpts contains options for TypeDef.WithScalar -type TypeDefWithScalarOpts struct { - Description string -} - -// Returns a TypeDef of kind Scalar with the provided name. -func (r *TypeDef) WithScalar(name string, opts ...TypeDefWithScalarOpts) *TypeDef { - q := r.query.Select("withScalar") - for i := len(opts) - 1; i >= 0; i-- { - // `description` optional argument - if !querybuilder.IsZeroValue(opts[i].Description) { - q = q.Arg("description", opts[i].Description) - } - } - q = q.Arg("name", name) - - return &TypeDef{ - query: q, - } -} - -type CacheSharingMode string - -func (CacheSharingMode) IsEnum() {} - -const ( - // Shares the cache volume amongst many build pipelines, but will serialize the writes - Locked CacheSharingMode = "LOCKED" - - // Keeps a cache volume for a single build pipeline - Private CacheSharingMode = "PRIVATE" - - // Shares the cache volume amongst many build pipelines - Shared CacheSharingMode = "SHARED" -) - -type ImageLayerCompression string - -func (ImageLayerCompression) IsEnum() {} - -const ( - Estargz ImageLayerCompression = "EStarGZ" - - Gzip ImageLayerCompression = "Gzip" - - Uncompressed ImageLayerCompression = "Uncompressed" - - Zstd ImageLayerCompression = "Zstd" -) - -type ImageMediaTypes string - -func (ImageMediaTypes) IsEnum() {} - -const ( - Dockermediatypes ImageMediaTypes = "DockerMediaTypes" - - Ocimediatypes ImageMediaTypes = "OCIMediaTypes" -) - -type ModuleSourceKind string - -func (ModuleSourceKind) IsEnum() {} - -const ( - GitSource ModuleSourceKind = "GIT_SOURCE" - - LocalSource ModuleSourceKind = "LOCAL_SOURCE" -) - -type NetworkProtocol string - -func (NetworkProtocol) IsEnum() {} - -const ( - Tcp NetworkProtocol = "TCP" - - Udp NetworkProtocol = "UDP" -) - -type TypeDefKind string - -func (TypeDefKind) IsEnum() {} - -const ( - // A boolean value. - BooleanKind TypeDefKind = "BOOLEAN_KIND" - - // A graphql input type, used only when representing the core API via TypeDefs. - InputKind TypeDefKind = "INPUT_KIND" - - // An integer value. - IntegerKind TypeDefKind = "INTEGER_KIND" - - // A named type of functions that can be matched+implemented by other objects+interfaces. - // - // Always paired with an InterfaceTypeDef. - InterfaceKind TypeDefKind = "INTERFACE_KIND" - - // A list of values all having the same type. - // - // Always paired with a ListTypeDef. - ListKind TypeDefKind = "LIST_KIND" - - // A named type defined in the GraphQL schema, with fields and functions. - // - // Always paired with an ObjectTypeDef. - ObjectKind TypeDefKind = "OBJECT_KIND" - - // A scalar value of any basic kind. - ScalarKind TypeDefKind = "SCALAR_KIND" - - // A string value. - StringKind TypeDefKind = "STRING_KIND" - - // A special kind used to signify that no value is returned. - // - // This is used for functions that have no return value. The outer TypeDef specifying this Kind is always Optional, as the Void is never actually represented. - VoidKind TypeDefKind = "VOID_KIND" -) diff --git a/vendor/dagger.io/dagger/fs.go b/vendor/dagger.io/dagger/fs.go deleted file mode 100644 index c8f66bf6..00000000 --- a/vendor/dagger.io/dagger/fs.go +++ /dev/null @@ -1,19 +0,0 @@ -package dagger - -import ( - "embed" -) - -// These are exported so that they can be used by codegen. - -//go:embed querybuilder/marshal.go querybuilder/querybuilder.go -var QueryBuilder embed.FS - -//go:embed telemetry/**.go -var Telemetry embed.FS - -//go:embed go.mod -var GoMod []byte - -//go:embed go.sum -var GoSum []byte diff --git a/vendor/dagger.io/dagger/generate.go b/vendor/dagger.io/dagger/generate.go deleted file mode 100644 index 57c85909..00000000 --- a/vendor/dagger.io/dagger/generate.go +++ /dev/null @@ -1,3 +0,0 @@ -package dagger - -//go:generate go -C ../../ run ./cmd/codegen --output ./sdk/go diff --git a/vendor/dagger.io/dagger/go.mod b/vendor/dagger.io/dagger/go.mod deleted file mode 100644 index cc76d410..00000000 --- a/vendor/dagger.io/dagger/go.mod +++ /dev/null @@ -1,45 +0,0 @@ -module dagger.io/dagger - -go 1.21 - -// retract engine releases from SDK releases -retract [v0.0.0, v0.2.36] - -require ( - github.com/99designs/gqlgen v0.17.44 - github.com/Khan/genqlient v0.7.0 - github.com/adrg/xdg v0.4.0 - github.com/stretchr/testify v1.9.0 - github.com/vektah/gqlparser/v2 v2.5.11 - go.opentelemetry.io/otel v1.24.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0 - go.opentelemetry.io/otel/sdk v1.24.0 - go.opentelemetry.io/otel/trace v1.24.0 - golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa - golang.org/x/sync v0.7.0 - google.golang.org/grpc v1.63.2 -) - -require ( - github.com/cenkalti/backoff/v4 v4.3.0 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.4.1 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect - github.com/mitchellh/go-homedir v1.1.0 - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/rogpeppe/go-internal v1.11.0 // indirect - github.com/sosodev/duration v1.2.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 // indirect - go.opentelemetry.io/otel/metric v1.24.0 // indirect - go.opentelemetry.io/proto/otlp v1.1.0 // indirect - golang.org/x/net v0.21.0 // indirect - golang.org/x/sys v0.17.0 // indirect - golang.org/x/text v0.14.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240325203815-454cdb8f5daa // indirect - google.golang.org/protobuf v1.33.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) diff --git a/vendor/dagger.io/dagger/go.sum b/vendor/dagger.io/dagger/go.sum deleted file mode 100644 index 32b4ce13..00000000 --- a/vendor/dagger.io/dagger/go.sum +++ /dev/null @@ -1,89 +0,0 @@ -github.com/99designs/gqlgen v0.17.44 h1:OS2wLk/67Y+vXM75XHbwRnNYJcbuJd4OBL76RX3NQQA= -github.com/99designs/gqlgen v0.17.44/go.mod h1:UTCu3xpK2mLI5qcMNw+HKDiEL77it/1XtAjisC4sLwM= -github.com/Khan/genqlient v0.7.0 h1:GZ1meyRnzcDTK48EjqB8t3bcfYvHArCUUvgOwpz1D4w= -github.com/Khan/genqlient v0.7.0/go.mod h1:HNyy3wZvuYwmW3Y7mkoQLZsa/R5n5yIRajS1kPBvSFM= -github.com/adrg/xdg v0.4.0 h1:RzRqFcjH4nE5C6oTAxhBtoE2IRyjBSa62SCbyPidvls= -github.com/adrg/xdg v0.4.0/go.mod h1:N6ag73EX4wyxeaoeHctc1mas01KZgsj5tYiAIwqJE/E= -github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= -github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= -github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= -github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= -github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 h1:Wqo399gCIufwto+VfwCSvsnfGpF/w5E9CNxSwbpD6No= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0/go.mod h1:qmOFXW2epJhM0qSnUUYpldc7gVz2KMQwJ/QYCDIa7XU= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= -github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= -github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= -github.com/sosodev/duration v1.2.0 h1:pqK/FLSjsAADWY74SyWDCjOcd5l7H8GSnnOGEB9A1Us= -github.com/sosodev/duration v1.2.0/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/vektah/gqlparser/v2 v2.5.11 h1:JJxLtXIoN7+3x6MBdtIP59TP1RANnY7pXOaDnADQSf8= -github.com/vektah/gqlparser/v2 v2.5.11/go.mod h1:1rCcfwB2ekJofmluGWXMSEnPMZgbxzwj6FaZ/4OT8Cc= -go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= -go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 h1:t6wl9SPayj+c7lEIFgm4ooDBZVb01IhLB4InpomhRw8= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0/go.mod h1:iSDOcsnSA5INXzZtwaBPrKp/lWu/V14Dd+llD0oI2EA= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0 h1:Mw5xcxMwlqoJd97vwPxA8isEaIoxsta9/Q51+TTJLGE= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0/go.mod h1:CQNu9bj7o7mC6U7+CA/schKEYakYXWr79ucDHTMGhCM= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0 h1:Xw8U6u2f8DK2XAkGRFV7BBLENgnTGX9i4rQRxJf+/vs= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0/go.mod h1:6KW1Fm6R/s6Z3PGXwSJN2K4eT6wQB3vXX6CVnYX9NmM= -go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= -go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= -go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw= -go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= -go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= -go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= -go.opentelemetry.io/proto/otlp v1.1.0 h1:2Di21piLrCqJ3U3eXGCTPHE9R8Nh+0uglSnOyxikMeI= -go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7ej/RNTae6MdY= -go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= -go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= -golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= -google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de h1:jFNzHPIeuzhdRwVhbZdiym9q0ory/xY3sA+v2wPg8I0= -google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:5iCWqnniDlqZHrd3neWVTOwvh/v6s3232omMecelax8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240325203815-454cdb8f5daa h1:RBgMaUMP+6soRkik4VoN8ojR2nex2TqZwjSSogic+eo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240325203815-454cdb8f5daa/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= -google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= -google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/vendor/dagger.io/dagger/internal/engineconn/cli.go b/vendor/dagger.io/dagger/internal/engineconn/cli.go deleted file mode 100644 index 92cdb809..00000000 --- a/vendor/dagger.io/dagger/internal/engineconn/cli.go +++ /dev/null @@ -1,329 +0,0 @@ -package engineconn - -import ( - "archive/tar" - "archive/zip" - "bufio" - "bytes" - "compress/gzip" - "context" - "crypto/sha256" - "fmt" - "io" - "net/http" - "net/url" - "os" - "os/exec" - "path/filepath" - "runtime" - "strings" - - "github.com/adrg/xdg" - "github.com/mitchellh/go-homedir" -) - -const ( - daggerCLIBinPrefix = "dagger-" - defaultCLIHost = "dl.dagger.io" - windowsPlatform = "windows" -) - -var ( - // Only modified by tests, not changeable by outside users due to being in - // an internal package - OverrideCLIArchiveURL string - OverrideChecksumsURL string -) - -func FromLocalCLI(ctx context.Context, cfg *Config) (EngineConn, bool, error) { - binPath, ok := os.LookupEnv("_EXPERIMENTAL_DAGGER_CLI_BIN") - if !ok { - return nil, false, nil - } - binPath, err := homedir.Expand(binPath) - if err != nil { - return nil, false, err - } - binPath, err = exec.LookPath(binPath) - if err != nil { - return nil, false, err - } - - conn, err := startCLISession(ctx, binPath, cfg) - if err != nil { - return nil, false, err - } - return conn, true, nil -} - -func FromDownloadedCLI(ctx context.Context, cfg *Config) (EngineConn, error) { - cacheDir := filepath.Join(xdg.CacheHome, "dagger") - if err := os.MkdirAll(cacheDir, 0o700); err != nil { - return nil, err - } - - binName := daggerCLIBinPrefix + CLIVersion - if runtime.GOOS == windowsPlatform { - binName += ".exe" - } - binPath := filepath.Join(cacheDir, binName) - - if _, err := os.Stat(binPath); os.IsNotExist(err) { - if cfg.LogOutput != nil { - fmt.Fprintf(cfg.LogOutput, "Downloading CLI... ") - } - - tmpbin, err := os.CreateTemp(cacheDir, "temp-"+binName) - if err != nil { - return nil, fmt.Errorf("failed to create temp file: %w", err) - } - defer tmpbin.Close() - defer os.Remove(tmpbin.Name()) - - // extract the CLI from the archive and verify it has the expected checksum - expected, err := expectedChecksum(ctx) - if err != nil { - return nil, err - } - - actual, err := extractCLI(ctx, tmpbin) - if err != nil { - return nil, err - } - - if actual != expected { - return nil, fmt.Errorf("checksum mismatch: expected %s, got %s", expected, actual) - } - - // make the temp file executable and move it to its final name - if err := tmpbin.Chmod(0o700); err != nil { - return nil, err - } - - if err := tmpbin.Close(); err != nil { - return nil, fmt.Errorf("failed to close temporary file: %w", err) - } - - if err := os.Rename(tmpbin.Name(), binPath); err != nil { - return nil, fmt.Errorf("failed to rename %q to %q: %w", tmpbin.Name(), binPath, err) - } - - if cfg.LogOutput != nil { - fmt.Fprintln(cfg.LogOutput, "OK!") - } - - // cleanup any old CLI binaries - entries, err := os.ReadDir(cacheDir) - if err != nil { - if cfg.LogOutput != nil { - fmt.Fprintf(cfg.LogOutput, "failed to list cache dir: %v", err) - } - } else { - for _, entry := range entries { - if entry.Name() == binName { - continue - } - if strings.HasPrefix(entry.Name(), daggerCLIBinPrefix) { - if err := os.Remove(filepath.Join(cacheDir, entry.Name())); err != nil { - if cfg.LogOutput != nil { - fmt.Fprintf(cfg.LogOutput, "failed to remove old dagger bin: %v", err) - } - } - } - } - } - } else if err != nil { - return nil, fmt.Errorf("failed to stat %q: %w", binPath, err) - } - - return startCLISession(ctx, binPath, cfg) -} - -// returns a map of CLI archive name -> checksum for that archive -func checksumMap(ctx context.Context) (map[string]string, error) { - checksums := make(map[string]string) - - checksumFileContents := bytes.NewBuffer(nil) - checksumReq, err := http.NewRequestWithContext(ctx, http.MethodGet, checksumsURL(), nil) - if err != nil { - return nil, fmt.Errorf("failed to create checksums request: %w", err) - } - resp, err := http.DefaultClient.Do(checksumReq) - if err != nil { - return nil, fmt.Errorf("failed to download checksums from %s: %w", checksumsURL(), err) - } - defer resp.Body.Close() - if resp.StatusCode != http.StatusOK { - return nil, fmt.Errorf("failed to download checksums from %s: %s", checksumsURL(), resp.Status) - } - if _, err := io.Copy(checksumFileContents, resp.Body); err != nil { - return nil, fmt.Errorf("failed to download checksums from %s: %w", checksumsURL(), err) - } - - scanner := bufio.NewScanner(checksumFileContents) - for scanner.Scan() { - line := scanner.Text() - parts := strings.Fields(line) - if len(parts) != 2 { - return nil, fmt.Errorf("invalid checksum line: %s", line) - } - checksums[parts[1]] = parts[0] - } - - return checksums, nil -} - -func expectedChecksum(ctx context.Context) (string, error) { - checksums, err := checksumMap(ctx) - if err != nil { - return "", err - } - - expected, ok := checksums[defaultCLIArchiveName()] - if !ok { - return "", fmt.Errorf("no checksum for %s", defaultCLIArchiveName()) - } - return expected, nil -} - -// Download the CLI archive and extract the CLI from it into the provided dest. -// Returns the sha256 hash of the whole archive as read during download. -func extractCLI(ctx context.Context, dest io.Writer) (string, error) { - archiveReq, err := http.NewRequestWithContext(ctx, http.MethodGet, cliArchiveURL(), nil) - if err != nil { - return "", fmt.Errorf("failed to create archive request: %w", err) - } - resp, err := http.DefaultClient.Do(archiveReq) - if err != nil { - return "", err - } - defer resp.Body.Close() - if resp.StatusCode != http.StatusOK { - return "", fmt.Errorf("failed to download CLI archive from %s: %s", cliArchiveURL(), resp.Status) - } - - // the body is either a tar.gz file or (on windows) a zipfile, unpack it and extract the dagger binary - hasher := sha256.New() - reader := io.TeeReader(resp.Body, hasher) - if runtime.GOOS == windowsPlatform { - if err := extractZip(reader, dest); err != nil { - return "", err - } - } else if err := extractTarCLI(reader, dest); err != nil { - return "", err - } - - _, err = io.ReadAll(reader) // ensure the entire body is read into the hash - if err != nil { - return "", err - } - - return fmt.Sprintf("%x", hasher.Sum(nil)), nil -} - -func extractTarCLI(src io.Reader, dest io.Writer) error { - gzipReader, err := gzip.NewReader(src) - if err != nil { - return err - } - defer gzipReader.Close() - tarReader := tar.NewReader(gzipReader) - var found bool - for { - header, err := tarReader.Next() - if err == io.EOF { - break - } - if err != nil { - return err - } - if filepath.Base(header.Name) == "dagger" { - // limit the amount of data to prevent a decompression bomb (gosec G110) - if _, err := io.CopyN(dest, tarReader, 1024*1024*1024); err != nil && err != io.EOF { - return err - } - found = true - } - } - if !found { - return fmt.Errorf("failed to find dagger binary in tar.gz") - } - return nil -} - -func extractZip(src io.Reader, dest io.Writer) error { - tmpFile, err := os.CreateTemp("", "dagger-cli-*.zip") - if err != nil { - return err - } - defer os.Remove(tmpFile.Name()) - defer tmpFile.Close() - if _, err := io.Copy(tmpFile, src); err != nil { - return err - } - zipReader, err := zip.OpenReader(tmpFile.Name()) - if err != nil { - return err - } - defer zipReader.Close() - var found bool - for _, file := range zipReader.File { - if filepath.Base(file.Name) == "dagger.exe" { - f, err := file.Open() - if err != nil { - return err - } - defer f.Close() - // limit the amount of data to prevent a decompression bomb (gosec G110) - if _, err := io.CopyN(dest, f, 1024*1024*1024); err != nil && err != io.EOF { - return err - } - found = true - } - } - if !found { - return fmt.Errorf("failed to find dagger.exe binary in zip") - } - return nil -} - -func defaultCLIArchiveName() string { - if OverrideCLIArchiveURL != "" { - url, err := url.Parse(OverrideCLIArchiveURL) - if err != nil { - panic(err) - } - return filepath.Base(url.Path) - } - ext := "tar.gz" - if runtime.GOOS == windowsPlatform { - ext = "zip" - } - return fmt.Sprintf("dagger_v%s_%s_%s.%s", - CLIVersion, - runtime.GOOS, - runtime.GOARCH, - ext, - ) -} - -func cliArchiveURL() string { - if OverrideCLIArchiveURL != "" { - return OverrideCLIArchiveURL - } - return fmt.Sprintf("https://%s/dagger/releases/%s/%s", - defaultCLIHost, - CLIVersion, - defaultCLIArchiveName(), - ) -} - -func checksumsURL() string { - if OverrideChecksumsURL != "" { - return OverrideChecksumsURL - } - return fmt.Sprintf("https://%s/dagger/releases/%s/checksums.txt", - defaultCLIHost, - CLIVersion, - ) -} diff --git a/vendor/dagger.io/dagger/internal/engineconn/engineconn.go b/vendor/dagger.io/dagger/internal/engineconn/engineconn.go deleted file mode 100644 index 0cc2bc21..00000000 --- a/vendor/dagger.io/dagger/internal/engineconn/engineconn.go +++ /dev/null @@ -1,107 +0,0 @@ -package engineconn - -import ( - "context" - "fmt" - "io" - "log/slog" - "net" - "net/http" - "os" - - "github.com/Khan/genqlient/graphql" - "go.opentelemetry.io/otel/propagation" - "go.opentelemetry.io/otel/trace" -) - -type EngineConn interface { - graphql.Doer - Host() string - Close() error -} - -type Config struct { - Workdir string - LogOutput io.Writer - Conn EngineConn - - SkipCompatibilityCheck bool -} - -type ConnectParams struct { - Port int `json:"port"` - SessionToken string `json:"session_token"` -} - -func Get(ctx context.Context, cfg *Config) (EngineConn, error) { - // Prefer explicitly set conn - if cfg.Conn != nil { - return cfg.Conn, nil - } - - // Try DAGGER_SESSION_PORT next - conn, ok, err := FromSessionEnv() - if err != nil { - return nil, err - } - if ok { - if cfg.Workdir != "" { - return nil, fmt.Errorf("cannot configure workdir for existing session (please use --workdir or host.directory with absolute paths instead)") - } - return conn, nil - } - - // Try _EXPERIMENTAL_DAGGER_CLI_BIN next - conn, ok, err = FromLocalCLI(ctx, cfg) - if err != nil { - return nil, err - } - if ok { - return conn, nil - } - - // Fallback to downloading the CLI - conn, err = FromDownloadedCLI(ctx, cfg) - if err != nil { - return nil, err - } - return conn, nil -} - -func fallbackSpanContext(ctx context.Context) context.Context { - if trace.SpanContextFromContext(ctx).IsValid() { - return ctx - } - if p, ok := os.LookupEnv("TRACEPARENT"); ok { - slog.Debug("falling back to $TRACEPARENT", "value", p) - return propagation.TraceContext{}.Extract(ctx, propagation.MapCarrier{"traceparent": p}) - } - return ctx -} - -func defaultHTTPClient(p *ConnectParams) *http.Client { - dialTransport := &http.Transport{ - DialContext: func(_ context.Context, _, _ string) (net.Conn, error) { - return net.Dial("tcp", fmt.Sprintf("127.0.0.1:%d", p.Port)) - }, - } - return &http.Client{ - Transport: RoundTripperFunc(func(r *http.Request) (*http.Response, error) { - r.SetBasicAuth(p.SessionToken, "") - - // detect $TRACEPARENT set by 'dagger run' - r = r.WithContext(fallbackSpanContext(r.Context())) - - // propagate span context via headers (i.e. for Dagger-in-Dagger) - propagation.TraceContext{}.Inject(r.Context(), propagation.HeaderCarrier(r.Header)) - - return dialTransport.RoundTrip(r) - }), - } -} - -type RoundTripperFunc func(*http.Request) (*http.Response, error) - -func (f RoundTripperFunc) RoundTrip(r *http.Request) (*http.Response, error) { - return f(r) -} diff --git a/vendor/dagger.io/dagger/internal/engineconn/env.go b/vendor/dagger.io/dagger/internal/engineconn/env.go deleted file mode 100644 index b1a99455..00000000 --- a/vendor/dagger.io/dagger/internal/engineconn/env.go +++ /dev/null @@ -1,47 +0,0 @@ -package engineconn - -import ( - "fmt" - "net/http" - "os" - "strconv" -) - -func FromSessionEnv() (EngineConn, bool, error) { - portStr, ok := os.LookupEnv("DAGGER_SESSION_PORT") - if !ok { - return nil, false, nil - } - port, err := strconv.Atoi(portStr) - if err != nil { - return nil, false, fmt.Errorf("invalid port in DAGGER_SESSION_PORT: %w", err) - } - - sessionToken := os.Getenv("DAGGER_SESSION_TOKEN") - if sessionToken == "" { - return nil, false, fmt.Errorf("DAGGER_SESSION_TOKEN must be set when using DAGGER_SESSION_PORT") - } - - httpClient := defaultHTTPClient(&ConnectParams{ - Port: port, - SessionToken: sessionToken, - }) - - return &sessionEnvConn{ - Client: httpClient, - host: fmt.Sprintf("127.0.0.1:%d", port), - }, true, nil -} - -type sessionEnvConn struct { - *http.Client - host string -} - -func (c *sessionEnvConn) Host() string { - return c.host -} - -func (c *sessionEnvConn) Close() error { - return nil -} diff --git a/vendor/dagger.io/dagger/internal/engineconn/session.go b/vendor/dagger.io/dagger/internal/engineconn/session.go deleted file mode 100644 index 0f8b16ac..00000000 --- a/vendor/dagger.io/dagger/internal/engineconn/session.go +++ /dev/null @@ -1,277 +0,0 @@ -package engineconn - -import ( - "bufio" - "bytes" - "context" - "encoding/json" - "errors" - "fmt" - "io" - "net/http" - "os" - "os/exec" - "runtime/debug" - "strings" - "sync" - "time" - - "go.opentelemetry.io/otel/propagation" -) - -type cliSessionConn struct { - *http.Client - childCancel func() - childProc *exec.Cmd -} - -func (c *cliSessionConn) Host() string { - return "dagger" -} - -func (c *cliSessionConn) Close() error { - if c.childCancel != nil && c.childProc != nil { - c.childCancel() - err := c.childProc.Wait() - if err != nil { - if errors.Is(err, context.Canceled) { - // expected - return nil - } - - return err - } - } - return nil -} - -func getSDKVersion() string { - version := "n/a" - info, ok := debug.ReadBuildInfo() - if !ok { - return version - } - - for _, dep := range info.Deps { - if dep.Path == "dagger.io/dagger" { - version = dep.Version - if version[0] == 'v' { - version = version[1:] - } - break - } - } - return version -} - -func startCLISession(ctx context.Context, binPath string, cfg *Config) (_ EngineConn, rerr error) { - args := []string{"session"} - - version := getSDKVersion() - - flagsAndValues := []struct { - flag string - value string - }{ - {"--workdir", cfg.Workdir}, - {"--label", "dagger.io/sdk.name:go"}, - {"--label", fmt.Sprintf("dagger.io/sdk.version:%s", version)}, - } - - for _, pair := range flagsAndValues { - if pair.value != "" { - args = append(args, pair.flag, pair.value) - } - } - - env := os.Environ() - - // detect $TRACEPARENT set by 'dagger run' - ctx = fallbackSpanContext(ctx) - - // propagate trace context to the child process (i.e. for Dagger-in-Dagger) - carrier := propagation.MapCarrier{} - propagation.TraceContext{}.Inject(ctx, carrier) - for key, value := range carrier { - env = append(env, strings.ToUpper(key)+"="+value) - } - - cmdCtx, cmdCancel := context.WithCancel(ctx) - - // Workaround https://github.com/golang/go/issues/22315 - // Basically, if any other code in this process does fork/exec, it may - // temporarily have the tmpbin fd that we closed earlier open still, and it - // will be open for writing. Even though we rename the file, the - // underlying inode is the same and thus we can get a "text file busy" - // error when trying to exec it below. - // - // We workaround this the same way suggested in the issue, by sleeping - // and retrying the exec a few times. This is such an obscure case that - // this retry approach should be fine. It can only happen when a new - // dagger binary needs to be created and even then only if many - // threads within this process are trying to provision it at the same time. - var proc *exec.Cmd - var stdout io.ReadCloser - var stderrBuf *safeBuffer - var childStdin io.WriteCloser - - if cfg.LogOutput != nil { - fmt.Fprintf(cfg.LogOutput, "Creating new Engine session... ") - } - - for i := 0; i < 10; i++ { - proc = exec.CommandContext(cmdCtx, binPath, args...) - proc.Env = env - - var err error - stdout, err = proc.StdoutPipe() - if err != nil { - cmdCancel() - return nil, err - } - defer stdout.Close() // don't need it after we read the port - - stderrPipe, err := proc.StderrPipe() - if err != nil { - cmdCancel() - return nil, err - } - if cfg.LogOutput == nil { - cfg.LogOutput = io.Discard - } - - // Write stderr to logWriter but also buffer it for the duration - // of this function so we can return it in the error if something - // goes wrong here. Otherwise the only error ends up being EOF and - // the user has to enable log output to see anything. - stderrBuf = &safeBuffer{} - discardableBuf := &discardableWriter{w: stderrBuf} - go io.Copy(io.MultiWriter(cfg.LogOutput, discardableBuf), stderrPipe) - defer discardableBuf.Discard() - - // Open a stdin pipe with the child process. The engine-session shutsdown - // when it is closed. This is a platform-agnostic way of ensuring - // we don't leak child processes even if this process is SIGKILL'd. - childStdin, err = proc.StdinPipe() - if err != nil { - cmdCancel() - return nil, err - } - - // Kill the child process by closing stdin, not via SIGKILL, so it has a - // chance to drain logs. - proc.Cancel = childStdin.Close - - // Set a long timeout to give time for any cache exports to pack layers up - // which currently has to happen synchronously with the session. - proc.WaitDelay = 300 * time.Second // 5 mins - - if err := proc.Start(); err != nil { - if strings.Contains(err.Error(), "text file busy") { - time.Sleep(100 * time.Millisecond) - proc = nil - stdout.Close() - stdout = nil - stderrPipe.Close() - stderrBuf = nil - childStdin.Close() - childStdin = nil - continue - } - cmdCancel() - return nil, err - } - break - } - if proc == nil { - cmdCancel() - return nil, fmt.Errorf("failed to start dagger session") - } - - defer func() { - if rerr != nil { - stderrContents := stderrBuf.String() - if stderrContents != "" { - rerr = fmt.Errorf("%w: %s", rerr, stderrContents) - } - } - }() - - if cfg.LogOutput != nil { - fmt.Fprintf(cfg.LogOutput, "OK!\nEstablishing connection to Engine... ") - } - - // Read the connect params from stdout. - paramCh := make(chan error, 1) - var params ConnectParams - go func() { - defer close(paramCh) - paramBytes, err := bufio.NewReader(stdout).ReadBytes('\n') - if err != nil { - paramCh <- err - return - } - if err := json.Unmarshal(paramBytes, ¶ms); err != nil { - paramCh <- err - } - }() - - select { - case err := <-paramCh: - if err != nil { - cmdCancel() - return nil, err - } - - case <-time.After(300 * time.Second): - // really long time to account for extensions that need to build, though - // that path should be optimized in future - cmdCancel() - return nil, fmt.Errorf("timed out waiting for session params") - } - - if cfg.LogOutput != nil { - fmt.Fprintln(cfg.LogOutput, "OK!") - } - - return &cliSessionConn{ - Client: defaultHTTPClient(¶ms), - childCancel: cmdCancel, - childProc: proc, - }, nil -} - -// a writer that can later be turned into io.Discard -type discardableWriter struct { - mu sync.RWMutex - w io.Writer -} - -func (w *discardableWriter) Write(p []byte) (int, error) { - w.mu.RLock() - defer w.mu.RUnlock() - return w.w.Write(p) -} - -func (w *discardableWriter) Discard() { - w.mu.Lock() - defer w.mu.Unlock() - w.w = io.Discard -} - -type safeBuffer struct { - bu bytes.Buffer - mu sync.Mutex -} - -func (s *safeBuffer) Write(p []byte) (n int, err error) { - s.mu.Lock() - defer s.mu.Unlock() - return s.bu.Write(p) -} - -func (s *safeBuffer) String() string { - s.mu.Lock() - defer s.mu.Unlock() - return s.bu.String() -} diff --git a/vendor/dagger.io/dagger/internal/engineconn/version.gen.go b/vendor/dagger.io/dagger/internal/engineconn/version.gen.go deleted file mode 100644 index 0652efcf..00000000 --- a/vendor/dagger.io/dagger/internal/engineconn/version.gen.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by dagger. DO NOT EDIT. - -package engineconn - -const CLIVersion = "0.11.4" diff --git a/vendor/dagger.io/dagger/querybuilder/marshal.go b/vendor/dagger.io/dagger/querybuilder/marshal.go deleted file mode 100644 index 1f5468af..00000000 --- a/vendor/dagger.io/dagger/querybuilder/marshal.go +++ /dev/null @@ -1,162 +0,0 @@ -package querybuilder - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "reflect" - "strings" - - gqlgen "github.com/99designs/gqlgen/graphql" - "golang.org/x/exp/slices" - "golang.org/x/sync/errgroup" -) - -// GraphQLMarshaller is an internal interface for marshalling an object into GraphQL. -type GraphQLMarshaller interface { - // XXX_GraphQLType is an internal function. It returns the native GraphQL type name - XXX_GraphQLType() string - // XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object - XXX_GraphQLIDType() string - // XXX_GraphqlID is an internal function. It returns the underlying type ID - XXX_GraphQLID(ctx context.Context) (string, error) - json.Marshaler -} - -const ( - GraphQLMarshallerType = "XXX_GraphQLType" - GraphQLMarshallerIDType = "XXX_GraphQLIDType" - GraphQLMarshallerID = "XXX_GraphQLID" -) - -type enum interface { - IsEnum() -} - -var ( - gqlMarshaller = reflect.TypeOf((*GraphQLMarshaller)(nil)).Elem() - enumT = reflect.TypeOf((*enum)(nil)).Elem() -) - -func MarshalGQL(ctx context.Context, v any) (string, error) { - return marshalValue(ctx, reflect.ValueOf(v)) -} - -func marshalValue(ctx context.Context, v reflect.Value) (string, error) { - t := v.Type() - - if t.Implements(gqlMarshaller) { - return marshalCustom(ctx, v) - } - - switch t.Kind() { - case reflect.Bool: - return fmt.Sprintf("%t", v.Bool()), nil - case reflect.Int: - return fmt.Sprintf("%d", v.Int()), nil - case reflect.String: - if t.Implements(enumT) { - // enums render as their literal value - return v.String(), nil - } - - // escape strings following graphQL spec - // https://github.com/graphql/graphql-spec/blob/main/spec/Section%202%20--%20Language.md#string-value - var buf bytes.Buffer - gqlgen.MarshalString(v.String()).MarshalGQL(&buf) - return buf.String(), nil - case reflect.Pointer, reflect.Interface: - if v.IsNil() { - return "null", nil - } - return marshalValue(ctx, v.Elem()) - case reflect.Slice: - n := v.Len() - elems := make([]string, n) - eg, gctx := errgroup.WithContext(ctx) - for i := 0; i < n; i++ { - i := i - eg.Go(func() error { - m, err := marshalValue(gctx, v.Index(i)) - if err != nil { - return err - } - elems[i] = m - return nil - }) - } - if err := eg.Wait(); err != nil { - return "", err - } - return fmt.Sprintf("[%s]", strings.Join(elems, ",")), nil - case reflect.Struct: - n := v.NumField() - elems := make([]string, n) - eg, gctx := errgroup.WithContext(ctx) - for i := 0; i < n; i++ { - i := i - eg.Go(func() error { - f := t.Field(i) - fv := v.Field(i) - name := f.Name - jsonTag := strings.Split(f.Tag.Get("json"), ",") - if jsonTag[0] != "" { - name = jsonTag[0] - } - isOptional := slices.Contains(jsonTag[1:], "omitempty") - if isOptional && IsZeroValue(fv.Interface()) { - return nil - } - m, err := marshalValue(gctx, fv) - if err != nil { - return err - } - if m != `""` && m != "null" { - elems[i] = fmt.Sprintf("%s:%s", name, m) - } - return nil - }) - } - if err := eg.Wait(); err != nil { - return "", err - } - nonNullElems := make([]string, 0, n) - for _, elem := range elems { - if elem != "" { - nonNullElems = append(nonNullElems, elem) - } - } - return fmt.Sprintf("{%s}", strings.Join(nonNullElems, ",")), nil - default: - panic(fmt.Errorf("unsupported argument of kind %s", t.Kind())) - } -} - -func marshalCustom(ctx context.Context, v reflect.Value) (string, error) { - result := v.MethodByName(GraphQLMarshallerID).Call([]reflect.Value{ - reflect.ValueOf(ctx), - }) - if len(result) != 2 { - panic(result) - } - err := result[1].Interface() - if err != nil { - return "", err.(error) - } - - return fmt.Sprintf("%q", result[0].String()), nil -} - -func IsZeroValue(value any) bool { - v := reflect.ValueOf(value) - kind := v.Type().Kind() - switch kind { - case reflect.Pointer: - return v.IsNil() - case reflect.Slice, reflect.Array: - return v.Len() == 0 - default: - return v.IsZero() - } -} diff --git a/vendor/dagger.io/dagger/querybuilder/querybuilder.go b/vendor/dagger.io/dagger/querybuilder/querybuilder.go deleted file mode 100644 index 64a32e0d..00000000 --- a/vendor/dagger.io/dagger/querybuilder/querybuilder.go +++ /dev/null @@ -1,204 +0,0 @@ -package querybuilder - -import ( - "context" - "encoding/json" - "fmt" - "runtime/debug" - "strings" - "sync" - - "github.com/Khan/genqlient/graphql" - "golang.org/x/sync/errgroup" -) - -func Query() *Selection { - return &Selection{} -} - -type Selection struct { - name string - alias string - args map[string]*argument - bind interface{} - - prev *Selection - - client graphql.Client -} - -func (s *Selection) path() []*Selection { - selections := []*Selection{} - for sel := s; sel.prev != nil; sel = sel.prev { - selections = append([]*Selection{sel}, selections...) - } - - return selections -} - -func (s *Selection) Root() *Selection { - return &Selection{ - client: s.client, - } -} - -func (s *Selection) SelectWithAlias(alias, name string) *Selection { - sel := &Selection{ - name: name, - prev: s, - alias: alias, - client: s.client, - } - return sel -} - -func (s *Selection) Select(name string) *Selection { - return s.SelectWithAlias("", name) -} - -func (s *Selection) Arg(name string, value any) *Selection { - sel := *s - if sel.args == nil { - sel.args = map[string]*argument{} - } - - sel.args[name] = &argument{ - value: value, - } - return &sel -} - -func (s *Selection) Bind(v interface{}) *Selection { - sel := *s - sel.bind = v - return &sel -} - -func (s *Selection) marshalArguments(ctx context.Context) error { - eg, gctx := errgroup.WithContext(ctx) - for _, sel := range s.path() { - for _, arg := range sel.args { - arg := arg - eg.Go(func() error { - return arg.marshal(gctx) - }) - } - } - - return eg.Wait() -} - -func (s *Selection) Build(ctx context.Context) (string, error) { - if err := s.marshalArguments(ctx); err != nil { - return "", err - } - - var b strings.Builder - b.WriteString("query") - - path := s.path() - - for _, sel := range path { - b.WriteRune('{') - - if sel.alias != "" { - b.WriteString(sel.alias) - b.WriteRune(':') - } - - b.WriteString(sel.name) - - if len(sel.args) > 0 { - b.WriteRune('(') - i := 0 - for name, arg := range sel.args { - if i > 0 { - b.WriteString(", ") - } - b.WriteString(name) - b.WriteRune(':') - b.WriteString(arg.marshalled) - i++ - } - b.WriteRune(')') - } - } - - b.WriteString(strings.Repeat("}", len(path))) - return b.String(), nil -} - -func (s *Selection) unpack(data interface{}) error { - for _, i := range s.path() { - k := i.name - if i.alias != "" { - k = i.alias - } - - // Try to assert type of the value - switch f := data.(type) { - case map[string]interface{}: - data = f[k] - case []interface{}: - data = f - default: - fmt.Printf("type not found %s\n", f) - } - - if i.bind != nil { - marshalled, err := json.Marshal(data) - if err != nil { - return err - } - json.Unmarshal(marshalled, s.bind) - } - } - - return nil -} - -func (s *Selection) Client(c graphql.Client) *Selection { - sel := *s - sel.client = c - return &sel -} - -func (s *Selection) Execute(ctx context.Context) error { - if s.client == nil { - debug.PrintStack() - return fmt.Errorf("no client configured for selection") - } - - query, err := s.Build(ctx) - if err != nil { - return err - } - - var response any - err = s.client.MakeRequest(ctx, - &graphql.Request{ - Query: query, - }, - &graphql.Response{Data: &response}, - ) - if err != nil { - return err - } - - return s.unpack(response) -} - -type argument struct { - value any - - marshalled string - marshalledErr error - once sync.Once -} - -func (a *argument) marshal(ctx context.Context) error { - a.once.Do(func() { - a.marshalled, a.marshalledErr = MarshalGQL(ctx, a.value) - }) - return a.marshalledErr -} diff --git a/vendor/dagger.io/dagger/telemetry/attrs.go b/vendor/dagger.io/dagger/telemetry/attrs.go deleted file mode 100644 index edca3770..00000000 --- a/vendor/dagger.io/dagger/telemetry/attrs.go +++ /dev/null @@ -1,31 +0,0 @@ -package telemetry - -const ( - DagDigestAttr = "dagger.io/dag.digest" - - DagInputsAttr = "dagger.io/dag.inputs" - DagOutputAttr = "dagger.io/dag.output" - - CachedAttr = "dagger.io/dag.cached" - CanceledAttr = "dagger.io/dag.canceled" - InternalAttr = "dagger.io/dag.internal" - - DagCallAttr = "dagger.io/dag.call" - - LLBOpAttr = "dagger.io/llb.op" - - // Hide child spans by default. - UIEncapsulateAttr = "dagger.io/ui.encapsulate" - - // The following are theoretical, if/when we want to express the same - // concepts from Progrock. - - // The parent span of this task. Might not need this at all, if we want to - // just rely on span parent, but the thinking is the span parent could be - // pretty brittle. - TaskParentAttr = "dagger.io/task.parent" - - // Progress bars. - ProgressCurrentAttr = "dagger.io/progress.current" - ProgressTotalAttr = "dagger.io/progress.total" -) diff --git a/vendor/dagger.io/dagger/telemetry/batch_processor.go b/vendor/dagger.io/dagger/telemetry/batch_processor.go deleted file mode 100644 index f5c49a08..00000000 --- a/vendor/dagger.io/dagger/telemetry/batch_processor.go +++ /dev/null @@ -1,455 +0,0 @@ -package telemetry - -import ( - "context" - "sync" - "sync/atomic" - "time" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/sdk/trace" - otrace "go.opentelemetry.io/otel/trace" -) - -// Defaults for BatchSpanProcessorOptions. -const ( - DefaultMaxQueueSize = 2048 - DefaultScheduleDelay = 5000 - DefaultExportTimeout = 30000 - DefaultMaxExportBatchSize = 512 - - defaultSpanKeepAlive = 30 * time.Second -) - -// BatchSpanProcessorOption configures a BatchSpanProcessor. -type BatchSpanProcessorOption func(o *BatchSpanProcessorOptions) - -// BatchSpanProcessorOptions is configuration settings for a -// BatchSpanProcessor. -type BatchSpanProcessorOptions struct { - // MaxQueueSize is the maximum queue size to buffer spans for delayed processing. If the - // queue gets full it drops the spans. Use BlockOnQueueFull to change this behavior. - // The default value of MaxQueueSize is 2048. - MaxQueueSize int - - // BatchTimeout is the maximum duration for constructing a batch. Processor - // forcefully sends available spans when timeout is reached. - // The default value of BatchTimeout is 5000 msec. - BatchTimeout time.Duration - - // ExportTimeout specifies the maximum duration for exporting spans. If the timeout - // is reached, the export will be cancelled. - // The default value of ExportTimeout is 30000 msec. - ExportTimeout time.Duration - - // MaxExportBatchSize is the maximum number of spans to process in a single batch. - // If there are more than one batch worth of spans then it processes multiple batches - // of spans one batch after the other without any delay. - // The default value of MaxExportBatchSize is 512. - MaxExportBatchSize int - - // BlockOnQueueFull blocks onEnd() and onStart() method if the queue is full - // AND if BlockOnQueueFull is set to true. - // Blocking option should be used carefully as it can severely affect the performance of an - // application. - BlockOnQueueFull bool -} - -// batchSpanProcessor is a SpanProcessor that batches asynchronously-received -// spans and sends them to a trace.Exporter when complete. -type batchSpanProcessor struct { - e trace.SpanExporter - o BatchSpanProcessorOptions - - queue chan trace.ReadOnlySpan - dropped uint32 - - batch []trace.ReadOnlySpan - batchMutex sync.Mutex - batchSpans map[otrace.SpanID]int - inProgressSpans map[otrace.SpanID]*inProgressSpan - timer *time.Timer - stopWait sync.WaitGroup - stopOnce sync.Once - stopCh chan struct{} - stopped atomic.Bool -} - -type inProgressSpan struct { - trace.ReadOnlySpan - UpdatedAt time.Time -} - -var _ trace.SpanProcessor = (*batchSpanProcessor)(nil) - -// NewBatchSpanProcessor creates a new SpanProcessor that will send completed -// span batches to the exporter with the supplied options. -// -// If the exporter is nil, the span processor will perform no action. -func NewBatchSpanProcessor(exporter trace.SpanExporter, options ...BatchSpanProcessorOption) *batchSpanProcessor { - maxQueueSize := DefaultMaxQueueSize - maxExportBatchSize := DefaultMaxExportBatchSize - - if maxExportBatchSize > maxQueueSize { - if DefaultMaxExportBatchSize > maxQueueSize { - maxExportBatchSize = maxQueueSize - } else { - maxExportBatchSize = DefaultMaxExportBatchSize - } - } - - o := BatchSpanProcessorOptions{ - BatchTimeout: time.Duration(DefaultScheduleDelay) * time.Millisecond, - ExportTimeout: time.Duration(DefaultExportTimeout) * time.Millisecond, - MaxQueueSize: maxQueueSize, - MaxExportBatchSize: maxExportBatchSize, - } - for _, opt := range options { - opt(&o) - } - bsp := &batchSpanProcessor{ - e: exporter, - o: o, - batch: make([]trace.ReadOnlySpan, 0, o.MaxExportBatchSize), - batchSpans: make(map[otrace.SpanID]int), - inProgressSpans: make(map[otrace.SpanID]*inProgressSpan), - timer: time.NewTimer(o.BatchTimeout), - queue: make(chan trace.ReadOnlySpan, o.MaxQueueSize), - stopCh: make(chan struct{}), - } - - bsp.stopWait.Add(1) - go func() { - defer bsp.stopWait.Done() - bsp.processQueue() - bsp.drainQueue() - }() - - return bsp -} - -// OnStart method enqueues a trace.ReadOnlySpan for later processing. -func (bsp *batchSpanProcessor) OnStart(parent context.Context, s trace.ReadWriteSpan) { - bsp.enqueue(s) -} - -// OnUpdate method enqueues a trace.ReadOnlySpan for later processing. -func (bsp *batchSpanProcessor) OnUpdate(s trace.ReadOnlySpan) { - bsp.enqueue(s) -} - -// OnEnd method enqueues a trace.ReadOnlySpan for later processing. -func (bsp *batchSpanProcessor) OnEnd(s trace.ReadOnlySpan) { - bsp.enqueue(s) -} - -// Shutdown flushes the queue and waits until all spans are processed. -// It only executes once. Subsequent call does nothing. -func (bsp *batchSpanProcessor) Shutdown(ctx context.Context) error { - var err error - bsp.stopOnce.Do(func() { - bsp.stopped.Store(true) - wait := make(chan struct{}) - go func() { - close(bsp.stopCh) - bsp.stopWait.Wait() - if bsp.e != nil { - if err := bsp.e.Shutdown(ctx); err != nil { - otel.Handle(err) - } - } - close(wait) - }() - // Wait until the wait group is done or the context is cancelled - select { - case <-wait: - case <-ctx.Done(): - err = ctx.Err() - } - }) - return err -} - -type forceFlushSpan struct { - trace.ReadOnlySpan - flushed chan struct{} -} - -func (f forceFlushSpan) SpanContext() otrace.SpanContext { - return otrace.NewSpanContext(otrace.SpanContextConfig{TraceFlags: otrace.FlagsSampled}) -} - -// ForceFlush exports all ended spans that have not yet been exported. -func (bsp *batchSpanProcessor) ForceFlush(ctx context.Context) error { - // Interrupt if context is already canceled. - if err := ctx.Err(); err != nil { - return err - } - - // Do nothing after Shutdown. - if bsp.stopped.Load() { - return nil - } - - var err error - if bsp.e != nil { - flushCh := make(chan struct{}) - if bsp.enqueueBlockOnQueueFull(ctx, forceFlushSpan{flushed: flushCh}) { - select { - case <-bsp.stopCh: - // The batchSpanProcessor is Shutdown. - return nil - case <-flushCh: - // Processed any items in queue prior to ForceFlush being called - case <-ctx.Done(): - return ctx.Err() - } - } - - wait := make(chan error) - go func() { - wait <- bsp.exportSpans(ctx) - close(wait) - }() - // Wait until the export is finished or the context is cancelled/timed out - select { - case err = <-wait: - case <-ctx.Done(): - err = ctx.Err() - } - } - return err -} - -// WithMaxQueueSize returns a BatchSpanProcessorOption that configures the -// maximum queue size allowed for a BatchSpanProcessor. -func WithMaxQueueSize(size int) BatchSpanProcessorOption { - return func(o *BatchSpanProcessorOptions) { - o.MaxQueueSize = size - } -} - -// WithMaxExportBatchSize returns a BatchSpanProcessorOption that configures -// the maximum export batch size allowed for a BatchSpanProcessor. -func WithMaxExportBatchSize(size int) BatchSpanProcessorOption { - return func(o *BatchSpanProcessorOptions) { - o.MaxExportBatchSize = size - } -} - -// WithBatchTimeout returns a BatchSpanProcessorOption that configures the -// maximum delay allowed for a BatchSpanProcessor before it will export any -// held span (whether the queue is full or not). -func WithBatchTimeout(delay time.Duration) BatchSpanProcessorOption { - return func(o *BatchSpanProcessorOptions) { - o.BatchTimeout = delay - } -} - -// WithExportTimeout returns a BatchSpanProcessorOption that configures the -// amount of time a BatchSpanProcessor waits for an exporter to export before -// abandoning the export. -func WithExportTimeout(timeout time.Duration) BatchSpanProcessorOption { - return func(o *BatchSpanProcessorOptions) { - o.ExportTimeout = timeout - } -} - -// WithBlocking returns a BatchSpanProcessorOption that configures a -// BatchSpanProcessor to wait for enqueue operations to succeed instead of -// dropping data when the queue is full. -func WithBlocking() BatchSpanProcessorOption { - return func(o *BatchSpanProcessorOptions) { - o.BlockOnQueueFull = true - } -} - -// exportSpans is a subroutine of processing and draining the queue. -func (bsp *batchSpanProcessor) exportSpans(ctx context.Context) error { - bsp.timer.Reset(bsp.o.BatchTimeout) - - bsp.batchMutex.Lock() - defer bsp.batchMutex.Unlock() - - if bsp.o.ExportTimeout > 0 { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, bsp.o.ExportTimeout) - defer cancel() - } - - // Update in progress spans - for _, span := range bsp.batch { - if span.EndTime().Before(span.StartTime()) { - bsp.inProgressSpans[span.SpanContext().SpanID()] = &inProgressSpan{ - ReadOnlySpan: span, - UpdatedAt: time.Now(), - } - } else { - delete(bsp.inProgressSpans, span.SpanContext().SpanID()) - } - } - - // add in progress spans that are not part of the batch - for _, span := range bsp.inProgressSpans { - // ignore spans that were recently updated - if span.UpdatedAt.IsZero() || span.UpdatedAt.Before(time.Now().Add(-defaultSpanKeepAlive)) { - bsp.addToBatch(span.ReadOnlySpan) - span.UpdatedAt = time.Now() - } - } - - if l := len(bsp.batch); l > 0 { - err := bsp.e.ExportSpans(ctx, bsp.batch) - - // A new batch is always created after exporting, even if the batch failed to be exported. - // - // It is up to the exporter to implement any type of retry logic if a batch is failing - // to be exported, since it is specific to the protocol and backend being sent to. - bsp.batch = bsp.batch[:0] - bsp.batchSpans = make(map[otrace.SpanID]int) - - if err != nil { - return err - } - } - return nil -} - -// processQueue removes spans from the `queue` channel until processor -// is shut down. It calls the exporter in batches of up to MaxExportBatchSize -// waiting up to BatchTimeout to form a batch. -func (bsp *batchSpanProcessor) processQueue() { - defer bsp.timer.Stop() - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - for { - select { - case <-bsp.stopCh: - return - case <-bsp.timer.C: - if err := bsp.exportSpans(ctx); err != nil { - otel.Handle(err) - } - case sd := <-bsp.queue: - if ffs, ok := sd.(forceFlushSpan); ok { - close(ffs.flushed) - continue - } - bsp.batchMutex.Lock() - bsp.addToBatch(sd) - shouldExport := len(bsp.batch) >= bsp.o.MaxExportBatchSize - bsp.batchMutex.Unlock() - if shouldExport { - if !bsp.timer.Stop() { - <-bsp.timer.C - } - if err := bsp.exportSpans(ctx); err != nil { - otel.Handle(err) - } - } - } - } -} - -func (bsp *batchSpanProcessor) addToBatch(sd trace.ReadOnlySpan) { - if i, ok := bsp.batchSpans[sd.SpanContext().SpanID()]; ok { - bsp.batch[i] = sd - return - } - bsp.batchSpans[sd.SpanContext().SpanID()] = len(bsp.batch) - bsp.batch = append(bsp.batch, sd) -} - -// drainQueue awaits the any caller that had added to bsp.stopWait -// to finish the enqueue, then exports the final batch. -func (bsp *batchSpanProcessor) drainQueue() { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - for { - select { - case sd := <-bsp.queue: - if _, ok := sd.(forceFlushSpan); ok { - // Ignore flush requests as they are not valid spans. - continue - } - - bsp.batchMutex.Lock() - bsp.addToBatch(sd) - shouldExport := len(bsp.batch) == bsp.o.MaxExportBatchSize - bsp.batchMutex.Unlock() - - if shouldExport { - if err := bsp.exportSpans(ctx); err != nil { - otel.Handle(err) - } - } - default: - // There are no more enqueued spans. Make final export. - if err := bsp.exportSpans(ctx); err != nil { - otel.Handle(err) - } - return - } - } -} - -func (bsp *batchSpanProcessor) enqueue(sd trace.ReadOnlySpan) { - ctx := context.TODO() - - // Do not enqueue spans after Shutdown. - if bsp.stopped.Load() { - return - } - - // Do not enqueue spans if we are just going to drop them. - if bsp.e == nil { - return - } - - if bsp.o.BlockOnQueueFull { - bsp.enqueueBlockOnQueueFull(ctx, sd) - } else { - bsp.enqueueDrop(sd) - } -} - -func (bsp *batchSpanProcessor) enqueueBlockOnQueueFull(ctx context.Context, sd trace.ReadOnlySpan) bool { - if !sd.SpanContext().IsSampled() { - return false - } - - select { - case bsp.queue <- sd: - return true - case <-ctx.Done(): - return false - } -} - -func (bsp *batchSpanProcessor) enqueueDrop(sd trace.ReadOnlySpan) bool { - if !sd.SpanContext().IsSampled() { - return false - } - - select { - case bsp.queue <- sd: - return true - default: - atomic.AddUint32(&bsp.dropped, 1) - } - return false -} - -// MarshalLog is the marshaling function used by the logging system to represent this Span Processor. -func (bsp *batchSpanProcessor) MarshalLog() interface{} { - return struct { - Type string - SpanExporter trace.SpanExporter - Config BatchSpanProcessorOptions - }{ - Type: "BatchSpanProcessor", - SpanExporter: bsp.e, - Config: bsp.o, - } -} diff --git a/vendor/dagger.io/dagger/telemetry/init.go b/vendor/dagger.io/dagger/telemetry/init.go deleted file mode 100644 index 18607e0e..00000000 --- a/vendor/dagger.io/dagger/telemetry/init.go +++ /dev/null @@ -1,251 +0,0 @@ -package telemetry - -import ( - "context" - "fmt" - "log/slog" - "net" - "net/url" - "os" - "strings" - "sync" - "time" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" - "go.opentelemetry.io/otel/propagation" - "go.opentelemetry.io/otel/sdk/resource" - sdktrace "go.opentelemetry.io/otel/sdk/trace" - "go.opentelemetry.io/otel/trace" - "google.golang.org/grpc" -) - -func OtelConfigured() bool { - for _, env := range os.Environ() { - if strings.HasPrefix(env, "OTEL_") { - return true - } - } - return false -} - -var configuredSpanExporter sdktrace.SpanExporter -var configuredSpanExporterOnce sync.Once - -func ConfiguredSpanExporter(ctx context.Context) (sdktrace.SpanExporter, bool) { - ctx = context.WithoutCancel(ctx) - - configuredSpanExporterOnce.Do(func() { - if !OtelConfigured() { - return - } - - var err error - - var proto string - if v := os.Getenv("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL"); v != "" { - proto = v - } else if v := os.Getenv("OTEL_EXPORTER_OTLP_PROTOCOL"); v != "" { - proto = v - } else { - // https://github.com/open-telemetry/opentelemetry-specification/blob/v1.8.0/specification/protocol/exporter.md#specify-protocol - proto = "http/protobuf" - } - - var endpoint string - if v := os.Getenv("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT"); v != "" { - endpoint = v - } else if v := os.Getenv("OTEL_EXPORTER_OTLP_ENDPOINT"); v != "" { - if proto == "http/protobuf" { - endpoint, err = url.JoinPath(v, "v1", "traces") - if err != nil { - slog.Warn("failed to join path", "error", err) - return - } - } else { - endpoint = v - } - } - - slog.Debug("configuring tracing via env", "protocol", proto) - - switch proto { - case "http/protobuf", "http": - configuredSpanExporter, err = otlptracehttp.New(ctx, - otlptracehttp.WithEndpointURL(endpoint)) - case "grpc": - var u *url.URL - u, err = url.Parse(endpoint) - if err != nil { - slog.Warn("bad OTLP logs endpoint %q: %w", endpoint, err) - return - } - opts := []otlptracegrpc.Option{ - otlptracegrpc.WithEndpointURL(endpoint), - } - if u.Scheme == "unix" { - dialer := func(ctx context.Context, addr string) (net.Conn, error) { - return net.Dial(u.Scheme, u.Path) - } - opts = append(opts, - otlptracegrpc.WithDialOption(grpc.WithContextDialer(dialer)), - otlptracegrpc.WithInsecure()) - } - configuredSpanExporter, err = otlptracegrpc.New(ctx, opts...) - default: - err = fmt.Errorf("unknown OTLP protocol: %s", proto) - } - if err != nil { - slog.Warn("failed to configure tracing", "error", err) - } - }) - return configuredSpanExporter, configuredSpanExporter != nil -} - -func InitEmbedded(ctx context.Context, res *resource.Resource) context.Context { - traceCfg := Config{ - Detect: false, // false, since we want "live" exporting - Resource: res, - } - if exp, ok := ConfiguredSpanExporter(ctx); ok { - traceCfg.LiveTraceExporters = append(traceCfg.LiveTraceExporters, exp) - } - return Init(ctx, traceCfg) -} - -type Config struct { - // Auto-detect exporters from OTEL_* env variables. - Detect bool - - // LiveTraceExporters are exporters that can receive updates for spans at runtime, - // rather than waiting until the span ends. - // - // Example: TUI, Cloud - LiveTraceExporters []sdktrace.SpanExporter - - // BatchedTraceExporters are exporters that receive spans in batches, after the - // spans have ended. - // - // Example: Honeycomb, Jaeger, etc. - BatchedTraceExporters []sdktrace.SpanExporter - - // Resource is the resource describing this component and runtime - // environment. - Resource *resource.Resource -} - -// NearlyImmediate is 100ms, below which has diminishing returns in terms of -// visual perception vs. performance cost. -const NearlyImmediate = 100 * time.Millisecond - -// LiveSpanProcessor is a SpanProcessor that can additionally receive updates -// for a span at runtime, rather than waiting until the span ends. -type LiveSpanProcessor interface { - sdktrace.SpanProcessor - - // OnUpdate method enqueues a trace.ReadOnlySpan for later processing. - OnUpdate(s sdktrace.ReadOnlySpan) -} - -var SpanProcessors = []sdktrace.SpanProcessor{} -var tracerProvider *ProxyTraceProvider - -// Init sets up the global OpenTelemetry providers tracing, logging, and -// someday metrics providers. It is called by the CLI, the engine, and the -// container shim, so it needs to be versatile. -func Init(ctx context.Context, cfg Config) context.Context { - slog.Debug("initializing telemetry") - - if p, ok := os.LookupEnv("TRACEPARENT"); ok { - slog.Debug("found TRACEPARENT", "value", p) - ctx = propagation.TraceContext{}.Extract(ctx, propagation.MapCarrier{"traceparent": p}) - } - - // Set up a text map propagator so that things, well, propagate. The default - // is a noop. - otel.SetTextMapPropagator(propagation.TraceContext{}) - - // Log to slog. - otel.SetErrorHandler(otel.ErrorHandlerFunc(func(err error) { - slog.Error("OpenTelemetry error", "error", err) - })) - - if cfg.Detect { - if exp, ok := ConfiguredSpanExporter(ctx); ok { - cfg.BatchedTraceExporters = append(cfg.BatchedTraceExporters, exp) - } - } - - traceOpts := []sdktrace.TracerProviderOption{ - sdktrace.WithResource(cfg.Resource), - } - - for _, exporter := range cfg.BatchedTraceExporters { - traceOpts = append(traceOpts, sdktrace.WithBatcher(exporter)) - } - - liveProcessors := make([]LiveSpanProcessor, 0, len(cfg.LiveTraceExporters)) - for _, exporter := range cfg.LiveTraceExporters { - processor := NewBatchSpanProcessor(exporter, - WithBatchTimeout(NearlyImmediate)) - liveProcessors = append(liveProcessors, processor) - SpanProcessors = append(SpanProcessors, processor) - } - for _, exporter := range cfg.BatchedTraceExporters { - processor := sdktrace.NewBatchSpanProcessor(exporter) - SpanProcessors = append(SpanProcessors, processor) - } - for _, proc := range SpanProcessors { - traceOpts = append(traceOpts, sdktrace.WithSpanProcessor(proc)) - } - - tracerProvider = NewProxyTraceProvider( - sdktrace.NewTracerProvider(traceOpts...), - func(s trace.Span) { // OnUpdate - if ro, ok := s.(sdktrace.ReadOnlySpan); ok && s.IsRecording() { - for _, processor := range liveProcessors { - processor.OnUpdate(ro) - } - } - }, - ) - - // Register our TracerProvider as the global so any imported instrumentation - // in the future will default to using it. - // - // NB: this is also necessary so that we can establish a root span, otherwise - // telemetry doesn't work. - otel.SetTracerProvider(tracerProvider) - - return ctx -} - -// Flush drains telemetry data, and is typically called just before a client -// goes away. -// -// NB: now that we wait for all spans to complete, this is less necessary, but -// it seems wise to keep it anyway, as the spots where it are needed are hard -// to find. -func Flush(ctx context.Context) { - slog.Debug("flushing processors") - if tracerProvider != nil { - if err := tracerProvider.ForceFlush(ctx); err != nil { - slog.Error("failed to flush spans", "error", err) - } - } - slog.Debug("done flushing processors") -} - -// Close shuts down the global OpenTelemetry providers, flushing any remaining -// data to the configured exporters. -func Close() { - flushCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second) - defer cancel() - Flush(flushCtx) - if tracerProvider != nil { - if err := tracerProvider.Shutdown(flushCtx); err != nil { - slog.Error("failed to shut down tracer provider", "error", err) - } - } -} diff --git a/vendor/dagger.io/dagger/telemetry/processor.go b/vendor/dagger.io/dagger/telemetry/processor.go deleted file mode 100644 index a21c3fb8..00000000 --- a/vendor/dagger.io/dagger/telemetry/processor.go +++ /dev/null @@ -1,139 +0,0 @@ -package telemetry - -import ( - "context" - "sync" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/sdk/trace" -) - -type TracerUpdater interface{ tracer() } - -// simpleSpanProcessor is a SpanProcessor that synchronously sends all -// completed Spans to a trace.Exporter immediately. -type simpleSpanProcessor struct { - exporterMu sync.Mutex - exporter trace.SpanExporter - stopOnce sync.Once -} - -var _ trace.SpanProcessor = (*simpleSpanProcessor)(nil) - -// NewSimpleSpanProcessor returns a new SpanProcessor that will synchronously -// send completed spans to the exporter immediately. -// -// This SpanProcessor is not recommended for production use. The synchronous -// nature of this SpanProcessor make it good for testing, debugging, or -// showing examples of other feature, but it will be slow and have a high -// computation resource usage overhead. The BatchSpanProcessor is recommended -// for production use instead. -func NewSimpleSpanProcessor(exporter trace.SpanExporter) *simpleSpanProcessor { - ssp := &simpleSpanProcessor{ - exporter: exporter, - } - - return ssp -} - -// OnStart does nothing. -func (ssp *simpleSpanProcessor) OnStart(ctx context.Context, s trace.ReadWriteSpan) { - ssp.exporterMu.Lock() - defer ssp.exporterMu.Unlock() - - if ssp.exporter != nil && s.SpanContext().TraceFlags().IsSampled() { - if err := ssp.exporter.ExportSpans(context.Background(), []trace.ReadOnlySpan{s}); err != nil { - otel.Handle(err) - } - } -} - -// OnEnd immediately exports a ReadOnlySpan. -func (ssp *simpleSpanProcessor) OnEnd(s trace.ReadOnlySpan) { - ssp.exporterMu.Lock() - defer ssp.exporterMu.Unlock() - - if ssp.exporter != nil && s.SpanContext().TraceFlags().IsSampled() { - if err := ssp.exporter.ExportSpans(context.Background(), []trace.ReadOnlySpan{s}); err != nil { - otel.Handle(err) - } - } -} - -// OnUpdate does nothing. -func (ssp *simpleSpanProcessor) OnUpdate(s trace.ReadOnlySpan) { - ssp.exporterMu.Lock() - defer ssp.exporterMu.Unlock() - - if ssp.exporter != nil && s.SpanContext().TraceFlags().IsSampled() { - if err := ssp.exporter.ExportSpans(context.Background(), []trace.ReadOnlySpan{s}); err != nil { - otel.Handle(err) - } - } -} - -// Shutdown shuts down the exporter this SimpleSpanProcessor exports to. -func (ssp *simpleSpanProcessor) Shutdown(ctx context.Context) error { - var err error - ssp.stopOnce.Do(func() { - stopFunc := func(exp trace.SpanExporter) (<-chan error, func()) { - done := make(chan error) - return done, func() { done <- exp.Shutdown(ctx) } - } - - // The exporter field of the simpleSpanProcessor needs to be zeroed to - // signal it is shut down, meaning all subsequent calls to OnEnd will - // be gracefully ignored. This needs to be done synchronously to avoid - // any race condition. - // - // A closure is used to keep reference to the exporter and then the - // field is zeroed. This ensures the simpleSpanProcessor is shut down - // before the exporter. This order is important as it avoids a - // potential deadlock. If the exporter shut down operation generates a - // span, that span would need to be exported. Meaning, OnEnd would be - // called and try acquiring the lock that is held here. - ssp.exporterMu.Lock() - done, shutdown := stopFunc(ssp.exporter) - ssp.exporter = nil - ssp.exporterMu.Unlock() - - go shutdown() - - // Wait for the exporter to shut down or the deadline to expire. - select { - case err = <-done: - case <-ctx.Done(): - // It is possible for the exporter to have immediately shut down - // and the context to be done simultaneously. In that case this - // outer select statement will randomly choose a case. This will - // result in a different returned error for similar scenarios. - // Instead, double check if the exporter shut down at the same - // time and return that error if so. This will ensure consistency - // as well as ensure the caller knows the exporter shut down - // successfully (they can already determine if the deadline is - // expired given they passed the context). - select { - case err = <-done: - default: - err = ctx.Err() - } - } - }) - return err -} - -// ForceFlush does nothing as there is no data to flush. -func (ssp *simpleSpanProcessor) ForceFlush(context.Context) error { - return nil -} - -// MarshalLog is the marshaling function used by the logging system to represent this Span Processor. -func (ssp *simpleSpanProcessor) MarshalLog() interface{} { - return struct { - Type string - Exporter trace.SpanExporter - }{ - Type: "SimpleSpanProcessor", - Exporter: ssp.exporter, - } -} diff --git a/vendor/dagger.io/dagger/telemetry/proxy.go b/vendor/dagger.io/dagger/telemetry/proxy.go deleted file mode 100644 index d12bef5d..00000000 --- a/vendor/dagger.io/dagger/telemetry/proxy.go +++ /dev/null @@ -1,94 +0,0 @@ -package telemetry - -import ( - "context" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - tracesdk "go.opentelemetry.io/otel/sdk/trace" - "go.opentelemetry.io/otel/trace" - "go.opentelemetry.io/otel/trace/embedded" -) - -type ProxyTraceProvider struct { - embedded.TracerProvider - - tp *tracesdk.TracerProvider - onUpdate func(trace.Span) -} - -func NewProxyTraceProvider(tp *tracesdk.TracerProvider, onUpdate func(trace.Span)) *ProxyTraceProvider { - return &ProxyTraceProvider{ - tp: tp, - onUpdate: onUpdate, - } -} - -func (tp *ProxyTraceProvider) Tracer(name string, options ...trace.TracerOption) trace.Tracer { - return &ProxyTracer{ - tracer: tp.tp.Tracer(name, options...), - onUpdate: tp.onUpdate, - } -} - -func (tp *ProxyTraceProvider) ForceFlush(ctx context.Context) error { - return tp.tp.ForceFlush(ctx) -} - -func (tp *ProxyTraceProvider) Shutdown(ctx context.Context) error { - return tp.tp.Shutdown(ctx) -} - -type ProxyTracer struct { - embedded.Tracer - tracer trace.Tracer - onUpdate func(trace.Span) -} - -func (t ProxyTracer) Start(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span) { - ctx, span := t.tracer.Start(ctx, spanName, opts...) - return ctx, proxySpan{sp: span, onUpdate: t.onUpdate} -} - -type proxySpan struct { - embedded.Span - sp trace.Span - onUpdate func(trace.Span) -} - -var _ trace.Span = proxySpan{} - -func (s proxySpan) SpanContext() trace.SpanContext { return s.sp.SpanContext() } - -func (s proxySpan) IsRecording() bool { return s.sp.IsRecording() } - -func (s proxySpan) SetStatus(code codes.Code, message string) { - s.sp.SetStatus(code, message) - s.onUpdate(s.sp) -} - -// func (s proxySpan) SetError(v bool) { s.sp.SetError(v) } - -func (s proxySpan) SetAttributes(attributes ...attribute.KeyValue) { - s.sp.SetAttributes(attributes...) - s.onUpdate(s.sp) -} - -func (s proxySpan) End(opts ...trace.SpanEndOption) { s.sp.End(opts...) } - -func (s proxySpan) RecordError(err error, opts ...trace.EventOption) { - s.sp.RecordError(err, opts...) - s.onUpdate(s.sp) -} - -func (s proxySpan) AddEvent(event string, opts ...trace.EventOption) { - s.sp.AddEvent(event, opts...) - s.onUpdate(s.sp) -} - -func (s proxySpan) SetName(name string) { - s.sp.SetName(name) - s.onUpdate(s.sp) -} - -func (s proxySpan) TracerProvider() trace.TracerProvider { return s.sp.TracerProvider() } diff --git a/vendor/dagger.io/dagger/telemetry/span.go b/vendor/dagger.io/dagger/telemetry/span.go deleted file mode 100644 index 533a023c..00000000 --- a/vendor/dagger.io/dagger/telemetry/span.go +++ /dev/null @@ -1,33 +0,0 @@ -package telemetry - -import ( - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/trace" -) - -// Encapsulate can be applied to a span to indicate that this span should -// collapse its children by default. -func Encapsulate() trace.SpanStartOption { - return trace.WithAttributes(attribute.Bool(UIEncapsulateAttr, true)) -} - -// Internal can be applied to a span to indicate that this span should not be -// shown to the user by default. -func Internal() trace.SpanStartOption { - return trace.WithAttributes(attribute.Bool(InternalAttr, true)) -} - -// End is a helper to end a span with an error if the function returns an error. -// -// It is optimized for use as a defer one-liner with a function that has a -// named error return value, conventionally `rerr`. -// -// defer telemetry.End(span, func() error { return rerr }) -func End(span trace.Span, fn func() error) { - if err := fn(); err != nil { - span.RecordError(err) - span.SetStatus(codes.Error, err.Error()) - } - span.End() -} diff --git a/vendor/github.com/99designs/gqlgen/LICENSE b/vendor/github.com/99designs/gqlgen/LICENSE deleted file mode 100644 index 10bb21c0..00000000 --- a/vendor/github.com/99designs/gqlgen/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2020 gqlgen authors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/99designs/gqlgen/graphql/any.go b/vendor/github.com/99designs/gqlgen/graphql/any.go deleted file mode 100644 index 6ea8bf2e..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/any.go +++ /dev/null @@ -1,19 +0,0 @@ -package graphql - -import ( - "encoding/json" - "io" -) - -func MarshalAny(v interface{}) Marshaler { - return WriterFunc(func(w io.Writer) { - err := json.NewEncoder(w).Encode(v) - if err != nil { - panic(err) - } - }) -} - -func UnmarshalAny(v interface{}) (interface{}, error) { - return v, nil -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/bool.go b/vendor/github.com/99designs/gqlgen/graphql/bool.go deleted file mode 100644 index f435e0c0..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/bool.go +++ /dev/null @@ -1,27 +0,0 @@ -package graphql - -import ( - "fmt" - "io" - "strings" -) - -func MarshalBoolean(b bool) Marshaler { - if b { - return WriterFunc(func(w io.Writer) { w.Write(trueLit) }) - } - return WriterFunc(func(w io.Writer) { w.Write(falseLit) }) -} - -func UnmarshalBoolean(v interface{}) (bool, error) { - switch v := v.(type) { - case string: - return strings.ToLower(v) == "true", nil - case int: - return v != 0, nil - case bool: - return v, nil - default: - return false, fmt.Errorf("%T is not a bool", v) - } -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/cache.go b/vendor/github.com/99designs/gqlgen/graphql/cache.go deleted file mode 100644 index e552ce67..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/cache.go +++ /dev/null @@ -1,29 +0,0 @@ -package graphql - -import "context" - -// Cache is a shared store for APQ and query AST caching -type Cache interface { - // Get looks up a key's value from the cache. - Get(ctx context.Context, key string) (value interface{}, ok bool) - - // Add adds a value to the cache. - Add(ctx context.Context, key string, value interface{}) -} - -// MapCache is the simplest implementation of a cache, because it can not evict it should only be used in tests -type MapCache map[string]interface{} - -// Get looks up a key's value from the cache. -func (m MapCache) Get(_ context.Context, key string) (value interface{}, ok bool) { - v, ok := m[key] - return v, ok -} - -// Add adds a value to the cache. -func (m MapCache) Add(_ context.Context, key string, value interface{}) { m[key] = value } - -type NoCache struct{} - -func (n NoCache) Get(_ context.Context, _ string) (value interface{}, ok bool) { return nil, false } -func (n NoCache) Add(_ context.Context, _ string, _ interface{}) {} diff --git a/vendor/github.com/99designs/gqlgen/graphql/coercion.go b/vendor/github.com/99designs/gqlgen/graphql/coercion.go deleted file mode 100644 index d3d3c18b..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/coercion.go +++ /dev/null @@ -1,56 +0,0 @@ -package graphql - -import ( - "encoding/json" -) - -// CoerceList applies coercion from a single value to a list. -func CoerceList(v interface{}) []interface{} { - var vSlice []interface{} - if v != nil { - switch v := v.(type) { - case []interface{}: - // already a slice no coercion required - vSlice = v - case []string: - if len(v) > 0 { - vSlice = []interface{}{v[0]} - } - case []json.Number: - if len(v) > 0 { - vSlice = []interface{}{v[0]} - } - case []bool: - if len(v) > 0 { - vSlice = []interface{}{v[0]} - } - case []map[string]interface{}: - if len(v) > 0 { - vSlice = []interface{}{v[0]} - } - case []float64: - if len(v) > 0 { - vSlice = []interface{}{v[0]} - } - case []float32: - if len(v) > 0 { - vSlice = []interface{}{v[0]} - } - case []int: - if len(v) > 0 { - vSlice = []interface{}{v[0]} - } - case []int32: - if len(v) > 0 { - vSlice = []interface{}{v[0]} - } - case []int64: - if len(v) > 0 { - vSlice = []interface{}{v[0]} - } - default: - vSlice = []interface{}{v} - } - } - return vSlice -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/context_field.go b/vendor/github.com/99designs/gqlgen/graphql/context_field.go deleted file mode 100644 index 1f9a6e88..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/context_field.go +++ /dev/null @@ -1,113 +0,0 @@ -package graphql - -import ( - "context" - "time" - - "github.com/vektah/gqlparser/v2/ast" -) - -type key string - -const resolverCtx key = "resolver_context" - -// Deprecated: Use FieldContext instead -type ResolverContext = FieldContext - -type FieldContext struct { - Parent *FieldContext - // The name of the type this field belongs to - Object string - // These are the args after processing, they can be mutated in middleware to change what the resolver will get. - Args map[string]interface{} - // The raw field - Field CollectedField - // The index of array in path. - Index *int - // The result object of resolver - Result interface{} - // IsMethod indicates if the resolver is a method - IsMethod bool - // IsResolver indicates if the field has a user-specified resolver - IsResolver bool - // Child allows getting a child FieldContext by its field collection description. - // Note that, the returned child FieldContext represents the context as it was - // before the execution of the field resolver. For example: - // - // srv.AroundFields(func(ctx context.Context, next graphql.Resolver) (interface{}, error) { - // fc := graphql.GetFieldContext(ctx) - // op := graphql.GetOperationContext(ctx) - // collected := graphql.CollectFields(opCtx, fc.Field.Selections, []string{"User"}) - // - // child, err := fc.Child(ctx, collected[0]) - // if err != nil { - // return nil, err - // } - // fmt.Println("child context %q with args: %v", child.Field.Name, child.Args) - // - // return next(ctx) - // }) - // - Child func(context.Context, CollectedField) (*FieldContext, error) -} - -type FieldStats struct { - // When field execution started - Started time.Time - - // When argument marshaling finished - ArgumentsCompleted time.Time - - // When the field completed running all middleware. Not available inside field middleware! - Completed time.Time -} - -func (r *FieldContext) Path() ast.Path { - var path ast.Path - for it := r; it != nil; it = it.Parent { - if it.Index != nil { - path = append(path, ast.PathIndex(*it.Index)) - } else if it.Field.Field != nil { - path = append(path, ast.PathName(it.Field.Alias)) - } - } - - // because we are walking up the chain, all the elements are backwards, do an inplace flip. - for i := len(path)/2 - 1; i >= 0; i-- { - opp := len(path) - 1 - i - path[i], path[opp] = path[opp], path[i] - } - - return path -} - -// Deprecated: Use GetFieldContext instead -func GetResolverContext(ctx context.Context) *ResolverContext { - return GetFieldContext(ctx) -} - -func GetFieldContext(ctx context.Context) *FieldContext { - if val, ok := ctx.Value(resolverCtx).(*FieldContext); ok { - return val - } - return nil -} - -func WithFieldContext(ctx context.Context, rc *FieldContext) context.Context { - rc.Parent = GetFieldContext(ctx) - return context.WithValue(ctx, resolverCtx, rc) -} - -func equalPath(a ast.Path, b ast.Path) bool { - if len(a) != len(b) { - return false - } - - for i := 0; i < len(a); i++ { - if a[i] != b[i] { - return false - } - } - - return true -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/context_operation.go b/vendor/github.com/99designs/gqlgen/graphql/context_operation.go deleted file mode 100644 index 3e6a221b..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/context_operation.go +++ /dev/null @@ -1,125 +0,0 @@ -package graphql - -import ( - "context" - "errors" - "net/http" - - "github.com/vektah/gqlparser/v2/ast" - "github.com/vektah/gqlparser/v2/gqlerror" -) - -// Deprecated: Please update all references to OperationContext instead -type RequestContext = OperationContext - -type OperationContext struct { - RawQuery string - Variables map[string]interface{} - OperationName string - Doc *ast.QueryDocument - Headers http.Header - - Operation *ast.OperationDefinition - DisableIntrospection bool - RecoverFunc RecoverFunc - ResolverMiddleware FieldMiddleware - RootResolverMiddleware RootFieldMiddleware - - Stats Stats -} - -func (c *OperationContext) Validate(ctx context.Context) error { - if c.Doc == nil { - return errors.New("field 'Doc'is required") - } - if c.RawQuery == "" { - return errors.New("field 'RawQuery' is required") - } - if c.Variables == nil { - c.Variables = make(map[string]interface{}) - } - if c.ResolverMiddleware == nil { - return errors.New("field 'ResolverMiddleware' is required") - } - if c.RootResolverMiddleware == nil { - return errors.New("field 'RootResolverMiddleware' is required") - } - if c.RecoverFunc == nil { - c.RecoverFunc = DefaultRecover - } - - return nil -} - -const operationCtx key = "operation_context" - -// Deprecated: Please update all references to GetOperationContext instead -func GetRequestContext(ctx context.Context) *RequestContext { - return GetOperationContext(ctx) -} - -func GetOperationContext(ctx context.Context) *OperationContext { - if val, ok := ctx.Value(operationCtx).(*OperationContext); ok && val != nil { - return val - } - panic("missing operation context") -} - -func WithOperationContext(ctx context.Context, rc *OperationContext) context.Context { - return context.WithValue(ctx, operationCtx, rc) -} - -// HasOperationContext checks if the given context is part of an ongoing operation -// -// Some errors can happen outside of an operation, eg json unmarshal errors. -func HasOperationContext(ctx context.Context) bool { - val, ok := ctx.Value(operationCtx).(*OperationContext) - return ok && val != nil -} - -// This is just a convenient wrapper method for CollectFields -func CollectFieldsCtx(ctx context.Context, satisfies []string) []CollectedField { - resctx := GetFieldContext(ctx) - return CollectFields(GetOperationContext(ctx), resctx.Field.Selections, satisfies) -} - -// CollectAllFields returns a slice of all GraphQL field names that were selected for the current resolver context. -// The slice will contain the unique set of all field names requested regardless of fragment type conditions. -func CollectAllFields(ctx context.Context) []string { - resctx := GetFieldContext(ctx) - collected := CollectFields(GetOperationContext(ctx), resctx.Field.Selections, nil) - uniq := make([]string, 0, len(collected)) -Next: - for _, f := range collected { - for _, name := range uniq { - if name == f.Name { - continue Next - } - } - uniq = append(uniq, f.Name) - } - return uniq -} - -// Errorf sends an error string to the client, passing it through the formatter. -// Deprecated: use graphql.AddErrorf(ctx, err) instead -func (c *OperationContext) Errorf(ctx context.Context, format string, args ...interface{}) { - AddErrorf(ctx, format, args...) -} - -// Error add error or multiple errors (if underlaying type is gqlerror.List) into the stack. -// Then it will be sends to the client, passing it through the formatter. -func (c *OperationContext) Error(ctx context.Context, err error) { - if errList, ok := err.(gqlerror.List); ok { - for _, e := range errList { - AddError(ctx, e) - } - return - } - - AddError(ctx, err) -} - -func (c *OperationContext) Recover(ctx context.Context, err interface{}) error { - return ErrorOnPath(ctx, c.RecoverFunc(ctx, err)) -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/context_path.go b/vendor/github.com/99designs/gqlgen/graphql/context_path.go deleted file mode 100644 index a46ed83d..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/context_path.go +++ /dev/null @@ -1,77 +0,0 @@ -package graphql - -import ( - "context" - - "github.com/vektah/gqlparser/v2/ast" -) - -const fieldInputCtx key = "path_context" - -type PathContext struct { - ParentField *FieldContext - Parent *PathContext - Field *string - Index *int -} - -func (fic *PathContext) Path() ast.Path { - var path ast.Path - for it := fic; it != nil; it = it.Parent { - if it.Index != nil { - path = append(path, ast.PathIndex(*it.Index)) - } else if it.Field != nil { - path = append(path, ast.PathName(*it.Field)) - } - } - - // because we are walking up the chain, all the elements are backwards, do an inplace flip. - for i := len(path)/2 - 1; i >= 0; i-- { - opp := len(path) - 1 - i - path[i], path[opp] = path[opp], path[i] - } - - if fic.ParentField != nil { - fieldPath := fic.ParentField.Path() - return append(fieldPath, path...) - - } - - return path -} - -func NewPathWithField(field string) *PathContext { - return &PathContext{Field: &field} -} - -func NewPathWithIndex(index int) *PathContext { - return &PathContext{Index: &index} -} - -func WithPathContext(ctx context.Context, fic *PathContext) context.Context { - if fieldContext := GetFieldContext(ctx); fieldContext != nil { - fic.ParentField = fieldContext - } - if fieldInputContext := GetPathContext(ctx); fieldInputContext != nil { - fic.Parent = fieldInputContext - } - - return context.WithValue(ctx, fieldInputCtx, fic) -} - -func GetPathContext(ctx context.Context) *PathContext { - if val, ok := ctx.Value(fieldInputCtx).(*PathContext); ok { - return val - } - return nil -} - -func GetPath(ctx context.Context) ast.Path { - if pc := GetPathContext(ctx); pc != nil { - return pc.Path() - } - if fc := GetFieldContext(ctx); fc != nil { - return fc.Path() - } - return nil -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/context_response.go b/vendor/github.com/99designs/gqlgen/graphql/context_response.go deleted file mode 100644 index 6d223c8a..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/context_response.go +++ /dev/null @@ -1,161 +0,0 @@ -package graphql - -import ( - "context" - "fmt" - "sync" - - "github.com/vektah/gqlparser/v2/gqlerror" -) - -type responseContext struct { - errorPresenter ErrorPresenterFunc - recover RecoverFunc - - errors gqlerror.List - errorsMu sync.Mutex - - extensions map[string]interface{} - extensionsMu sync.Mutex -} - -const resultCtx key = "result_context" - -func getResponseContext(ctx context.Context) *responseContext { - val, ok := ctx.Value(resultCtx).(*responseContext) - if !ok { - panic("missing response context") - } - return val -} - -func WithResponseContext(ctx context.Context, presenterFunc ErrorPresenterFunc, recoverFunc RecoverFunc) context.Context { - return context.WithValue(ctx, resultCtx, &responseContext{ - errorPresenter: presenterFunc, - recover: recoverFunc, - }) -} - -func WithFreshResponseContext(ctx context.Context) context.Context { - e := getResponseContext(ctx) - return context.WithValue(ctx, resultCtx, &responseContext{ - errorPresenter: e.errorPresenter, - recover: e.recover, - }) -} - -// AddErrorf writes a formatted error to the client, first passing it through the error presenter. -func AddErrorf(ctx context.Context, format string, args ...interface{}) { - AddError(ctx, fmt.Errorf(format, args...)) -} - -// AddError sends an error to the client, first passing it through the error presenter. -func AddError(ctx context.Context, err error) { - c := getResponseContext(ctx) - - presentedError := c.errorPresenter(ctx, ErrorOnPath(ctx, err)) - - c.errorsMu.Lock() - defer c.errorsMu.Unlock() - c.errors = append(c.errors, presentedError) -} - -func Recover(ctx context.Context, err interface{}) (userMessage error) { - c := getResponseContext(ctx) - return ErrorOnPath(ctx, c.recover(ctx, err)) -} - -// HasFieldError returns true if the given field has already errored -func HasFieldError(ctx context.Context, rctx *FieldContext) bool { - c := getResponseContext(ctx) - - c.errorsMu.Lock() - defer c.errorsMu.Unlock() - - if len(c.errors) == 0 { - return false - } - - path := rctx.Path() - for _, err := range c.errors { - if equalPath(err.Path, path) { - return true - } - } - return false -} - -// GetFieldErrors returns a list of errors that occurred in the given field -func GetFieldErrors(ctx context.Context, rctx *FieldContext) gqlerror.List { - c := getResponseContext(ctx) - - c.errorsMu.Lock() - defer c.errorsMu.Unlock() - - if len(c.errors) == 0 { - return nil - } - - path := rctx.Path() - var errs gqlerror.List - for _, err := range c.errors { - if equalPath(err.Path, path) { - errs = append(errs, err) - } - } - return errs -} - -func GetErrors(ctx context.Context) gqlerror.List { - resCtx := getResponseContext(ctx) - resCtx.errorsMu.Lock() - defer resCtx.errorsMu.Unlock() - - if len(resCtx.errors) == 0 { - return nil - } - - errs := resCtx.errors - cpy := make(gqlerror.List, len(errs)) - for i := range errs { - errCpy := *errs[i] - cpy[i] = &errCpy - } - return cpy -} - -// RegisterExtension allows you to add a new extension into the graphql response -func RegisterExtension(ctx context.Context, key string, value interface{}) { - c := getResponseContext(ctx) - c.extensionsMu.Lock() - defer c.extensionsMu.Unlock() - - if c.extensions == nil { - c.extensions = make(map[string]interface{}) - } - - if _, ok := c.extensions[key]; ok { - panic(fmt.Errorf("extension already registered for key %s", key)) - } - - c.extensions[key] = value -} - -// GetExtensions returns any extensions registered in the current result context -func GetExtensions(ctx context.Context) map[string]interface{} { - ext := getResponseContext(ctx).extensions - if ext == nil { - return map[string]interface{}{} - } - - return ext -} - -func GetExtension(ctx context.Context, name string) interface{} { - ext := getResponseContext(ctx).extensions - if ext == nil { - return nil - } - - return ext[name] -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/context_root_field.go b/vendor/github.com/99designs/gqlgen/graphql/context_root_field.go deleted file mode 100644 index 1bf4d13b..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/context_root_field.go +++ /dev/null @@ -1,25 +0,0 @@ -package graphql - -import ( - "context" -) - -const rootResolverCtx key = "root_resolver_context" - -type RootFieldContext struct { - // The name of the type this field belongs to - Object string - // The raw field - Field CollectedField -} - -func GetRootFieldContext(ctx context.Context) *RootFieldContext { - if val, ok := ctx.Value(rootResolverCtx).(*RootFieldContext); ok { - return val - } - return nil -} - -func WithRootFieldContext(ctx context.Context, rc *RootFieldContext) context.Context { - return context.WithValue(ctx, rootResolverCtx, rc) -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/deferred.go b/vendor/github.com/99designs/gqlgen/graphql/deferred.go deleted file mode 100644 index 1aeb48c1..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/deferred.go +++ /dev/null @@ -1,26 +0,0 @@ -package graphql - -import ( - "context" - - "github.com/vektah/gqlparser/v2/ast" - "github.com/vektah/gqlparser/v2/gqlerror" -) - -type Deferrable struct { - Label string -} - -type DeferredGroup struct { - Path ast.Path - Label string - FieldSet *FieldSet - Context context.Context -} - -type DeferredResult struct { - Path ast.Path - Label string - Result Marshaler - Errors gqlerror.List -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/duration.go b/vendor/github.com/99designs/gqlgen/graphql/duration.go deleted file mode 100644 index 3eb392db..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/duration.go +++ /dev/null @@ -1,27 +0,0 @@ -package graphql - -import ( - "fmt" - "time" - - dur "github.com/sosodev/duration" -) - -// UnmarshalDuration returns the duration from a string in ISO8601 format -func UnmarshalDuration(v interface{}) (time.Duration, error) { - input, ok := v.(string) - if !ok { - return 0, fmt.Errorf("input must be a string") - } - - d2, err := dur.Parse(input) - if err != nil { - return 0, err - } - return d2.ToTimeDuration(), nil -} - -// MarshalDuration returns the duration on ISO8601 format -func MarshalDuration(d time.Duration) Marshaler { - return MarshalString(dur.Format(d)) -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/error.go b/vendor/github.com/99designs/gqlgen/graphql/error.go deleted file mode 100644 index f816bef6..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/error.go +++ /dev/null @@ -1,33 +0,0 @@ -package graphql - -import ( - "context" - "errors" - - "github.com/vektah/gqlparser/v2/gqlerror" -) - -type ErrorPresenterFunc func(ctx context.Context, err error) *gqlerror.Error - -func DefaultErrorPresenter(ctx context.Context, err error) *gqlerror.Error { - var gqlErr *gqlerror.Error - if errors.As(err, &gqlErr) { - return gqlErr - } - return gqlerror.WrapPath(GetPath(ctx), err) -} - -func ErrorOnPath(ctx context.Context, err error) error { - if err == nil { - return nil - } - var gqlErr *gqlerror.Error - if errors.As(err, &gqlErr) { - if gqlErr.Path == nil { - gqlErr.Path = GetPath(ctx) - } - // Return the original error to avoid losing any attached annotation - return err - } - return gqlerror.WrapPath(GetPath(ctx), err) -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/executable_schema.go b/vendor/github.com/99designs/gqlgen/graphql/executable_schema.go deleted file mode 100644 index 58f942a1..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/executable_schema.go +++ /dev/null @@ -1,211 +0,0 @@ -//go:generate go run github.com/matryer/moq -out executable_schema_mock.go . ExecutableSchema - -package graphql - -import ( - "context" - "fmt" - - "github.com/vektah/gqlparser/v2/ast" -) - -type ExecutableSchema interface { - Schema() *ast.Schema - - Complexity(typeName, fieldName string, childComplexity int, args map[string]interface{}) (int, bool) - Exec(ctx context.Context) ResponseHandler -} - -// CollectFields returns the set of fields from an ast.SelectionSet where all collected fields satisfy at least one of the GraphQL types -// passed through satisfies. Providing an empty or nil slice for satisfies will return collect all fields regardless of fragment -// type conditions. -func CollectFields(reqCtx *OperationContext, selSet ast.SelectionSet, satisfies []string) []CollectedField { - return collectFields(reqCtx, selSet, satisfies, map[string]bool{}) -} - -func collectFields(reqCtx *OperationContext, selSet ast.SelectionSet, satisfies []string, visited map[string]bool) []CollectedField { - groupedFields := make([]CollectedField, 0, len(selSet)) - - for _, sel := range selSet { - switch sel := sel.(type) { - case *ast.Field: - if !shouldIncludeNode(sel.Directives, reqCtx.Variables) { - continue - } - f := getOrCreateAndAppendField(&groupedFields, sel.Name, sel.Alias, sel.ObjectDefinition, func() CollectedField { - return CollectedField{Field: sel} - }) - - f.Selections = append(f.Selections, sel.SelectionSet...) - - case *ast.InlineFragment: - if !shouldIncludeNode(sel.Directives, reqCtx.Variables) { - continue - } - if len(satisfies) > 0 && !instanceOf(sel.TypeCondition, satisfies) { - continue - } - - shouldDefer, label := deferrable(sel.Directives, reqCtx.Variables) - - for _, childField := range collectFields(reqCtx, sel.SelectionSet, satisfies, visited) { - f := getOrCreateAndAppendField( - &groupedFields, childField.Name, childField.Alias, childField.ObjectDefinition, - func() CollectedField { return childField }) - f.Selections = append(f.Selections, childField.Selections...) - if shouldDefer { - f.Deferrable = &Deferrable{ - Label: label, - } - } - } - - case *ast.FragmentSpread: - if !shouldIncludeNode(sel.Directives, reqCtx.Variables) { - continue - } - fragmentName := sel.Name - if _, seen := visited[fragmentName]; seen { - continue - } - visited[fragmentName] = true - - fragment := reqCtx.Doc.Fragments.ForName(fragmentName) - if fragment == nil { - // should never happen, validator has already run - panic(fmt.Errorf("missing fragment %s", fragmentName)) - } - - if len(satisfies) > 0 && !instanceOf(fragment.TypeCondition, satisfies) { - continue - } - - shouldDefer, label := deferrable(sel.Directives, reqCtx.Variables) - - for _, childField := range collectFields(reqCtx, fragment.SelectionSet, satisfies, visited) { - f := getOrCreateAndAppendField(&groupedFields, - childField.Name, childField.Alias, childField.ObjectDefinition, - func() CollectedField { return childField }) - f.Selections = append(f.Selections, childField.Selections...) - if shouldDefer { - f.Deferrable = &Deferrable{Label: label} - } - } - - default: - panic(fmt.Errorf("unsupported %T", sel)) - } - } - - return groupedFields -} - -type CollectedField struct { - *ast.Field - - Selections ast.SelectionSet - Deferrable *Deferrable -} - -func instanceOf(val string, satisfies []string) bool { - for _, s := range satisfies { - if val == s { - return true - } - } - return false -} - -func getOrCreateAndAppendField(c *[]CollectedField, name string, alias string, objectDefinition *ast.Definition, creator func() CollectedField) *CollectedField { - for i, cf := range *c { - if cf.Name == name && cf.Alias == alias { - if cf.ObjectDefinition == objectDefinition { - return &(*c)[i] - } - - if cf.ObjectDefinition == nil || objectDefinition == nil { - continue - } - - if cf.ObjectDefinition.Name == objectDefinition.Name { - return &(*c)[i] - } - - for _, ifc := range objectDefinition.Interfaces { - if ifc == cf.ObjectDefinition.Name { - return &(*c)[i] - } - } - for _, ifc := range cf.ObjectDefinition.Interfaces { - if ifc == objectDefinition.Name { - return &(*c)[i] - } - } - } - } - - f := creator() - - *c = append(*c, f) - return &(*c)[len(*c)-1] -} - -func shouldIncludeNode(directives ast.DirectiveList, variables map[string]interface{}) bool { - if len(directives) == 0 { - return true - } - - skip, include := false, true - - if d := directives.ForName("skip"); d != nil { - skip = resolveIfArgument(d, variables) - } - - if d := directives.ForName("include"); d != nil { - include = resolveIfArgument(d, variables) - } - - return !skip && include -} - -func deferrable(directives ast.DirectiveList, variables map[string]interface{}) (shouldDefer bool, label string) { - d := directives.ForName("defer") - if d == nil { - return false, "" - } - - shouldDefer = true - - for _, arg := range d.Arguments { - switch arg.Name { - case "if": - if value, err := arg.Value.Value(variables); err == nil { - shouldDefer, _ = value.(bool) - } - case "label": - if value, err := arg.Value.Value(variables); err == nil { - label, _ = value.(string) - } - default: - panic(fmt.Sprintf("defer: argument '%s' not supported", arg.Name)) - } - } - - return shouldDefer, label -} - -func resolveIfArgument(d *ast.Directive, variables map[string]interface{}) bool { - arg := d.Arguments.ForName("if") - if arg == nil { - panic(fmt.Sprintf("%s: argument 'if' not defined", d.Name)) - } - value, err := arg.Value.Value(variables) - if err != nil { - panic(err) - } - ret, ok := value.(bool) - if !ok { - panic(fmt.Sprintf("%s: argument 'if' is not a boolean", d.Name)) - } - return ret -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/executable_schema_mock.go b/vendor/github.com/99designs/gqlgen/graphql/executable_schema_mock.go deleted file mode 100644 index 5e71cb83..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/executable_schema_mock.go +++ /dev/null @@ -1,175 +0,0 @@ -// Code generated by moq; DO NOT EDIT. -// github.com/matryer/moq - -package graphql - -import ( - "context" - "github.com/vektah/gqlparser/v2/ast" - "sync" -) - -// Ensure, that ExecutableSchemaMock does implement ExecutableSchema. -// If this is not the case, regenerate this file with moq. -var _ ExecutableSchema = &ExecutableSchemaMock{} - -// ExecutableSchemaMock is a mock implementation of ExecutableSchema. -// -// func TestSomethingThatUsesExecutableSchema(t *testing.T) { -// -// // make and configure a mocked ExecutableSchema -// mockedExecutableSchema := &ExecutableSchemaMock{ -// ComplexityFunc: func(typeName string, fieldName string, childComplexity int, args map[string]interface{}) (int, bool) { -// panic("mock out the Complexity method") -// }, -// ExecFunc: func(ctx context.Context) ResponseHandler { -// panic("mock out the Exec method") -// }, -// SchemaFunc: func() *ast.Schema { -// panic("mock out the Schema method") -// }, -// } -// -// // use mockedExecutableSchema in code that requires ExecutableSchema -// // and then make assertions. -// -// } -type ExecutableSchemaMock struct { - // ComplexityFunc mocks the Complexity method. - ComplexityFunc func(typeName string, fieldName string, childComplexity int, args map[string]interface{}) (int, bool) - - // ExecFunc mocks the Exec method. - ExecFunc func(ctx context.Context) ResponseHandler - - // SchemaFunc mocks the Schema method. - SchemaFunc func() *ast.Schema - - // calls tracks calls to the methods. - calls struct { - // Complexity holds details about calls to the Complexity method. - Complexity []struct { - // TypeName is the typeName argument value. - TypeName string - // FieldName is the fieldName argument value. - FieldName string - // ChildComplexity is the childComplexity argument value. - ChildComplexity int - // Args is the args argument value. - Args map[string]interface{} - } - // Exec holds details about calls to the Exec method. - Exec []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // Schema holds details about calls to the Schema method. - Schema []struct { - } - } - lockComplexity sync.RWMutex - lockExec sync.RWMutex - lockSchema sync.RWMutex -} - -// Complexity calls ComplexityFunc. -func (mock *ExecutableSchemaMock) Complexity(typeName string, fieldName string, childComplexity int, args map[string]interface{}) (int, bool) { - if mock.ComplexityFunc == nil { - panic("ExecutableSchemaMock.ComplexityFunc: method is nil but ExecutableSchema.Complexity was just called") - } - callInfo := struct { - TypeName string - FieldName string - ChildComplexity int - Args map[string]interface{} - }{ - TypeName: typeName, - FieldName: fieldName, - ChildComplexity: childComplexity, - Args: args, - } - mock.lockComplexity.Lock() - mock.calls.Complexity = append(mock.calls.Complexity, callInfo) - mock.lockComplexity.Unlock() - return mock.ComplexityFunc(typeName, fieldName, childComplexity, args) -} - -// ComplexityCalls gets all the calls that were made to Complexity. -// Check the length with: -// -// len(mockedExecutableSchema.ComplexityCalls()) -func (mock *ExecutableSchemaMock) ComplexityCalls() []struct { - TypeName string - FieldName string - ChildComplexity int - Args map[string]interface{} -} { - var calls []struct { - TypeName string - FieldName string - ChildComplexity int - Args map[string]interface{} - } - mock.lockComplexity.RLock() - calls = mock.calls.Complexity - mock.lockComplexity.RUnlock() - return calls -} - -// Exec calls ExecFunc. -func (mock *ExecutableSchemaMock) Exec(ctx context.Context) ResponseHandler { - if mock.ExecFunc == nil { - panic("ExecutableSchemaMock.ExecFunc: method is nil but ExecutableSchema.Exec was just called") - } - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockExec.Lock() - mock.calls.Exec = append(mock.calls.Exec, callInfo) - mock.lockExec.Unlock() - return mock.ExecFunc(ctx) -} - -// ExecCalls gets all the calls that were made to Exec. -// Check the length with: -// -// len(mockedExecutableSchema.ExecCalls()) -func (mock *ExecutableSchemaMock) ExecCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockExec.RLock() - calls = mock.calls.Exec - mock.lockExec.RUnlock() - return calls -} - -// Schema calls SchemaFunc. -func (mock *ExecutableSchemaMock) Schema() *ast.Schema { - if mock.SchemaFunc == nil { - panic("ExecutableSchemaMock.SchemaFunc: method is nil but ExecutableSchema.Schema was just called") - } - callInfo := struct { - }{} - mock.lockSchema.Lock() - mock.calls.Schema = append(mock.calls.Schema, callInfo) - mock.lockSchema.Unlock() - return mock.SchemaFunc() -} - -// SchemaCalls gets all the calls that were made to Schema. -// Check the length with: -// -// len(mockedExecutableSchema.SchemaCalls()) -func (mock *ExecutableSchemaMock) SchemaCalls() []struct { -} { - var calls []struct { - } - mock.lockSchema.RLock() - calls = mock.calls.Schema - mock.lockSchema.RUnlock() - return calls -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/fieldset.go b/vendor/github.com/99designs/gqlgen/graphql/fieldset.go deleted file mode 100644 index 2c9e3dc9..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/fieldset.go +++ /dev/null @@ -1,70 +0,0 @@ -package graphql - -import ( - "context" - "io" - "sync" -) - -type FieldSet struct { - fields []CollectedField - Values []Marshaler - Invalids uint32 - delayed []delayedResult -} - -type delayedResult struct { - i int - f func(context.Context) Marshaler -} - -func NewFieldSet(fields []CollectedField) *FieldSet { - return &FieldSet{ - fields: fields, - Values: make([]Marshaler, len(fields)), - } -} - -func (m *FieldSet) AddField(field CollectedField) { - m.fields = append(m.fields, field) - m.Values = append(m.Values, nil) -} - -func (m *FieldSet) Concurrently(i int, f func(context.Context) Marshaler) { - m.delayed = append(m.delayed, delayedResult{i: i, f: f}) -} - -func (m *FieldSet) Dispatch(ctx context.Context) { - if len(m.delayed) == 1 { - // only one concurrent task, no need to spawn a goroutine or deal create waitgroups - d := m.delayed[0] - m.Values[d.i] = d.f(ctx) - } else if len(m.delayed) > 1 { - // more than one concurrent task, use the main goroutine to do one, only spawn goroutines for the others - - var wg sync.WaitGroup - for _, d := range m.delayed[1:] { - wg.Add(1) - go func(d delayedResult) { - defer wg.Done() - m.Values[d.i] = d.f(ctx) - }(d) - } - - m.Values[m.delayed[0].i] = m.delayed[0].f(ctx) - wg.Wait() - } -} - -func (m *FieldSet) MarshalGQL(writer io.Writer) { - writer.Write(openBrace) - for i, field := range m.fields { - if i != 0 { - writer.Write(comma) - } - writeQuotedString(writer, field.Alias) - writer.Write(colon) - m.Values[i].MarshalGQL(writer) - } - writer.Write(closeBrace) -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/float.go b/vendor/github.com/99designs/gqlgen/graphql/float.go deleted file mode 100644 index ccb825dd..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/float.go +++ /dev/null @@ -1,47 +0,0 @@ -package graphql - -import ( - "context" - "encoding/json" - "fmt" - "io" - "math" - "strconv" -) - -func MarshalFloat(f float64) Marshaler { - return WriterFunc(func(w io.Writer) { - io.WriteString(w, fmt.Sprintf("%g", f)) - }) -} - -func UnmarshalFloat(v interface{}) (float64, error) { - switch v := v.(type) { - case string: - return strconv.ParseFloat(v, 64) - case int: - return float64(v), nil - case int64: - return float64(v), nil - case float64: - return v, nil - case json.Number: - return strconv.ParseFloat(string(v), 64) - default: - return 0, fmt.Errorf("%T is not an float", v) - } -} - -func MarshalFloatContext(f float64) ContextMarshaler { - return ContextWriterFunc(func(ctx context.Context, w io.Writer) error { - if math.IsInf(f, 0) || math.IsNaN(f) { - return fmt.Errorf("cannot marshal infinite no NaN float values") - } - io.WriteString(w, fmt.Sprintf("%g", f)) - return nil - }) -} - -func UnmarshalFloatContext(ctx context.Context, v interface{}) (float64, error) { - return UnmarshalFloat(v) -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/handler.go b/vendor/github.com/99designs/gqlgen/graphql/handler.go deleted file mode 100644 index cd358740..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/handler.go +++ /dev/null @@ -1,131 +0,0 @@ -package graphql - -import ( - "context" - "net/http" - "strconv" - "strings" - - "github.com/vektah/gqlparser/v2/gqlerror" -) - -type ( - OperationMiddleware func(ctx context.Context, next OperationHandler) ResponseHandler - OperationHandler func(ctx context.Context) ResponseHandler - - ResponseHandler func(ctx context.Context) *Response - ResponseMiddleware func(ctx context.Context, next ResponseHandler) *Response - - Resolver func(ctx context.Context) (res interface{}, err error) - FieldMiddleware func(ctx context.Context, next Resolver) (res interface{}, err error) - - RootResolver func(ctx context.Context) Marshaler - RootFieldMiddleware func(ctx context.Context, next RootResolver) Marshaler - - RawParams struct { - Query string `json:"query"` - OperationName string `json:"operationName"` - Variables map[string]interface{} `json:"variables"` - Extensions map[string]interface{} `json:"extensions"` - Headers http.Header `json:"headers"` - - ReadTime TraceTiming `json:"-"` - } - - GraphExecutor interface { - CreateOperationContext(ctx context.Context, params *RawParams) (*OperationContext, gqlerror.List) - DispatchOperation(ctx context.Context, rc *OperationContext) (ResponseHandler, context.Context) - DispatchError(ctx context.Context, list gqlerror.List) *Response - } - - // HandlerExtension adds functionality to the http handler. See the list of possible hook points below - // Its important to understand the lifecycle of a graphql request and the terminology we use in gqlgen - // before working with these - // - // +--- REQUEST POST /graphql --------------------------------------------+ - // | +- OPERATION query OpName { viewer { name } } -----------------------+ | - // | | RESPONSE { "data": { "viewer": { "name": "bob" } } } | | - // | +- OPERATION subscription OpName2 { chat { message } } --------------+ | - // | | RESPONSE { "data": { "chat": { "message": "hello" } } } | | - // | | RESPONSE { "data": { "chat": { "message": "byee" } } } | | - // | +--------------------------------------------------------------------+ | - // +------------------------------------------------------------------------+ - HandlerExtension interface { - // ExtensionName should be a CamelCase string version of the extension which may be shown in stats and logging. - ExtensionName() string - // Validate is called when adding an extension to the server, it allows validation against the servers schema. - Validate(schema ExecutableSchema) error - } - - // OperationParameterMutator is called before creating a request context. allows manipulating the raw query - // on the way in. - OperationParameterMutator interface { - MutateOperationParameters(ctx context.Context, request *RawParams) *gqlerror.Error - } - - // OperationContextMutator is called after creating the request context, but before executing the root resolver. - OperationContextMutator interface { - MutateOperationContext(ctx context.Context, rc *OperationContext) *gqlerror.Error - } - - // OperationInterceptor is called for each incoming query, for basic requests the writer will be invoked once, - // for subscriptions it will be invoked multiple times. - OperationInterceptor interface { - InterceptOperation(ctx context.Context, next OperationHandler) ResponseHandler - } - - // ResponseInterceptor is called around each graphql operation response. This can be called many times for a single - // operation the case of subscriptions. - ResponseInterceptor interface { - InterceptResponse(ctx context.Context, next ResponseHandler) *Response - } - - RootFieldInterceptor interface { - InterceptRootField(ctx context.Context, next RootResolver) Marshaler - } - - // FieldInterceptor called around each field - FieldInterceptor interface { - InterceptField(ctx context.Context, next Resolver) (res interface{}, err error) - } - - // Transport provides support for different wire level encodings of graphql requests, eg Form, Get, Post, Websocket - Transport interface { - Supports(r *http.Request) bool - Do(w http.ResponseWriter, r *http.Request, exec GraphExecutor) - } -) - -type Status int - -func (p *RawParams) AddUpload(upload Upload, key, path string) *gqlerror.Error { - if !strings.HasPrefix(path, "variables.") { - return gqlerror.Errorf("invalid operations paths for key %s", key) - } - - var ptr interface{} = p.Variables - parts := strings.Split(path, ".") - - // skip the first part (variables) because we started there - for i, p := range parts[1:] { - last := i == len(parts)-2 - if ptr == nil { - return gqlerror.Errorf("path is missing \"variables.\" prefix, key: %s, path: %s", key, path) - } - if index, parseNbrErr := strconv.Atoi(p); parseNbrErr == nil { - if last { - ptr.([]interface{})[index] = upload - } else { - ptr = ptr.([]interface{})[index] - } - } else { - if last { - ptr.(map[string]interface{})[p] = upload - } else { - ptr = ptr.(map[string]interface{})[p] - } - } - } - - return nil -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/id.go b/vendor/github.com/99designs/gqlgen/graphql/id.go deleted file mode 100644 index b24605d1..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/id.go +++ /dev/null @@ -1,58 +0,0 @@ -package graphql - -import ( - "encoding/json" - "fmt" - "io" - "strconv" -) - -func MarshalID(s string) Marshaler { - return MarshalString(s) -} - -func UnmarshalID(v interface{}) (string, error) { - switch v := v.(type) { - case string: - return v, nil - case json.Number: - return string(v), nil - case int: - return strconv.Itoa(v), nil - case int64: - return strconv.FormatInt(v, 10), nil - case float64: - return fmt.Sprintf("%f", v), nil - case bool: - if v { - return "true", nil - } else { - return "false", nil - } - case nil: - return "null", nil - default: - return "", fmt.Errorf("%T is not a string", v) - } -} - -func MarshalIntID(i int) Marshaler { - return WriterFunc(func(w io.Writer) { - writeQuotedString(w, strconv.Itoa(i)) - }) -} - -func UnmarshalIntID(v interface{}) (int, error) { - switch v := v.(type) { - case string: - return strconv.Atoi(v) - case int: - return v, nil - case int64: - return int(v), nil - case json.Number: - return strconv.Atoi(string(v)) - default: - return 0, fmt.Errorf("%T is not an int", v) - } -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/input.go b/vendor/github.com/99designs/gqlgen/graphql/input.go deleted file mode 100644 index 88c3efaa..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/input.go +++ /dev/null @@ -1,55 +0,0 @@ -package graphql - -import ( - "context" - "errors" - "reflect" -) - -const unmarshalInputCtx key = "unmarshal_input_context" - -// BuildUnmarshalerMap returns a map of unmarshal functions of the ExecutableContext -// to use with the WithUnmarshalerMap function. -func BuildUnmarshalerMap(unmarshaler ...interface{}) map[reflect.Type]reflect.Value { - maps := make(map[reflect.Type]reflect.Value) - for _, v := range unmarshaler { - ft := reflect.TypeOf(v) - if ft.Kind() == reflect.Func { - maps[ft.Out(0)] = reflect.ValueOf(v) - } - } - - return maps -} - -// WithUnmarshalerMap returns a new context with a map from input types to their unmarshaler functions. -func WithUnmarshalerMap(ctx context.Context, maps map[reflect.Type]reflect.Value) context.Context { - return context.WithValue(ctx, unmarshalInputCtx, maps) -} - -// UnmarshalInputFromContext allows unmarshaling input object from a context. -func UnmarshalInputFromContext(ctx context.Context, raw, v interface{}) error { - m, ok := ctx.Value(unmarshalInputCtx).(map[reflect.Type]reflect.Value) - if m == nil || !ok { - return errors.New("graphql: the input context is empty") - } - - rv := reflect.ValueOf(v) - if rv.Kind() != reflect.Ptr || rv.IsNil() { - return errors.New("graphql: input must be a non-nil pointer") - } - if fn, ok := m[rv.Elem().Type()]; ok { - res := fn.Call([]reflect.Value{ - reflect.ValueOf(ctx), - reflect.ValueOf(raw), - }) - if err := res[1].Interface(); err != nil { - return err.(error) - } - - rv.Elem().Set(res[0]) - return nil - } - - return errors.New("graphql: no unmarshal function found") -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/int.go b/vendor/github.com/99designs/gqlgen/graphql/int.go deleted file mode 100644 index 57d0d589..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/int.go +++ /dev/null @@ -1,79 +0,0 @@ -package graphql - -import ( - "encoding/json" - "fmt" - "io" - "strconv" -) - -func MarshalInt(i int) Marshaler { - return WriterFunc(func(w io.Writer) { - io.WriteString(w, strconv.Itoa(i)) - }) -} - -func UnmarshalInt(v interface{}) (int, error) { - switch v := v.(type) { - case string: - return strconv.Atoi(v) - case int: - return v, nil - case int64: - return int(v), nil - case json.Number: - return strconv.Atoi(string(v)) - default: - return 0, fmt.Errorf("%T is not an int", v) - } -} - -func MarshalInt64(i int64) Marshaler { - return WriterFunc(func(w io.Writer) { - io.WriteString(w, strconv.FormatInt(i, 10)) - }) -} - -func UnmarshalInt64(v interface{}) (int64, error) { - switch v := v.(type) { - case string: - return strconv.ParseInt(v, 10, 64) - case int: - return int64(v), nil - case int64: - return v, nil - case json.Number: - return strconv.ParseInt(string(v), 10, 64) - default: - return 0, fmt.Errorf("%T is not an int", v) - } -} - -func MarshalInt32(i int32) Marshaler { - return WriterFunc(func(w io.Writer) { - io.WriteString(w, strconv.FormatInt(int64(i), 10)) - }) -} - -func UnmarshalInt32(v interface{}) (int32, error) { - switch v := v.(type) { - case string: - iv, err := strconv.ParseInt(v, 10, 32) - if err != nil { - return 0, err - } - return int32(iv), nil - case int: - return int32(v), nil - case int64: - return int32(v), nil - case json.Number: - iv, err := strconv.ParseInt(string(v), 10, 32) - if err != nil { - return 0, err - } - return int32(iv), nil - default: - return 0, fmt.Errorf("%T is not an int", v) - } -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/jsonw.go b/vendor/github.com/99designs/gqlgen/graphql/jsonw.go deleted file mode 100644 index 54e293f1..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/jsonw.go +++ /dev/null @@ -1,93 +0,0 @@ -package graphql - -import ( - "context" - "io" -) - -var ( - nullLit = []byte(`null`) - trueLit = []byte(`true`) - falseLit = []byte(`false`) - openBrace = []byte(`{`) - closeBrace = []byte(`}`) - openBracket = []byte(`[`) - closeBracket = []byte(`]`) - colon = []byte(`:`) - comma = []byte(`,`) -) - -var ( - Null = &lit{nullLit} - True = &lit{trueLit} - False = &lit{falseLit} -) - -type Marshaler interface { - MarshalGQL(w io.Writer) -} - -type Unmarshaler interface { - UnmarshalGQL(v interface{}) error -} - -type ContextMarshaler interface { - MarshalGQLContext(ctx context.Context, w io.Writer) error -} - -type ContextUnmarshaler interface { - UnmarshalGQLContext(ctx context.Context, v interface{}) error -} - -type contextMarshalerAdapter struct { - Context context.Context - ContextMarshaler -} - -func WrapContextMarshaler(ctx context.Context, m ContextMarshaler) Marshaler { - return contextMarshalerAdapter{Context: ctx, ContextMarshaler: m} -} - -func (a contextMarshalerAdapter) MarshalGQL(w io.Writer) { - err := a.MarshalGQLContext(a.Context, w) - if err != nil { - AddError(a.Context, err) - Null.MarshalGQL(w) - } -} - -type WriterFunc func(writer io.Writer) - -func (f WriterFunc) MarshalGQL(w io.Writer) { - f(w) -} - -type ContextWriterFunc func(ctx context.Context, writer io.Writer) error - -func (f ContextWriterFunc) MarshalGQLContext(ctx context.Context, w io.Writer) error { - return f(ctx, w) -} - -type Array []Marshaler - -func (a Array) MarshalGQL(writer io.Writer) { - writer.Write(openBracket) - for i, val := range a { - if i != 0 { - writer.Write(comma) - } - val.MarshalGQL(writer) - } - writer.Write(closeBracket) -} - -type lit struct{ b []byte } - -func (l lit) MarshalGQL(w io.Writer) { - w.Write(l.b) -} - -func (l lit) MarshalGQLContext(ctx context.Context, w io.Writer) error { - w.Write(l.b) - return nil -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/map.go b/vendor/github.com/99designs/gqlgen/graphql/map.go deleted file mode 100644 index 1e91d1d9..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/map.go +++ /dev/null @@ -1,24 +0,0 @@ -package graphql - -import ( - "encoding/json" - "fmt" - "io" -) - -func MarshalMap(val map[string]interface{}) Marshaler { - return WriterFunc(func(w io.Writer) { - err := json.NewEncoder(w).Encode(val) - if err != nil { - panic(err) - } - }) -} - -func UnmarshalMap(v interface{}) (map[string]interface{}, error) { - if m, ok := v.(map[string]interface{}); ok { - return m, nil - } - - return nil, fmt.Errorf("%T is not a map", v) -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/omittable.go b/vendor/github.com/99designs/gqlgen/graphql/omittable.go deleted file mode 100644 index 89716400..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/omittable.go +++ /dev/null @@ -1,58 +0,0 @@ -package graphql - -import "encoding/json" - -// Omittable is a wrapper around a value that also stores whether it is set -// or not. -type Omittable[T any] struct { - value T - set bool -} - -var ( - _ json.Marshaler = Omittable[struct{}]{} - _ json.Unmarshaler = (*Omittable[struct{}])(nil) -) - -func OmittableOf[T any](value T) Omittable[T] { - return Omittable[T]{ - value: value, - set: true, - } -} - -func (o Omittable[T]) Value() T { - if !o.set { - var zero T - return zero - } - return o.value -} - -func (o Omittable[T]) ValueOK() (T, bool) { - if !o.set { - var zero T - return zero, false - } - return o.value, true -} - -func (o Omittable[T]) IsSet() bool { - return o.set -} - -func (o Omittable[T]) MarshalJSON() ([]byte, error) { - if !o.set { - return []byte("null"), nil - } - return json.Marshal(o.value) -} - -func (o *Omittable[T]) UnmarshalJSON(bytes []byte) error { - err := json.Unmarshal(bytes, &o.value) - if err != nil { - return err - } - o.set = true - return nil -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/oneshot.go b/vendor/github.com/99designs/gqlgen/graphql/oneshot.go deleted file mode 100644 index 01fa15f8..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/oneshot.go +++ /dev/null @@ -1,16 +0,0 @@ -package graphql - -import "context" - -func OneShot(resp *Response) ResponseHandler { - var oneshot bool - - return func(context context.Context) *Response { - if oneshot { - return nil - } - oneshot = true - - return resp - } -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/recovery.go b/vendor/github.com/99designs/gqlgen/graphql/recovery.go deleted file mode 100644 index 9bc0e47e..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/recovery.go +++ /dev/null @@ -1,20 +0,0 @@ -package graphql - -import ( - "context" - "fmt" - "os" - "runtime/debug" - - "github.com/vektah/gqlparser/v2/gqlerror" -) - -type RecoverFunc func(ctx context.Context, err interface{}) (userMessage error) - -func DefaultRecover(ctx context.Context, err interface{}) error { - fmt.Fprintln(os.Stderr, err) - fmt.Fprintln(os.Stderr) - debug.PrintStack() - - return gqlerror.Errorf("internal system error") -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/response.go b/vendor/github.com/99designs/gqlgen/graphql/response.go deleted file mode 100644 index a82f27e2..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/response.go +++ /dev/null @@ -1,28 +0,0 @@ -package graphql - -import ( - "context" - "encoding/json" - "fmt" - - "github.com/vektah/gqlparser/v2/ast" - "github.com/vektah/gqlparser/v2/gqlerror" -) - -// Errors are intentionally serialized first based on the advice in -// https://github.com/facebook/graphql/commit/7b40390d48680b15cb93e02d46ac5eb249689876#diff-757cea6edf0288677a9eea4cfc801d87R107 -// and https://github.com/facebook/graphql/pull/384 -type Response struct { - Errors gqlerror.List `json:"errors,omitempty"` - Data json.RawMessage `json:"data"` - Label string `json:"label,omitempty"` - Path ast.Path `json:"path,omitempty"` - HasNext *bool `json:"hasNext,omitempty"` - Extensions map[string]interface{} `json:"extensions,omitempty"` -} - -func ErrorResponse(ctx context.Context, messagef string, args ...interface{}) *Response { - return &Response{ - Errors: gqlerror.List{{Message: fmt.Sprintf(messagef, args...)}}, - } -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/root.go b/vendor/github.com/99designs/gqlgen/graphql/root.go deleted file mode 100644 index 3405d180..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/root.go +++ /dev/null @@ -1,7 +0,0 @@ -package graphql - -type Query struct{} - -type Mutation struct{} - -type Subscription struct{} diff --git a/vendor/github.com/99designs/gqlgen/graphql/stats.go b/vendor/github.com/99designs/gqlgen/graphql/stats.go deleted file mode 100644 index 31b9e605..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/stats.go +++ /dev/null @@ -1,60 +0,0 @@ -package graphql - -import ( - "context" - "fmt" - "time" -) - -type Stats struct { - OperationStart time.Time - Read TraceTiming - Parsing TraceTiming - Validation TraceTiming - - // Stats collected by handler extensions. Don't use directly, the extension should provide a type safe way to - // access this. - extension map[string]interface{} -} - -type TraceTiming struct { - Start time.Time - End time.Time -} - -var ctxTraceStart key = "trace_start" - -// StartOperationTrace captures the current time and stores it in context. This will eventually be added to request -// context but we want to grab it as soon as possible. For transports that can only handle a single graphql query -// per http requests you don't need to call this at all, the server will do it for you. For transports that handle -// multiple (eg batching, subscriptions) this should be called before decoding each request. -func StartOperationTrace(ctx context.Context) context.Context { - return context.WithValue(ctx, ctxTraceStart, Now()) -} - -// GetStartTime should only be called by the handler package, it will be set into request context -// as Stats.Start -func GetStartTime(ctx context.Context) time.Time { - t, ok := ctx.Value(ctxTraceStart).(time.Time) - if !ok { - panic(fmt.Sprintf("missing start time: %T", ctx.Value(ctxTraceStart))) - } - return t -} - -func (c *Stats) SetExtension(name string, data interface{}) { - if c.extension == nil { - c.extension = map[string]interface{}{} - } - c.extension[name] = data -} - -func (c *Stats) GetExtension(name string) interface{} { - if c.extension == nil { - return nil - } - return c.extension[name] -} - -// Now is time.Now, except in tests. Then it can be whatever you want it to be. -var Now = time.Now diff --git a/vendor/github.com/99designs/gqlgen/graphql/string.go b/vendor/github.com/99designs/gqlgen/graphql/string.go deleted file mode 100644 index 4da47064..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/string.go +++ /dev/null @@ -1,73 +0,0 @@ -package graphql - -import ( - "encoding/json" - "fmt" - "io" - "strconv" -) - -const encodeHex = "0123456789ABCDEF" - -func MarshalString(s string) Marshaler { - return WriterFunc(func(w io.Writer) { - writeQuotedString(w, s) - }) -} - -func writeQuotedString(w io.Writer, s string) { - start := 0 - io.WriteString(w, `"`) - - for i, c := range s { - if c < 0x20 || c == '\\' || c == '"' { - io.WriteString(w, s[start:i]) - - switch c { - case '\t': - io.WriteString(w, `\t`) - case '\r': - io.WriteString(w, `\r`) - case '\n': - io.WriteString(w, `\n`) - case '\\': - io.WriteString(w, `\\`) - case '"': - io.WriteString(w, `\"`) - default: - io.WriteString(w, `\u00`) - w.Write([]byte{encodeHex[c>>4], encodeHex[c&0xf]}) - } - - start = i + 1 - } - } - - io.WriteString(w, s[start:]) - io.WriteString(w, `"`) -} - -func UnmarshalString(v interface{}) (string, error) { - switch v := v.(type) { - case string: - return v, nil - case int: - return strconv.Itoa(v), nil - case int64: - return strconv.FormatInt(v, 10), nil - case float64: - return strconv.FormatFloat(v, 'f', -1, 64), nil - case json.Number: - return string(v), nil - case bool: - if v { - return "true", nil - } else { - return "false", nil - } - case nil: - return "null", nil - default: - return "", fmt.Errorf("%T is not a string", v) - } -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/time.go b/vendor/github.com/99designs/gqlgen/graphql/time.go deleted file mode 100644 index ef3d17da..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/time.go +++ /dev/null @@ -1,25 +0,0 @@ -package graphql - -import ( - "errors" - "io" - "strconv" - "time" -) - -func MarshalTime(t time.Time) Marshaler { - if t.IsZero() { - return Null - } - - return WriterFunc(func(w io.Writer) { - io.WriteString(w, strconv.Quote(t.Format(time.RFC3339Nano))) - }) -} - -func UnmarshalTime(v interface{}) (time.Time, error) { - if tmpStr, ok := v.(string); ok { - return time.Parse(time.RFC3339Nano, tmpStr) - } - return time.Time{}, errors.New("time should be RFC3339Nano formatted string") -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/uint.go b/vendor/github.com/99designs/gqlgen/graphql/uint.go deleted file mode 100644 index 8730d900..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/uint.go +++ /dev/null @@ -1,106 +0,0 @@ -package graphql - -import ( - "encoding/json" - "errors" - "fmt" - "io" - "strconv" -) - -func MarshalUint(i uint) Marshaler { - return WriterFunc(func(w io.Writer) { - _, _ = io.WriteString(w, strconv.FormatUint(uint64(i), 10)) - }) -} - -func UnmarshalUint(v interface{}) (uint, error) { - switch v := v.(type) { - case string: - u64, err := strconv.ParseUint(v, 10, 64) - return uint(u64), err - case int: - if v < 0 { - return 0, errors.New("cannot convert negative numbers to uint") - } - - return uint(v), nil - case int64: - if v < 0 { - return 0, errors.New("cannot convert negative numbers to uint") - } - - return uint(v), nil - case json.Number: - u64, err := strconv.ParseUint(string(v), 10, 64) - return uint(u64), err - default: - return 0, fmt.Errorf("%T is not an uint", v) - } -} - -func MarshalUint64(i uint64) Marshaler { - return WriterFunc(func(w io.Writer) { - _, _ = io.WriteString(w, strconv.FormatUint(i, 10)) - }) -} - -func UnmarshalUint64(v interface{}) (uint64, error) { - switch v := v.(type) { - case string: - return strconv.ParseUint(v, 10, 64) - case int: - if v < 0 { - return 0, errors.New("cannot convert negative numbers to uint64") - } - - return uint64(v), nil - case int64: - if v < 0 { - return 0, errors.New("cannot convert negative numbers to uint64") - } - - return uint64(v), nil - case json.Number: - return strconv.ParseUint(string(v), 10, 64) - default: - return 0, fmt.Errorf("%T is not an uint", v) - } -} - -func MarshalUint32(i uint32) Marshaler { - return WriterFunc(func(w io.Writer) { - _, _ = io.WriteString(w, strconv.FormatUint(uint64(i), 10)) - }) -} - -func UnmarshalUint32(v interface{}) (uint32, error) { - switch v := v.(type) { - case string: - iv, err := strconv.ParseUint(v, 10, 32) - if err != nil { - return 0, err - } - return uint32(iv), nil - case int: - if v < 0 { - return 0, errors.New("cannot convert negative numbers to uint32") - } - - return uint32(v), nil - case int64: - if v < 0 { - return 0, errors.New("cannot convert negative numbers to uint32") - } - - return uint32(v), nil - case json.Number: - iv, err := strconv.ParseUint(string(v), 10, 32) - if err != nil { - return 0, err - } - return uint32(iv), nil - default: - return 0, fmt.Errorf("%T is not an uint", v) - } -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/upload.go b/vendor/github.com/99designs/gqlgen/graphql/upload.go deleted file mode 100644 index dafbde65..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/upload.go +++ /dev/null @@ -1,27 +0,0 @@ -package graphql - -import ( - "fmt" - "io" -) - -type Upload struct { - File io.ReadSeeker - Filename string - Size int64 - ContentType string -} - -func MarshalUpload(f Upload) Marshaler { - return WriterFunc(func(w io.Writer) { - io.Copy(w, f.File) - }) -} - -func UnmarshalUpload(v interface{}) (Upload, error) { - upload, ok := v.(Upload) - if !ok { - return Upload{}, fmt.Errorf("%T is not an Upload", v) - } - return upload, nil -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/uuid.go b/vendor/github.com/99designs/gqlgen/graphql/uuid.go deleted file mode 100644 index e9f22dcc..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/uuid.go +++ /dev/null @@ -1,25 +0,0 @@ -package graphql - -import ( - "fmt" - - "github.com/google/uuid" -) - -func MarshalUUID(id uuid.UUID) Marshaler { - if id == uuid.Nil { - return Null - } - return MarshalString(id.String()) -} - -func UnmarshalUUID(v any) (uuid.UUID, error) { - switch v := v.(type) { - case string: - return uuid.Parse(v) - case []byte: - return uuid.ParseBytes(v) - default: - return uuid.Nil, fmt.Errorf("%T is not a uuid", v) - } -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/version.go b/vendor/github.com/99designs/gqlgen/graphql/version.go deleted file mode 100644 index c8d052f9..00000000 --- a/vendor/github.com/99designs/gqlgen/graphql/version.go +++ /dev/null @@ -1,3 +0,0 @@ -package graphql - -const Version = "v0.17.44" diff --git a/vendor/github.com/Khan/genqlient/LICENSE b/vendor/github.com/Khan/genqlient/LICENSE deleted file mode 100644 index da7185eb..00000000 --- a/vendor/github.com/Khan/genqlient/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2020-2021 Khan Academy - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/vendor/github.com/Khan/genqlient/graphql/client.go b/vendor/github.com/Khan/genqlient/graphql/client.go deleted file mode 100644 index 469e3c04..00000000 --- a/vendor/github.com/Khan/genqlient/graphql/client.go +++ /dev/null @@ -1,241 +0,0 @@ -package graphql - -import ( - "bytes" - "context" - "encoding/json" - "errors" - "fmt" - "io" - "net/http" - "net/url" - "strings" - - "github.com/vektah/gqlparser/v2/gqlerror" -) - -// Client is the interface that the generated code calls into to actually make -// requests. -type Client interface { - // MakeRequest must make a request to the client's GraphQL API. - // - // ctx is the context that should be used to make this request. If context - // is disabled in the genqlient settings, this will be set to - // context.Background(). - // - // req contains the data to be sent to the GraphQL server. Typically GraphQL - // APIs will expect it to simply be marshalled as JSON, but MakeRequest may - // customize this. - // - // resp is the Response object into which the server's response will be - // unmarshalled. Typically GraphQL APIs will return JSON which can be - // unmarshalled directly into resp, but MakeRequest can customize it. - // If the response contains an error, this must also be returned by - // MakeRequest. The field resp.Data will be prepopulated with a pointer - // to an empty struct of the correct generated type (e.g. MyQueryResponse). - MakeRequest( - ctx context.Context, - req *Request, - resp *Response, - ) error -} - -type client struct { - httpClient Doer - endpoint string - method string -} - -// NewClient returns a [Client] which makes requests to the given endpoint, -// suitable for most users. -// -// The client makes POST requests to the given GraphQL endpoint using standard -// GraphQL HTTP-over-JSON transport. It will use the given [http.Client], or -// [http.DefaultClient] if a nil client is passed. -// -// The typical method of adding authentication headers is to wrap the client's -// [http.Transport] to add those headers. See [example/main.go] for an -// example. -// -// [example/main.go]: https://github.com/Khan/genqlient/blob/main/example/main.go#L12-L20 -func NewClient(endpoint string, httpClient Doer) Client { - return newClient(endpoint, httpClient, http.MethodPost) -} - -// NewClientUsingGet returns a [Client] which makes GET requests to the given -// endpoint suitable for most users who wish to make GET requests instead of -// POST. -// -// The client makes GET requests to the given GraphQL endpoint using a GET -// query, with the query, operation name and variables encoded as URL -// parameters. It will use the given [http.Client], or [http.DefaultClient] if -// a nil client is passed. -// -// The client does not support mutations, and will return an error if passed a -// request that attempts one. -// -// The typical method of adding authentication headers is to wrap the client's -// [http.Transport] to add those headers. See [example/main.go] for an -// example. -// -// [example/main.go]: https://github.com/Khan/genqlient/blob/main/example/main.go#L12-L20 -func NewClientUsingGet(endpoint string, httpClient Doer) Client { - return newClient(endpoint, httpClient, http.MethodGet) -} - -func newClient(endpoint string, httpClient Doer, method string) Client { - if httpClient == nil || httpClient == (*http.Client)(nil) { - httpClient = http.DefaultClient - } - return &client{httpClient, endpoint, method} -} - -// Doer encapsulates the methods from [*http.Client] needed by [Client]. -// The methods should have behavior to match that of [*http.Client] -// (or mocks for the same). -type Doer interface { - Do(*http.Request) (*http.Response, error) -} - -// Request contains all the values required to build queries executed by -// the [Client]. -// -// Typically, GraphQL APIs will accept a JSON payload of the form -// -// {"query": "query myQuery { ... }", "variables": {...}}` -// -// and Request marshals to this format. However, MakeRequest may -// marshal the data in some other way desired by the backend. -type Request struct { - // The literal string representing the GraphQL query, e.g. - // `query myQuery { myField }`. - Query string `json:"query"` - // A JSON-marshalable value containing the variables to be sent - // along with the query, or nil if there are none. - Variables interface{} `json:"variables,omitempty"` - // The GraphQL operation name. The server typically doesn't - // require this unless there are multiple queries in the - // document, but genqlient sets it unconditionally anyway. - OpName string `json:"operationName"` -} - -// Response that contains data returned by the GraphQL API. -// -// Typically, GraphQL APIs will return a JSON payload of the form -// -// {"data": {...}, "errors": {...}} -// -// It may additionally contain a key named "extensions", that -// might hold GraphQL protocol extensions. Extensions and Errors -// are optional, depending on the values returned by the server. -type Response struct { - Data interface{} `json:"data"` - Extensions map[string]interface{} `json:"extensions,omitempty"` - Errors gqlerror.List `json:"errors,omitempty"` -} - -func (c *client) MakeRequest(ctx context.Context, req *Request, resp *Response) error { - var httpReq *http.Request - var err error - if c.method == http.MethodGet { - httpReq, err = c.createGetRequest(req) - } else { - httpReq, err = c.createPostRequest(req) - } - - if err != nil { - return err - } - httpReq.Header.Set("Content-Type", "application/json") - - if ctx != nil { - httpReq = httpReq.WithContext(ctx) - } - - httpResp, err := c.httpClient.Do(httpReq) - if err != nil { - return err - } - defer httpResp.Body.Close() - - if httpResp.StatusCode != http.StatusOK { - var respBody []byte - respBody, err = io.ReadAll(httpResp.Body) - if err != nil { - respBody = []byte(fmt.Sprintf("", err)) - } - return fmt.Errorf("returned error %v: %s", httpResp.Status, respBody) - } - - err = json.NewDecoder(httpResp.Body).Decode(resp) - if err != nil { - return err - } - if len(resp.Errors) > 0 { - return resp.Errors - } - return nil -} - -func (c *client) createPostRequest(req *Request) (*http.Request, error) { - body, err := json.Marshal(req) - if err != nil { - return nil, err - } - - httpReq, err := http.NewRequest( - c.method, - c.endpoint, - bytes.NewReader(body)) - if err != nil { - return nil, err - } - - return httpReq, nil -} - -func (c *client) createGetRequest(req *Request) (*http.Request, error) { - parsedURL, err := url.Parse(c.endpoint) - if err != nil { - return nil, err - } - - queryParams := parsedURL.Query() - queryUpdated := false - - if req.Query != "" { - if strings.HasPrefix(strings.TrimSpace(req.Query), "mutation") { - return nil, errors.New("client does not support mutations") - } - queryParams.Set("query", req.Query) - queryUpdated = true - } - - if req.OpName != "" { - queryParams.Set("operationName", req.OpName) - queryUpdated = true - } - - if req.Variables != nil { - variables, variablesErr := json.Marshal(req.Variables) - if variablesErr != nil { - return nil, variablesErr - } - queryParams.Set("variables", string(variables)) - queryUpdated = true - } - - if queryUpdated { - parsedURL.RawQuery = queryParams.Encode() - } - - httpReq, err := http.NewRequest( - c.method, - parsedURL.String(), - http.NoBody) - if err != nil { - return nil, err - } - - return httpReq, nil -} diff --git a/vendor/github.com/Khan/genqlient/graphql/util.go b/vendor/github.com/Khan/genqlient/graphql/util.go deleted file mode 100644 index a5db637b..00000000 --- a/vendor/github.com/Khan/genqlient/graphql/util.go +++ /dev/null @@ -1,42 +0,0 @@ -package graphql - -// Utility types used by the generated code. In general, these are *not* -// intended for end-users. - -// NoUnmarshalJSON is intended for the use of genqlient's generated code only. -// -// It is used to prevent a struct type from inheriting its embed's -// UnmarshalJSON method, so if we construct a type: -// -// type T struct { E; NoUnmarshalJSON } -// -// where E has an UnmarshalJSON method, T will not inherit it, per the -// [Go selector rules]. -// -// [Go selector rules]: https://golang.org/ref/spec#Selectors. -type NoUnmarshalJSON struct{} - -// UnmarshalJSON should never be called; it exists only to prevent a sibling -// UnmarshalJSON method from being promoted. -func (NoUnmarshalJSON) UnmarshalJSON(b []byte) error { - panic("NoUnmarshalJSON.UnmarshalJSON should never be called!") -} - -// NoMarshalJSON is intended for the use of genqlient's generated code only. -// -// It is used to prevent a struct type from inheriting its embed's -// MarshalJSON method, so if we construct a type: -// -// type T struct { E; NoMarshalJSON } -// -// where E has an MarshalJSON method, T will not inherit it, per the -// [Go selector rules]. -// -// [Go selector rules]: https://golang.org/ref/spec#Selectors. -type NoMarshalJSON struct{} - -// MarshalJSON should never be called; it exists only to prevent a sibling -// MarshalJSON method from being promoted. -func (NoMarshalJSON) MarshalJSON() ([]byte, error) { - panic("NoUnmarshalJSON.MarshalJSON should never be called!") -} diff --git a/vendor/github.com/adrg/xdg/CODE_OF_CONDUCT.md b/vendor/github.com/adrg/xdg/CODE_OF_CONDUCT.md deleted file mode 100644 index 75349e53..00000000 --- a/vendor/github.com/adrg/xdg/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,77 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, -body size, disability, ethnicity, sex characteristics, gender identity and -expression, level of experience, education, socio-economic status, nationality, -personal appearance, race, religion, or sexual identity and orientation. - -## Our Standards - -Examples of behaviour that contributes to creating a positive environment -include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behaviour by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or - advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behaviour and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behaviour. - -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviour that they deem inappropriate, -threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behaviour may be -reported by contacting the project team at adrg@epistack.com. All complaints -will be reviewed and investigated and will result in a response that is deemed -necessary and appropriate to the circumstances. The project team is obligated to -maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], -version 1.4, available at -https://www.contributor-covenant.org/version/1/4/code-of-conduct.html - -[homepage]: https://www.contributor-covenant.org - -For answers to common questions about this code of conduct, see -https://www.contributor-covenant.org/faq diff --git a/vendor/github.com/adrg/xdg/CONTRIBUTING.md b/vendor/github.com/adrg/xdg/CONTRIBUTING.md deleted file mode 100644 index 006f146b..00000000 --- a/vendor/github.com/adrg/xdg/CONTRIBUTING.md +++ /dev/null @@ -1,135 +0,0 @@ -# Contributing to this project - -Contributions in the form of pull requests, issues or just general feedback, -are always welcome. Please take a moment to review this document in order to -make the contribution process easy and effective for everyone involved. - -Following these guidelines helps to communicate that you respect the time of -the developers managing and developing this open source project. In return, -they should reciprocate that respect in addressing your issue or assessing -patches and features. - -## Using the issue tracker - -The issue tracker is the preferred channel for [bug reports](#bugs), -[features requests](#features) and [submitting pull -requests](#pull-requests), but please respect the following restrictions: - -* Please **do not** use the issue tracker for personal support requests (use - [Stack Overflow](http://stackoverflow.com) or IRC). -* Please **do not** derail or troll issues. Keep the discussion on topic and - respect the opinions of others. - - -## Bug reports - -A bug is a _demonstrable problem_ that is caused by the code in the repository. -Good bug reports are extremely helpful - thank you! - -Guidelines for bug reports: - -1. **Use the GitHub issue search** — check if the issue has already been - reported. -2. **Check if the issue has been fixed** — try to reproduce it using the - latest `master` or development branch in the repository. -3. **Isolate the problem** — create a reduced test case. - -A good bug report shouldn't leave others needing to chase you up for more -information. Please try to be as detailed as possible in your report. What is -your environment? What steps will reproduce the issue? What browser(s) and OS -experience the problem? What would you expect to be the outcome? All these -details will help people to fix any potential bugs. - -Example: - -> Short and descriptive example bug report title -> -> A summary of the issue and the browser/OS environment in which it occurs. If -> suitable, include the steps required to reproduce the bug. -> -> 1. This is the first step -> 2. This is the second step -> 3. Further steps, etc. -> -> `` - a link to the reduced test case -> -> Any other information you want to share that is relevant to the issue being -> reported. This might include the lines of code that you have identified as -> causing the bug, and potential solutions (and your opinions on their -> merits). - - - -## Feature requests - -Feature requests are welcome. But take a moment to find out whether your idea -fits with the scope and aims of the project. It's up to *you* to make a strong -case to convince the project's developers of the merits of this feature. Please -provide as much detail and context as possible. - - - -## Pull requests - -Good pull requests - patches, improvements, new features - are a fantastic -help. They should remain focused in scope and avoid containing unrelated -commits. - -**Please ask first** before embarking on any significant pull request (e.g. -implementing features, refactoring code, porting to a different language), -otherwise you risk spending a lot of time working on something that the -project's developers might not want to merge into the project. - -Please adhere to the coding conventions used throughout a project (indentation, -accurate comments, etc.) and any other requirements (such as test coverage). - -Follow this process if you'd like your work considered for inclusion in the -project: - -1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork, - and configure the remotes: - - ```bash - # Clone your fork of the repo into the current directory - git clone https://github.com// - # Navigate to the newly cloned directory - cd - # Assign the original repo to a remote called "upstream" - git remote add upstream https://github.com// - ``` - -2. If you cloned a while ago, get the latest changes from upstream: - - ```bash - git checkout - git pull upstream - ``` - -3. Create a new topic branch (off the main project development branch) to - contain your feature, change, or fix: - - ```bash - git checkout -b - ``` - -4. Commit your changes in logical chunks and use descriptive commit messages. - Use [interactive rebase](https://help.github.com/articles/interactive-rebase) - to tidy up your commits before making them public. - -5. Locally merge (or rebase) the upstream development branch into your topic branch: - - ```bash - git pull [--rebase] upstream - ``` - -6. Push your topic branch up to your fork: - - ```bash - git push origin - ``` - -7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) - with a clear title and description. - -**IMPORTANT**: By submitting a patch, you agree to allow the project owner to -license your work under the same license as that used by the project. diff --git a/vendor/github.com/adrg/xdg/LICENSE b/vendor/github.com/adrg/xdg/LICENSE deleted file mode 100644 index 7307e1b7..00000000 --- a/vendor/github.com/adrg/xdg/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Adrian-George Bostan - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/adrg/xdg/README.md b/vendor/github.com/adrg/xdg/README.md deleted file mode 100644 index b55403c2..00000000 --- a/vendor/github.com/adrg/xdg/README.md +++ /dev/null @@ -1,280 +0,0 @@ -

-
- xdg logo -
-

- -

Go implementation of the XDG Base Directory Specification and XDG user directories.

- -

- - Build status - - - Code coverage - - - pkg.go.dev documentation - - - MIT license - -
- - Go report card - - - Awesome Go - - - GitHub contributors - - - GitHub open issues - - - Buy me a coffee - -

- -Provides an implementation of the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html). -The specification defines a set of standard paths for storing application files, -including data and configuration files. For portability and flexibility reasons, -applications should use the XDG defined locations instead of hardcoding paths. -The package also includes the locations of well known [user directories](https://wiki.archlinux.org/index.php/XDG_user_directories), as well as -other common directories such as fonts and applications. - -The current implementation supports **most flavors of Unix**, **Windows**, **macOS** and **Plan 9**. -On Windows, where XDG environment variables are not usually set, the package uses [Known Folders](https://docs.microsoft.com/en-us/windows/win32/shell/known-folders) -as defaults. Therefore, appropriate locations are used for common [folders](https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid) which may have been redirected. - -See usage [examples](#usage) below. Full documentation can be found at https://pkg.go.dev/github.com/adrg/xdg. - -## Installation - go get github.com/adrg/xdg - -## Default locations - -The package defines sensible defaults for XDG variables which are empty or not -present in the environment. - -- On Unix-like operating systems, XDG environment variables are tipically defined. -Appropriate default locations are used for the environment variables which are not set. -- On Windows, XDG environment variables are usually not set. If that is the case, -the package relies on the appropriate [Known Folders](https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid). -Sensible fallback locations are used for the folders which are not set. - -### XDG Base Directory - -
- Unix-like operating systems -
- -| |

Unix

|

macOS

|

Plan 9

| -| :------------------------------------------------------------: | :-----------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------: | -| XDG_DATA_HOME | ~/.local/share | ~/Library/Application Support | $home/lib | -| XDG_DATA_DIRS | /usr/local/share
/usr/share | /Library/Application Support | /lib | -| XDG_CONFIG_HOME | ~/.config | ~/Library/Application Support | $home/lib | -| XDG_CONFIG_DIRS | /etc/xdg | ~/Library/Preferences
/Library/Application Support
/Library/Preferences | /lib | -| XDG_STATE_HOME | ~/.local/state | ~/Library/Application Support | $home/lib/state | -| XDG_CACHE_HOME | ~/.cache | ~/Library/Caches | $home/lib/cache | -| XDG_RUNTIME_DIR | /run/user/UID | ~/Library/Application Support | /tmp | - -
- -
- Microsoft Windows -
- -| |

Known Folder(s)

|

Fallback(s)

| -| :------------------------------------------------------------: | :---------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------: | -| XDG_DATA_HOME | LocalAppData | %LOCALAPPDATA% | -| XDG_DATA_DIRS | RoamingAppData
ProgramData | %APPADATA%
%ProgramData% | -| XDG_CONFIG_HOME | LocalAppData | %LOCALAPPDATA% | -| XDG_CONFIG_DIRS | ProgramData
RoamingAppData | %ProgramData%
%APPDATA% | -| XDG_STATE_HOME | LocalAppData | %LOCALAPPDATA% | -| XDG_CACHE_HOME | LocalAppData\cache | %LOCALAPPDATA%\cache | -| XDG_RUNTIME_DIR | LocalAppData | %LOCALAPPDATA% | - -
- -### XDG user directories - -
- Unix-like operating systems -
- -| |

Unix

|

macOS

|

Plan 9

| -| :--------------------------------------------------------------: | :-------------------------------------------------------------------------: | :---------------------------------------------------------------------------: | :---------------------------------------------------------------------------: | -| XDG_DESKTOP_DIR | ~/Desktop | ~/Desktop | $home/desktop | -| XDG_DOWNLOAD_DIR | ~/Downloads | ~/Downloads | $home/downloads | -| XDG_DOCUMENTS_DIR | ~/Documents | ~/Documents | $home/documents | -| XDG_MUSIC_DIR | ~/Music | ~/Music | $home/music | -| XDG_PICTURES_DIR | ~/Pictures | ~/Pictures | $home/pictures | -| XDG_VIDEOS_DIR | ~/Videos | ~/Movies | $home/videos | -| XDG_TEMPLATES_DIR | ~/Templates | ~/Templates | $home/templates | -| XDG_PUBLICSHARE_DIR | ~/Public | ~/Public | $home/public | - -
- -
- Microsoft Windows -
- -| |

Known Folder(s)

|

Fallback(s)

| -| :--------------------------------------------------------------: | :-----------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------: | -| XDG_DESKTOP_DIR | Desktop | %USERPROFILE%\Desktop | -| XDG_DOWNLOAD_DIR | Downloads | %USERPROFILE%\Downloads | -| XDG_DOCUMENTS_DIR | Documents | %USERPROFILE%\Documents | -| XDG_MUSIC_DIR | Music | %USERPROFILE%\Music | -| XDG_PICTURES_DIR | Pictures | %USERPROFILE%\Pictures | -| XDG_VIDEOS_DIR | Videos | %USERPROFILE%\Videos | -| XDG_TEMPLATES_DIR | Templates | %APPDATA%\Microsoft\Windows\Templates | -| XDG_PUBLICSHARE_DIR | Public | %PUBLIC% | - -
- -### Other directories - -
- Unix-like operating systems -
- -| |

Unix

|

macOS

|

Plan 9

| -| :-----------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------: | -| Home | $HOME | $HOME | $home | -| Applications | $XDG_DATA_HOME/applications
~/.local/share/applications
/usr/local/share/applications
/usr/share/applications
$XDG_DATA_DIRS/applications | /Applications | $home/bin
/bin | -| Fonts | $XDG_DATA_HOME/fonts
~/.fonts
~/.local/share/fonts
/usr/local/share/fonts
/usr/share/fonts
$XDG_DATA_DIRS/fonts | ~/Library/Fonts
/Library/Fonts
/System/Library/Fonts
/Network/Library/Fonts | $home/lib/font
/lib/font | - -
- -
- Microsoft Windows -
- -| |

Known Folder(s)

|

Fallback(s)

| -| :-----------------------------------------------------------: | :--------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------: | -| Home | Profile | %USERPROFILE% | -| Applications | Programs
CommonPrograms | %APPDATA%\Microsoft\Windows\Start Menu\Programs
%ProgramData%\Microsoft\Windows\Start Menu\Programs | -| Fonts | Fonts
- | %SystemRoot%\Fonts
%LOCALAPPDATA%\Microsoft\Windows\Fonts | - -
- -## Usage - -#### XDG Base Directory - -```go -package main - -import ( - "log" - - "github.com/adrg/xdg" -) - -func main() { - // XDG Base Directory paths. - log.Println("Home data directory:", xdg.DataHome) - log.Println("Data directories:", xdg.DataDirs) - log.Println("Home config directory:", xdg.ConfigHome) - log.Println("Config directories:", xdg.ConfigDirs) - log.Println("Home state directory:", xdg.StateHome) - log.Println("Cache directory:", xdg.CacheHome) - log.Println("Runtime directory:", xdg.RuntimeDir) - - // Other common directories. - log.Println("Home directory:", xdg.Home) - log.Println("Application directories:", xdg.ApplicationDirs) - log.Println("Font directories:", xdg.FontDirs) - - // Obtain a suitable location for application config files. - // ConfigFile takes one parameter which must contain the name of the file, - // but it can also contain a set of parent directories. If the directories - // don't exist, they will be created relative to the base config directory. - configFilePath, err := xdg.ConfigFile("appname/config.yaml") - if err != nil { - log.Fatal(err) - } - log.Println("Save the config file at:", configFilePath) - - // For other types of application files use: - // xdg.DataFile() - // xdg.StateFile() - // xdg.CacheFile() - // xdg.RuntimeFile() - - // Finding application config files. - // SearchConfigFile takes one parameter which must contain the name of - // the file, but it can also contain a set of parent directories relative - // to the config search paths (xdg.ConfigHome and xdg.ConfigDirs). - configFilePath, err = xdg.SearchConfigFile("appname/config.yaml") - if err != nil { - log.Fatal(err) - } - log.Println("Config file was found at:", configFilePath) - - // For other types of application files use: - // xdg.SearchDataFile() - // xdg.SearchStateFile() - // xdg.SearchCacheFile() - // xdg.SearchRuntimeFile() -} -``` - -#### XDG user directories - -```go -package main - -import ( - "log" - - "github.com/adrg/xdg" -) - -func main() { - // XDG user directories. - log.Println("Desktop directory:", xdg.UserDirs.Desktop) - log.Println("Download directory:", xdg.UserDirs.Download) - log.Println("Documents directory:", xdg.UserDirs.Documents) - log.Println("Music directory:", xdg.UserDirs.Music) - log.Println("Pictures directory:", xdg.UserDirs.Pictures) - log.Println("Videos directory:", xdg.UserDirs.Videos) - log.Println("Templates directory:", xdg.UserDirs.Templates) - log.Println("Public directory:", xdg.UserDirs.PublicShare) -} -``` - -## Stargazers over time - -[![Stargazers over time](https://starchart.cc/adrg/xdg.svg)](https://starchart.cc/adrg/xdg) - -## Contributing - -Contributions in the form of pull requests, issues or just general feedback, -are always welcome. -See [CONTRIBUTING.MD](CONTRIBUTING.md). - -**Contributors**: -[adrg](https://github.com/adrg), -[wichert](https://github.com/wichert), -[bouncepaw](https://github.com/bouncepaw), -[gabriel-vasile](https://github.com/gabriel-vasile), -[KalleDK](https://github.com/KalleDK), -[nvkv](https://github.com/nvkv), -[djdv](https://github.com/djdv). - -## References - -For more information see: -* [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) -* [XDG user directories](https://wiki.archlinux.org/index.php/XDG_user_directories) -* [Windows Known Folders](https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid) - -## License - -Copyright (c) 2014 Adrian-George Bostan. - -This project is licensed under the [MIT license](https://opensource.org/licenses/MIT). -See [LICENSE](LICENSE) for more details. diff --git a/vendor/github.com/adrg/xdg/base_dirs.go b/vendor/github.com/adrg/xdg/base_dirs.go deleted file mode 100644 index a8a3fd55..00000000 --- a/vendor/github.com/adrg/xdg/base_dirs.go +++ /dev/null @@ -1,68 +0,0 @@ -package xdg - -import "github.com/adrg/xdg/internal/pathutil" - -// XDG Base Directory environment variables. -const ( - envDataHome = "XDG_DATA_HOME" - envDataDirs = "XDG_DATA_DIRS" - envConfigHome = "XDG_CONFIG_HOME" - envConfigDirs = "XDG_CONFIG_DIRS" - envStateHome = "XDG_STATE_HOME" - envCacheHome = "XDG_CACHE_HOME" - envRuntimeDir = "XDG_RUNTIME_DIR" -) - -type baseDirectories struct { - dataHome string - data []string - configHome string - config []string - stateHome string - cacheHome string - runtime string - - // Non-standard directories. - fonts []string - applications []string -} - -func (bd baseDirectories) dataFile(relPath string) (string, error) { - return pathutil.Create(relPath, append([]string{bd.dataHome}, bd.data...)) -} - -func (bd baseDirectories) configFile(relPath string) (string, error) { - return pathutil.Create(relPath, append([]string{bd.configHome}, bd.config...)) -} - -func (bd baseDirectories) stateFile(relPath string) (string, error) { - return pathutil.Create(relPath, []string{bd.stateHome}) -} - -func (bd baseDirectories) cacheFile(relPath string) (string, error) { - return pathutil.Create(relPath, []string{bd.cacheHome}) -} - -func (bd baseDirectories) runtimeFile(relPath string) (string, error) { - return pathutil.Create(relPath, []string{bd.runtime}) -} - -func (bd baseDirectories) searchDataFile(relPath string) (string, error) { - return pathutil.Search(relPath, append([]string{bd.dataHome}, bd.data...)) -} - -func (bd baseDirectories) searchConfigFile(relPath string) (string, error) { - return pathutil.Search(relPath, append([]string{bd.configHome}, bd.config...)) -} - -func (bd baseDirectories) searchStateFile(relPath string) (string, error) { - return pathutil.Search(relPath, []string{bd.stateHome}) -} - -func (bd baseDirectories) searchCacheFile(relPath string) (string, error) { - return pathutil.Search(relPath, []string{bd.cacheHome}) -} - -func (bd baseDirectories) searchRuntimeFile(relPath string) (string, error) { - return pathutil.Search(relPath, []string{bd.runtime}) -} diff --git a/vendor/github.com/adrg/xdg/codecov.yml b/vendor/github.com/adrg/xdg/codecov.yml deleted file mode 100644 index 54ee338f..00000000 --- a/vendor/github.com/adrg/xdg/codecov.yml +++ /dev/null @@ -1,11 +0,0 @@ -coverage: - status: - project: - default: - target: 90% - threshold: 1% - patch: - default: - target: 100% -ignore: - - "paths_plan9.go" diff --git a/vendor/github.com/adrg/xdg/doc.go b/vendor/github.com/adrg/xdg/doc.go deleted file mode 100644 index 7747b183..00000000 --- a/vendor/github.com/adrg/xdg/doc.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Package xdg provides an implementation of the XDG Base Directory Specification. -The specification defines a set of standard paths for storing application files -including data and configuration files. For portability and flexibility reasons, -applications should use the XDG defined locations instead of hardcoding paths. -The package also includes the locations of well known user directories. - -The current implementation supports most flavors of Unix, Windows, Mac OS and Plan 9. - - For more information regarding the XDG Base Directory Specification see: - https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html - - For more information regarding the XDG user directories see: - https://wiki.archlinux.org/index.php/XDG_user_directories - - For more information regarding the Windows Known Folders see: - https://docs.microsoft.com/en-us/windows/win32/shell/known-folders - -Usage - -XDG Base Directory - package main - - import ( - "log" - - "github.com/adrg/xdg" - ) - - func main() { - // XDG Base Directory paths. - log.Println("Home data directory:", xdg.DataHome) - log.Println("Data directories:", xdg.DataDirs) - log.Println("Home config directory:", xdg.ConfigHome) - log.Println("Config directories:", xdg.ConfigDirs) - log.Println("Home state directory:", xdg.StateHome) - log.Println("Cache directory:", xdg.CacheHome) - log.Println("Runtime directory:", xdg.RuntimeDir) - - // Other common directories. - log.Println("Home directory:", xdg.Home) - log.Println("Application directories:", xdg.ApplicationDirs) - log.Println("Font directories:", xdg.FontDirs) - - // Obtain a suitable location for application config files. - // ConfigFile takes one parameter which must contain the name of the file, - // but it can also contain a set of parent directories. If the directories - // don't exist, they will be created relative to the base config directory. - configFilePath, err := xdg.ConfigFile("appname/config.yaml") - if err != nil { - log.Fatal(err) - } - log.Println("Save the config file at:", configFilePath) - - // For other types of application files use: - // xdg.DataFile() - // xdg.StateFile() - // xdg.CacheFile() - // xdg.RuntimeFile() - - // Finding application config files. - // SearchConfigFile takes one parameter which must contain the name of - // the file, but it can also contain a set of parent directories relative - // to the config search paths (xdg.ConfigHome and xdg.ConfigDirs). - configFilePath, err = xdg.SearchConfigFile("appname/config.yaml") - if err != nil { - log.Fatal(err) - } - log.Println("Config file was found at:", configFilePath) - - // For other types of application files use: - // xdg.SearchDataFile() - // xdg.SearchStateFile() - // xdg.SearchCacheFile() - // xdg.SearchRuntimeFile() - } - -XDG user directories - package main - - import ( - "log" - - "github.com/adrg/xdg" - ) - - func main() { - // XDG user directories. - log.Println("Desktop directory:", xdg.UserDirs.Desktop) - log.Println("Download directory:", xdg.UserDirs.Download) - log.Println("Documents directory:", xdg.UserDirs.Documents) - log.Println("Music directory:", xdg.UserDirs.Music) - log.Println("Pictures directory:", xdg.UserDirs.Pictures) - log.Println("Videos directory:", xdg.UserDirs.Videos) - log.Println("Templates directory:", xdg.UserDirs.Templates) - log.Println("Public directory:", xdg.UserDirs.PublicShare) - } -*/ -package xdg diff --git a/vendor/github.com/adrg/xdg/internal/pathutil/pathutil.go b/vendor/github.com/adrg/xdg/internal/pathutil/pathutil.go deleted file mode 100644 index 7422342b..00000000 --- a/vendor/github.com/adrg/xdg/internal/pathutil/pathutil.go +++ /dev/null @@ -1,78 +0,0 @@ -package pathutil - -import ( - "fmt" - "os" - "path/filepath" - "strings" -) - -// Unique eliminates the duplicate paths from the provided slice and returns -// the result. The items in the output slice are in the order in which they -// occur in the input slice. If a `home` location is provided, the paths are -// expanded using the `ExpandHome` function. -func Unique(paths []string, home string) []string { - var ( - uniq []string - registry = map[string]struct{}{} - ) - - for _, p := range paths { - p = ExpandHome(p, home) - if p != "" && filepath.IsAbs(p) { - if _, ok := registry[p]; ok { - continue - } - - registry[p] = struct{}{} - uniq = append(uniq, p) - } - } - - return uniq -} - -// Create returns a suitable location relative to which the file with the -// specified `name` can be written. The first path from the provided `paths` -// slice which is successfully created (or already exists) is used as a base -// path for the file. The `name` parameter should contain the name of the file -// which is going to be written in the location returned by this function, but -// it can also contain a set of parent directories, which will be created -// relative to the selected parent path. -func Create(name string, paths []string) (string, error) { - var searchedPaths []string - for _, p := range paths { - p = filepath.Join(p, name) - - dir := filepath.Dir(p) - if Exists(dir) { - return p, nil - } - if err := os.MkdirAll(dir, os.ModeDir|0700); err == nil { - return p, nil - } - - searchedPaths = append(searchedPaths, dir) - } - - return "", fmt.Errorf("could not create any of the following paths: %s", - strings.Join(searchedPaths, ", ")) -} - -// Search searches for the file with the specified `name` in the provided -// slice of `paths`. The `name` parameter must contain the name of the file, -// but it can also contain a set of parent directories. -func Search(name string, paths []string) (string, error) { - var searchedPaths []string - for _, p := range paths { - p = filepath.Join(p, name) - if Exists(p) { - return p, nil - } - - searchedPaths = append(searchedPaths, filepath.Dir(p)) - } - - return "", fmt.Errorf("could not locate `%s` in any of the following paths: %s", - filepath.Base(name), strings.Join(searchedPaths, ", ")) -} diff --git a/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_plan9.go b/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_plan9.go deleted file mode 100644 index 8ee4e8d2..00000000 --- a/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_plan9.go +++ /dev/null @@ -1,29 +0,0 @@ -package pathutil - -import ( - "os" - "path/filepath" - "strings" -) - -// Exists returns true if the specified path exists. -func Exists(path string) bool { - _, err := os.Stat(path) - return err == nil || os.IsExist(err) -} - -// ExpandHome substitutes `~` and `$home` at the start of the specified -// `path` using the provided `home` location. -func ExpandHome(path, home string) string { - if path == "" || home == "" { - return path - } - if path[0] == '~' { - return filepath.Join(home, path[1:]) - } - if strings.HasPrefix(path, "$home") { - return filepath.Join(home, path[5:]) - } - - return path -} diff --git a/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_unix.go b/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_unix.go deleted file mode 100644 index a014c66e..00000000 --- a/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_unix.go +++ /dev/null @@ -1,32 +0,0 @@ -//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || nacl || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd js,wasm nacl linux netbsd openbsd solaris - -package pathutil - -import ( - "os" - "path/filepath" - "strings" -) - -// Exists returns true if the specified path exists. -func Exists(path string) bool { - _, err := os.Stat(path) - return err == nil || os.IsExist(err) -} - -// ExpandHome substitutes `~` and `$HOME` at the start of the specified -// `path` using the provided `home` location. -func ExpandHome(path, home string) string { - if path == "" || home == "" { - return path - } - if path[0] == '~' { - return filepath.Join(home, path[1:]) - } - if strings.HasPrefix(path, "$HOME") { - return filepath.Join(home, path[5:]) - } - - return path -} diff --git a/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_windows.go b/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_windows.go deleted file mode 100644 index 44080e3a..00000000 --- a/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_windows.go +++ /dev/null @@ -1,64 +0,0 @@ -package pathutil - -import ( - "os" - "path/filepath" - "strings" - - "golang.org/x/sys/windows" -) - -// Exists returns true if the specified path exists. -func Exists(path string) bool { - fi, err := os.Lstat(path) - if fi != nil && fi.Mode()&os.ModeSymlink != 0 { - _, err = filepath.EvalSymlinks(path) - } - - return err == nil || os.IsExist(err) -} - -// ExpandHome substitutes `%USERPROFILE%` at the start of the specified -// `path` using the provided `home` location. -func ExpandHome(path, home string) string { - if path == "" || home == "" { - return path - } - if strings.HasPrefix(path, `%USERPROFILE%`) { - return filepath.Join(home, path[13:]) - } - - return path -} - -// KnownFolder returns the location of the folder with the specified ID. -// If that fails, the folder location is determined by reading the provided -// environment variables (the first non-empty read value is returned). -// If that fails as well, the first non-empty fallback is returned. -// If all of the above fails, the function returns an empty string. -func KnownFolder(id *windows.KNOWNFOLDERID, envVars []string, fallbacks []string) string { - if id != nil { - flags := []uint32{windows.KF_FLAG_DEFAULT, windows.KF_FLAG_DEFAULT_PATH} - for _, flag := range flags { - p, _ := windows.KnownFolderPath(id, flag|windows.KF_FLAG_DONT_VERIFY) - if p != "" { - return p - } - } - } - - for _, envVar := range envVars { - p := os.Getenv(envVar) - if p != "" { - return p - } - } - - for _, fallback := range fallbacks { - if fallback != "" { - return fallback - } - } - - return "" -} diff --git a/vendor/github.com/adrg/xdg/paths_darwin.go b/vendor/github.com/adrg/xdg/paths_darwin.go deleted file mode 100644 index bfe9ad9b..00000000 --- a/vendor/github.com/adrg/xdg/paths_darwin.go +++ /dev/null @@ -1,60 +0,0 @@ -package xdg - -import ( - "os" - "path/filepath" -) - -func homeDir() string { - if home := os.Getenv("HOME"); home != "" { - return home - } - - return "/" -} - -func initDirs(home string) { - initBaseDirs(home) - initUserDirs(home) -} - -func initBaseDirs(home string) { - homeAppSupport := filepath.Join(home, "Library", "Application Support") - rootAppSupport := "/Library/Application Support" - - // Initialize standard directories. - baseDirs.dataHome = xdgPath(envDataHome, homeAppSupport) - baseDirs.data = xdgPaths(envDataDirs, rootAppSupport) - baseDirs.configHome = xdgPath(envConfigHome, homeAppSupport) - baseDirs.config = xdgPaths(envConfigDirs, - filepath.Join(home, "Library", "Preferences"), - rootAppSupport, - "/Library/Preferences", - ) - baseDirs.stateHome = xdgPath(envStateHome, homeAppSupport) - baseDirs.cacheHome = xdgPath(envCacheHome, filepath.Join(home, "Library", "Caches")) - baseDirs.runtime = xdgPath(envRuntimeDir, homeAppSupport) - - // Initialize non-standard directories. - baseDirs.applications = []string{ - "/Applications", - } - - baseDirs.fonts = []string{ - filepath.Join(home, "Library/Fonts"), - "/Library/Fonts", - "/System/Library/Fonts", - "/Network/Library/Fonts", - } -} - -func initUserDirs(home string) { - UserDirs.Desktop = xdgPath(envDesktopDir, filepath.Join(home, "Desktop")) - UserDirs.Download = xdgPath(envDownloadDir, filepath.Join(home, "Downloads")) - UserDirs.Documents = xdgPath(envDocumentsDir, filepath.Join(home, "Documents")) - UserDirs.Music = xdgPath(envMusicDir, filepath.Join(home, "Music")) - UserDirs.Pictures = xdgPath(envPicturesDir, filepath.Join(home, "Pictures")) - UserDirs.Videos = xdgPath(envVideosDir, filepath.Join(home, "Movies")) - UserDirs.Templates = xdgPath(envTemplatesDir, filepath.Join(home, "Templates")) - UserDirs.PublicShare = xdgPath(envPublicShareDir, filepath.Join(home, "Public")) -} diff --git a/vendor/github.com/adrg/xdg/paths_plan9.go b/vendor/github.com/adrg/xdg/paths_plan9.go deleted file mode 100644 index 2882f688..00000000 --- a/vendor/github.com/adrg/xdg/paths_plan9.go +++ /dev/null @@ -1,55 +0,0 @@ -package xdg - -import ( - "os" - "path/filepath" -) - -func homeDir() string { - if home := os.Getenv("home"); home != "" { - return home - } - - return "/" -} - -func initDirs(home string) { - initBaseDirs(home) - initUserDirs(home) -} - -func initBaseDirs(home string) { - homeLibDir := filepath.Join(home, "lib") - rootLibDir := "/lib" - - // Initialize standard directories. - baseDirs.dataHome = xdgPath(envDataHome, homeLibDir) - baseDirs.data = xdgPaths(envDataDirs, rootLibDir) - baseDirs.configHome = xdgPath(envConfigHome, homeLibDir) - baseDirs.config = xdgPaths(envConfigDirs, rootLibDir) - baseDirs.stateHome = xdgPath(envStateHome, filepath.Join(homeLibDir, "state")) - baseDirs.cacheHome = xdgPath(envCacheHome, filepath.Join(homeLibDir, "cache")) - baseDirs.runtime = xdgPath(envRuntimeDir, "/tmp") - - // Initialize non-standard directories. - baseDirs.applications = []string{ - filepath.Join(home, "bin"), - "/bin", - } - - baseDirs.fonts = []string{ - filepath.Join(homeLibDir, "font"), - "/lib/font", - } -} - -func initUserDirs(home string) { - UserDirs.Desktop = xdgPath(envDesktopDir, filepath.Join(home, "desktop")) - UserDirs.Download = xdgPath(envDownloadDir, filepath.Join(home, "downloads")) - UserDirs.Documents = xdgPath(envDocumentsDir, filepath.Join(home, "documents")) - UserDirs.Music = xdgPath(envMusicDir, filepath.Join(home, "music")) - UserDirs.Pictures = xdgPath(envPicturesDir, filepath.Join(home, "pictures")) - UserDirs.Videos = xdgPath(envVideosDir, filepath.Join(home, "videos")) - UserDirs.Templates = xdgPath(envTemplatesDir, filepath.Join(home, "templates")) - UserDirs.PublicShare = xdgPath(envPublicShareDir, filepath.Join(home, "public")) -} diff --git a/vendor/github.com/adrg/xdg/paths_unix.go b/vendor/github.com/adrg/xdg/paths_unix.go deleted file mode 100644 index ad571dfc..00000000 --- a/vendor/github.com/adrg/xdg/paths_unix.go +++ /dev/null @@ -1,71 +0,0 @@ -//go:build aix || dragonfly || freebsd || (js && wasm) || nacl || linux || netbsd || openbsd || solaris -// +build aix dragonfly freebsd js,wasm nacl linux netbsd openbsd solaris - -package xdg - -import ( - "os" - "path/filepath" - "strconv" - - "github.com/adrg/xdg/internal/pathutil" -) - -func homeDir() string { - if home := os.Getenv("HOME"); home != "" { - return home - } - - return "/" -} - -func initDirs(home string) { - initBaseDirs(home) - initUserDirs(home) -} - -func initBaseDirs(home string) { - // Initialize standard directories. - baseDirs.dataHome = xdgPath(envDataHome, filepath.Join(home, ".local", "share")) - baseDirs.data = xdgPaths(envDataDirs, "/usr/local/share", "/usr/share") - baseDirs.configHome = xdgPath(envConfigHome, filepath.Join(home, ".config")) - baseDirs.config = xdgPaths(envConfigDirs, "/etc/xdg") - baseDirs.stateHome = xdgPath(envStateHome, filepath.Join(home, ".local", "state")) - baseDirs.cacheHome = xdgPath(envCacheHome, filepath.Join(home, ".cache")) - baseDirs.runtime = xdgPath(envRuntimeDir, filepath.Join("/run/user", strconv.Itoa(os.Getuid()))) - - // Initialize non-standard directories. - appDirs := []string{ - filepath.Join(baseDirs.dataHome, "applications"), - filepath.Join(home, ".local/share/applications"), - "/usr/local/share/applications", - "/usr/share/applications", - } - - fontDirs := []string{ - filepath.Join(baseDirs.dataHome, "fonts"), - filepath.Join(home, ".fonts"), - filepath.Join(home, ".local/share/fonts"), - "/usr/local/share/fonts", - "/usr/share/fonts", - } - - for _, dir := range baseDirs.data { - appDirs = append(appDirs, filepath.Join(dir, "applications")) - fontDirs = append(fontDirs, filepath.Join(dir, "fonts")) - } - - baseDirs.applications = pathutil.Unique(appDirs, Home) - baseDirs.fonts = pathutil.Unique(fontDirs, Home) -} - -func initUserDirs(home string) { - UserDirs.Desktop = xdgPath(envDesktopDir, filepath.Join(home, "Desktop")) - UserDirs.Download = xdgPath(envDownloadDir, filepath.Join(home, "Downloads")) - UserDirs.Documents = xdgPath(envDocumentsDir, filepath.Join(home, "Documents")) - UserDirs.Music = xdgPath(envMusicDir, filepath.Join(home, "Music")) - UserDirs.Pictures = xdgPath(envPicturesDir, filepath.Join(home, "Pictures")) - UserDirs.Videos = xdgPath(envVideosDir, filepath.Join(home, "Videos")) - UserDirs.Templates = xdgPath(envTemplatesDir, filepath.Join(home, "Templates")) - UserDirs.PublicShare = xdgPath(envPublicShareDir, filepath.Join(home, "Public")) -} diff --git a/vendor/github.com/adrg/xdg/paths_windows.go b/vendor/github.com/adrg/xdg/paths_windows.go deleted file mode 100644 index 722d3e78..00000000 --- a/vendor/github.com/adrg/xdg/paths_windows.go +++ /dev/null @@ -1,168 +0,0 @@ -package xdg - -import ( - "path/filepath" - - "github.com/adrg/xdg/internal/pathutil" - "golang.org/x/sys/windows" -) - -func homeDir() string { - return pathutil.KnownFolder( - windows.FOLDERID_Profile, - []string{"USERPROFILE"}, - nil, - ) -} - -func initDirs(home string) { - kf := initKnownFolders(home) - initBaseDirs(home, kf) - initUserDirs(home, kf) -} - -func initBaseDirs(home string, kf *knownFolders) { - // Initialize standard directories. - baseDirs.dataHome = xdgPath(envDataHome, kf.localAppData) - baseDirs.data = xdgPaths(envDataDirs, kf.roamingAppData, kf.programData) - baseDirs.configHome = xdgPath(envConfigHome, kf.localAppData) - baseDirs.config = xdgPaths(envConfigDirs, kf.programData, kf.roamingAppData) - baseDirs.stateHome = xdgPath(envStateHome, kf.localAppData) - baseDirs.cacheHome = xdgPath(envCacheHome, filepath.Join(kf.localAppData, "cache")) - baseDirs.runtime = xdgPath(envRuntimeDir, kf.localAppData) - - // Initialize non-standard directories. - baseDirs.applications = []string{ - kf.programs, - kf.commonPrograms, - } - baseDirs.fonts = []string{ - kf.fonts, - filepath.Join(kf.localAppData, "Microsoft", "Windows", "Fonts"), - } -} - -func initUserDirs(home string, kf *knownFolders) { - UserDirs.Desktop = xdgPath(envDesktopDir, kf.desktop) - UserDirs.Download = xdgPath(envDownloadDir, kf.downloads) - UserDirs.Documents = xdgPath(envDocumentsDir, kf.documents) - UserDirs.Music = xdgPath(envMusicDir, kf.music) - UserDirs.Pictures = xdgPath(envPicturesDir, kf.pictures) - UserDirs.Videos = xdgPath(envVideosDir, kf.videos) - UserDirs.Templates = xdgPath(envTemplatesDir, kf.templates) - UserDirs.PublicShare = xdgPath(envPublicShareDir, kf.public) -} - -type knownFolders struct { - systemDrive string - systemRoot string - programData string - userProfile string - userProfiles string - roamingAppData string - localAppData string - desktop string - downloads string - documents string - music string - pictures string - videos string - templates string - public string - fonts string - programs string - commonPrograms string -} - -func initKnownFolders(home string) *knownFolders { - kf := &knownFolders{ - userProfile: home, - } - kf.systemDrive = filepath.VolumeName(pathutil.KnownFolder( - windows.FOLDERID_Windows, - []string{"SystemDrive", "SystemRoot", "windir"}, - []string{home, `C:`}, - )) + string(filepath.Separator) - kf.systemRoot = pathutil.KnownFolder( - windows.FOLDERID_Windows, - []string{"SystemRoot", "windir"}, - []string{filepath.Join(kf.systemDrive, "Windows")}, - ) - kf.programData = pathutil.KnownFolder( - windows.FOLDERID_ProgramData, - []string{"ProgramData", "ALLUSERSPROFILE"}, - []string{filepath.Join(kf.systemDrive, "ProgramData")}, - ) - kf.userProfiles = pathutil.KnownFolder( - windows.FOLDERID_UserProfiles, - nil, - []string{filepath.Join(kf.systemDrive, "Users")}, - ) - kf.roamingAppData = pathutil.KnownFolder( - windows.FOLDERID_RoamingAppData, - []string{"APPDATA"}, - []string{filepath.Join(home, "AppData", "Roaming")}, - ) - kf.localAppData = pathutil.KnownFolder( - windows.FOLDERID_LocalAppData, - []string{"LOCALAPPDATA"}, - []string{filepath.Join(home, "AppData", "Local")}, - ) - kf.desktop = pathutil.KnownFolder( - windows.FOLDERID_Desktop, - nil, - []string{filepath.Join(home, "Desktop")}, - ) - kf.downloads = pathutil.KnownFolder( - windows.FOLDERID_Downloads, - nil, - []string{filepath.Join(home, "Downloads")}, - ) - kf.documents = pathutil.KnownFolder( - windows.FOLDERID_Documents, - nil, - []string{filepath.Join(home, "Documents")}, - ) - kf.music = pathutil.KnownFolder( - windows.FOLDERID_Music, - nil, - []string{filepath.Join(home, "Music")}, - ) - kf.pictures = pathutil.KnownFolder( - windows.FOLDERID_Pictures, - nil, - []string{filepath.Join(home, "Pictures")}, - ) - kf.videos = pathutil.KnownFolder( - windows.FOLDERID_Videos, - nil, - []string{filepath.Join(home, "Videos")}, - ) - kf.templates = pathutil.KnownFolder( - windows.FOLDERID_Templates, - nil, - []string{filepath.Join(kf.roamingAppData, "Microsoft", "Windows", "Templates")}, - ) - kf.public = pathutil.KnownFolder( - windows.FOLDERID_Public, - []string{"PUBLIC"}, - []string{filepath.Join(kf.userProfiles, "Public")}, - ) - kf.fonts = pathutil.KnownFolder( - windows.FOLDERID_Fonts, - nil, - []string{filepath.Join(kf.systemRoot, "Fonts")}, - ) - kf.programs = pathutil.KnownFolder( - windows.FOLDERID_Programs, - nil, - []string{filepath.Join(kf.roamingAppData, "Microsoft", "Windows", "Start Menu", "Programs")}, - ) - kf.commonPrograms = pathutil.KnownFolder( - windows.FOLDERID_CommonPrograms, - nil, - []string{filepath.Join(kf.programData, "Microsoft", "Windows", "Start Menu", "Programs")}, - ) - - return kf -} diff --git a/vendor/github.com/adrg/xdg/user_dirs.go b/vendor/github.com/adrg/xdg/user_dirs.go deleted file mode 100644 index 72088748..00000000 --- a/vendor/github.com/adrg/xdg/user_dirs.go +++ /dev/null @@ -1,40 +0,0 @@ -package xdg - -// XDG user directories environment variables. -const ( - envDesktopDir = "XDG_DESKTOP_DIR" - envDownloadDir = "XDG_DOWNLOAD_DIR" - envDocumentsDir = "XDG_DOCUMENTS_DIR" - envMusicDir = "XDG_MUSIC_DIR" - envPicturesDir = "XDG_PICTURES_DIR" - envVideosDir = "XDG_VIDEOS_DIR" - envTemplatesDir = "XDG_TEMPLATES_DIR" - envPublicShareDir = "XDG_PUBLICSHARE_DIR" -) - -// UserDirectories defines the locations of well known user directories. -type UserDirectories struct { - // Desktop defines the location of the user's desktop directory. - Desktop string - - // Download defines a suitable location for user downloaded files. - Download string - - // Documents defines a suitable location for user document files. - Documents string - - // Music defines a suitable location for user audio files. - Music string - - // Pictures defines a suitable location for user image files. - Pictures string - - // VideosDir defines a suitable location for user video files. - Videos string - - // Templates defines a suitable location for user template files. - Templates string - - // PublicShare defines a suitable location for user shared files. - PublicShare string -} diff --git a/vendor/github.com/adrg/xdg/xdg.go b/vendor/github.com/adrg/xdg/xdg.go deleted file mode 100644 index 3d33ca6e..00000000 --- a/vendor/github.com/adrg/xdg/xdg.go +++ /dev/null @@ -1,218 +0,0 @@ -package xdg - -import ( - "os" - "path/filepath" - - "github.com/adrg/xdg/internal/pathutil" -) - -var ( - // Home contains the path of the user's home directory. - Home string - - // DataHome defines the base directory relative to which user-specific - // data files should be stored. This directory is defined by the - // $XDG_DATA_HOME environment variable. If the variable is not set, - // a default equal to $HOME/.local/share should be used. - DataHome string - - // DataDirs defines the preference-ordered set of base directories to - // search for data files in addition to the DataHome base directory. - // This set of directories is defined by the $XDG_DATA_DIRS environment - // variable. If the variable is not set, the default directories - // to be used are /usr/local/share and /usr/share, in that order. The - // DataHome directory is considered more important than any of the - // directories defined by DataDirs. Therefore, user data files should be - // written relative to the DataHome directory, if possible. - DataDirs []string - - // ConfigHome defines the base directory relative to which user-specific - // configuration files should be written. This directory is defined by - // the $XDG_CONFIG_HOME environment variable. If the variable is not - // not set, a default equal to $HOME/.config should be used. - ConfigHome string - - // ConfigDirs defines the preference-ordered set of base directories to - // search for configuration files in addition to the ConfigHome base - // directory. This set of directories is defined by the $XDG_CONFIG_DIRS - // environment variable. If the variable is not set, a default equal - // to /etc/xdg should be used. The ConfigHome directory is considered - // more important than any of the directories defined by ConfigDirs. - // Therefore, user config files should be written relative to the - // ConfigHome directory, if possible. - ConfigDirs []string - - // StateHome defines the base directory relative to which user-specific - // state files should be stored. This directory is defined by the - // $XDG_STATE_HOME environment variable. If the variable is not set, - // a default equal to ~/.local/state should be used. - StateHome string - - // CacheHome defines the base directory relative to which user-specific - // non-essential (cached) data should be written. This directory is - // defined by the $XDG_CACHE_HOME environment variable. If the variable - // is not set, a default equal to $HOME/.cache should be used. - CacheHome string - - // RuntimeDir defines the base directory relative to which user-specific - // non-essential runtime files and other file objects (such as sockets, - // named pipes, etc.) should be stored. This directory is defined by the - // $XDG_RUNTIME_DIR environment variable. If the variable is not set, - // applications should fall back to a replacement directory with similar - // capabilities. Applications should use this directory for communication - // and synchronization purposes and should not place larger files in it, - // since it might reside in runtime memory and cannot necessarily be - // swapped out to disk. - RuntimeDir string - - // UserDirs defines the locations of well known user directories. - UserDirs UserDirectories - - // FontDirs defines the common locations where font files are stored. - FontDirs []string - - // ApplicationDirs defines the common locations of applications. - ApplicationDirs []string - - // baseDirs defines the locations of base directories. - baseDirs baseDirectories -) - -func init() { - Reload() -} - -// Reload refreshes base and user directories by reading the environment. -// Defaults are applied for XDG variables which are empty or not present -// in the environment. -func Reload() { - // Initialize home directory. - Home = homeDir() - - // Initialize base and user directories. - initDirs(Home) - - // Set standard directories. - DataHome = baseDirs.dataHome - DataDirs = baseDirs.data - ConfigHome = baseDirs.configHome - ConfigDirs = baseDirs.config - StateHome = baseDirs.stateHome - CacheHome = baseDirs.cacheHome - RuntimeDir = baseDirs.runtime - - // Set non-standard directories. - FontDirs = baseDirs.fonts - ApplicationDirs = baseDirs.applications -} - -// DataFile returns a suitable location for the specified data file. -// The relPath parameter must contain the name of the data file, and -// optionally, a set of parent directories (e.g. appname/app.data). -// If the specified directories do not exist, they will be created relative -// to the base data directory. On failure, an error containing the -// attempted paths is returned. -func DataFile(relPath string) (string, error) { - return baseDirs.dataFile(relPath) -} - -// ConfigFile returns a suitable location for the specified config file. -// The relPath parameter must contain the name of the config file, and -// optionally, a set of parent directories (e.g. appname/app.yaml). -// If the specified directories do not exist, they will be created relative -// to the base config directory. On failure, an error containing the -// attempted paths is returned. -func ConfigFile(relPath string) (string, error) { - return baseDirs.configFile(relPath) -} - -// StateFile returns a suitable location for the specified state file. State -// files are usually volatile data files, not suitable to be stored relative -// to the $XDG_DATA_HOME directory. -// The relPath parameter must contain the name of the state file, and -// optionally, a set of parent directories (e.g. appname/app.state). -// If the specified directories do not exist, they will be created relative -// to the base state directory. On failure, an error containing the -// attempted paths is returned. -func StateFile(relPath string) (string, error) { - return baseDirs.stateFile(relPath) -} - -// CacheFile returns a suitable location for the specified cache file. -// The relPath parameter must contain the name of the cache file, and -// optionally, a set of parent directories (e.g. appname/app.cache). -// If the specified directories do not exist, they will be created relative -// to the base cache directory. On failure, an error containing the -// attempted paths is returned. -func CacheFile(relPath string) (string, error) { - return baseDirs.cacheFile(relPath) -} - -// RuntimeFile returns a suitable location for the specified runtime file. -// The relPath parameter must contain the name of the runtime file, and -// optionally, a set of parent directories (e.g. appname/app.pid). -// If the specified directories do not exist, they will be created relative -// to the base runtime directory. On failure, an error containing the -// attempted paths is returned. -func RuntimeFile(relPath string) (string, error) { - return baseDirs.runtimeFile(relPath) -} - -// SearchDataFile searches for specified file in the data search paths. -// The relPath parameter must contain the name of the data file, and -// optionally, a set of parent directories (e.g. appname/app.data). If the -// file cannot be found, an error specifying the searched paths is returned. -func SearchDataFile(relPath string) (string, error) { - return baseDirs.searchDataFile(relPath) -} - -// SearchConfigFile searches for the specified file in config search paths. -// The relPath parameter must contain the name of the config file, and -// optionally, a set of parent directories (e.g. appname/app.yaml). If the -// file cannot be found, an error specifying the searched paths is returned. -func SearchConfigFile(relPath string) (string, error) { - return baseDirs.searchConfigFile(relPath) -} - -// SearchStateFile searches for the specified file in the state search path. -// The relPath parameter must contain the name of the state file, and -// optionally, a set of parent directories (e.g. appname/app.state). If the -// file cannot be found, an error specifying the searched path is returned. -func SearchStateFile(relPath string) (string, error) { - return baseDirs.searchStateFile(relPath) -} - -// SearchCacheFile searches for the specified file in the cache search path. -// The relPath parameter must contain the name of the cache file, and -// optionally, a set of parent directories (e.g. appname/app.cache). If the -// file cannot be found, an error specifying the searched path is returned. -func SearchCacheFile(relPath string) (string, error) { - return baseDirs.searchCacheFile(relPath) -} - -// SearchRuntimeFile searches for the specified file in the runtime search path. -// The relPath parameter must contain the name of the runtime file, and -// optionally, a set of parent directories (e.g. appname/app.pid). If the -// file cannot be found, an error specifying the searched path is returned. -func SearchRuntimeFile(relPath string) (string, error) { - return baseDirs.searchRuntimeFile(relPath) -} - -func xdgPath(name, defaultPath string) string { - dir := pathutil.ExpandHome(os.Getenv(name), Home) - if dir != "" && filepath.IsAbs(dir) { - return dir - } - - return defaultPath -} - -func xdgPaths(name string, defaultPaths ...string) []string { - dirs := pathutil.Unique(filepath.SplitList(os.Getenv(name)), Home) - if len(dirs) != 0 { - return dirs - } - - return pathutil.Unique(defaultPaths, Home) -} diff --git a/vendor/github.com/go-logr/logr/.golangci.yaml b/vendor/github.com/go-logr/logr/.golangci.yaml deleted file mode 100644 index 0cffafa7..00000000 --- a/vendor/github.com/go-logr/logr/.golangci.yaml +++ /dev/null @@ -1,26 +0,0 @@ -run: - timeout: 1m - tests: true - -linters: - disable-all: true - enable: - - asciicheck - - errcheck - - forcetypeassert - - gocritic - - gofmt - - goimports - - gosimple - - govet - - ineffassign - - misspell - - revive - - staticcheck - - typecheck - - unused - -issues: - exclude-use-default: false - max-issues-per-linter: 0 - max-same-issues: 10 diff --git a/vendor/github.com/go-logr/logr/CHANGELOG.md b/vendor/github.com/go-logr/logr/CHANGELOG.md deleted file mode 100644 index c3569600..00000000 --- a/vendor/github.com/go-logr/logr/CHANGELOG.md +++ /dev/null @@ -1,6 +0,0 @@ -# CHANGELOG - -## v1.0.0-rc1 - -This is the first logged release. Major changes (including breaking changes) -have occurred since earlier tags. diff --git a/vendor/github.com/go-logr/logr/CONTRIBUTING.md b/vendor/github.com/go-logr/logr/CONTRIBUTING.md deleted file mode 100644 index 5d37e294..00000000 --- a/vendor/github.com/go-logr/logr/CONTRIBUTING.md +++ /dev/null @@ -1,17 +0,0 @@ -# Contributing - -Logr is open to pull-requests, provided they fit within the intended scope of -the project. Specifically, this library aims to be VERY small and minimalist, -with no external dependencies. - -## Compatibility - -This project intends to follow [semantic versioning](http://semver.org) and -is very strict about compatibility. Any proposed changes MUST follow those -rules. - -## Performance - -As a logging library, logr must be as light-weight as possible. Any proposed -code change must include results of running the [benchmark](./benchmark) -before and after the change. diff --git a/vendor/github.com/go-logr/logr/LICENSE b/vendor/github.com/go-logr/logr/LICENSE deleted file mode 100644 index 8dada3ed..00000000 --- a/vendor/github.com/go-logr/logr/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - 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. diff --git a/vendor/github.com/go-logr/logr/README.md b/vendor/github.com/go-logr/logr/README.md deleted file mode 100644 index 8969526a..00000000 --- a/vendor/github.com/go-logr/logr/README.md +++ /dev/null @@ -1,406 +0,0 @@ -# A minimal logging API for Go - -[![Go Reference](https://pkg.go.dev/badge/github.com/go-logr/logr.svg)](https://pkg.go.dev/github.com/go-logr/logr) -[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/go-logr/logr/badge)](https://securityscorecards.dev/viewer/?platform=github.com&org=go-logr&repo=logr) - -logr offers an(other) opinion on how Go programs and libraries can do logging -without becoming coupled to a particular logging implementation. This is not -an implementation of logging - it is an API. In fact it is two APIs with two -different sets of users. - -The `Logger` type is intended for application and library authors. It provides -a relatively small API which can be used everywhere you want to emit logs. It -defers the actual act of writing logs (to files, to stdout, or whatever) to the -`LogSink` interface. - -The `LogSink` interface is intended for logging library implementers. It is a -pure interface which can be implemented by logging frameworks to provide the actual logging -functionality. - -This decoupling allows application and library developers to write code in -terms of `logr.Logger` (which has very low dependency fan-out) while the -implementation of logging is managed "up stack" (e.g. in or near `main()`.) -Application developers can then switch out implementations as necessary. - -Many people assert that libraries should not be logging, and as such efforts -like this are pointless. Those people are welcome to convince the authors of -the tens-of-thousands of libraries that *DO* write logs that they are all -wrong. In the meantime, logr takes a more practical approach. - -## Typical usage - -Somewhere, early in an application's life, it will make a decision about which -logging library (implementation) it actually wants to use. Something like: - -``` - func main() { - // ... other setup code ... - - // Create the "root" logger. We have chosen the "logimpl" implementation, - // which takes some initial parameters and returns a logr.Logger. - logger := logimpl.New(param1, param2) - - // ... other setup code ... -``` - -Most apps will call into other libraries, create structures to govern the flow, -etc. The `logr.Logger` object can be passed to these other libraries, stored -in structs, or even used as a package-global variable, if needed. For example: - -``` - app := createTheAppObject(logger) - app.Run() -``` - -Outside of this early setup, no other packages need to know about the choice of -implementation. They write logs in terms of the `logr.Logger` that they -received: - -``` - type appObject struct { - // ... other fields ... - logger logr.Logger - // ... other fields ... - } - - func (app *appObject) Run() { - app.logger.Info("starting up", "timestamp", time.Now()) - - // ... app code ... -``` - -## Background - -If the Go standard library had defined an interface for logging, this project -probably would not be needed. Alas, here we are. - -When the Go developers started developing such an interface with -[slog](https://github.com/golang/go/issues/56345), they adopted some of the -logr design but also left out some parts and changed others: - -| Feature | logr | slog | -|---------|------|------| -| High-level API | `Logger` (passed by value) | `Logger` (passed by [pointer](https://github.com/golang/go/issues/59126)) | -| Low-level API | `LogSink` | `Handler` | -| Stack unwinding | done by `LogSink` | done by `Logger` | -| Skipping helper functions | `WithCallDepth`, `WithCallStackHelper` | [not supported by Logger](https://github.com/golang/go/issues/59145) | -| Generating a value for logging on demand | `Marshaler` | `LogValuer` | -| Log levels | >= 0, higher meaning "less important" | positive and negative, with 0 for "info" and higher meaning "more important" | -| Error log entries | always logged, don't have a verbosity level | normal log entries with level >= `LevelError` | -| Passing logger via context | `NewContext`, `FromContext` | no API | -| Adding a name to a logger | `WithName` | no API | -| Modify verbosity of log entries in a call chain | `V` | no API | -| Grouping of key/value pairs | not supported | `WithGroup`, `GroupValue` | -| Pass context for extracting additional values | no API | API variants like `InfoCtx` | - -The high-level slog API is explicitly meant to be one of many different APIs -that can be layered on top of a shared `slog.Handler`. logr is one such -alternative API, with [interoperability](#slog-interoperability) provided by -some conversion functions. - -### Inspiration - -Before you consider this package, please read [this blog post by the -inimitable Dave Cheney][warning-makes-no-sense]. We really appreciate what -he has to say, and it largely aligns with our own experiences. - -### Differences from Dave's ideas - -The main differences are: - -1. Dave basically proposes doing away with the notion of a logging API in favor -of `fmt.Printf()`. We disagree, especially when you consider things like output -locations, timestamps, file and line decorations, and structured logging. This -package restricts the logging API to just 2 types of logs: info and error. - -Info logs are things you want to tell the user which are not errors. Error -logs are, well, errors. If your code receives an `error` from a subordinate -function call and is logging that `error` *and not returning it*, use error -logs. - -2. Verbosity-levels on info logs. This gives developers a chance to indicate -arbitrary grades of importance for info logs, without assigning names with -semantic meaning such as "warning", "trace", and "debug." Superficially this -may feel very similar, but the primary difference is the lack of semantics. -Because verbosity is a numerical value, it's safe to assume that an app running -with higher verbosity means more (and less important) logs will be generated. - -## Implementations (non-exhaustive) - -There are implementations for the following logging libraries: - -- **a function** (can bridge to non-structured libraries): [funcr](https://github.com/go-logr/logr/tree/master/funcr) -- **a testing.T** (for use in Go tests, with JSON-like output): [testr](https://github.com/go-logr/logr/tree/master/testr) -- **github.com/google/glog**: [glogr](https://github.com/go-logr/glogr) -- **k8s.io/klog** (for Kubernetes): [klogr](https://git.k8s.io/klog/klogr) -- **a testing.T** (with klog-like text output): [ktesting](https://git.k8s.io/klog/ktesting) -- **go.uber.org/zap**: [zapr](https://github.com/go-logr/zapr) -- **log** (the Go standard library logger): [stdr](https://github.com/go-logr/stdr) -- **github.com/sirupsen/logrus**: [logrusr](https://github.com/bombsimon/logrusr) -- **github.com/wojas/genericr**: [genericr](https://github.com/wojas/genericr) (makes it easy to implement your own backend) -- **logfmt** (Heroku style [logging](https://www.brandur.org/logfmt)): [logfmtr](https://github.com/iand/logfmtr) -- **github.com/rs/zerolog**: [zerologr](https://github.com/go-logr/zerologr) -- **github.com/go-kit/log**: [gokitlogr](https://github.com/tonglil/gokitlogr) (also compatible with github.com/go-kit/kit/log since v0.12.0) -- **bytes.Buffer** (writing to a buffer): [bufrlogr](https://github.com/tonglil/buflogr) (useful for ensuring values were logged, like during testing) - -## slog interoperability - -Interoperability goes both ways, using the `logr.Logger` API with a `slog.Handler` -and using the `slog.Logger` API with a `logr.LogSink`. `FromSlogHandler` and -`ToSlogHandler` convert between a `logr.Logger` and a `slog.Handler`. -As usual, `slog.New` can be used to wrap such a `slog.Handler` in the high-level -slog API. - -### Using a `logr.LogSink` as backend for slog - -Ideally, a logr sink implementation should support both logr and slog by -implementing both the normal logr interface(s) and `SlogSink`. Because -of a conflict in the parameters of the common `Enabled` method, it is [not -possible to implement both slog.Handler and logr.Sink in the same -type](https://github.com/golang/go/issues/59110). - -If both are supported, log calls can go from the high-level APIs to the backend -without the need to convert parameters. `FromSlogHandler` and `ToSlogHandler` can -convert back and forth without adding additional wrappers, with one exception: -when `Logger.V` was used to adjust the verbosity for a `slog.Handler`, then -`ToSlogHandler` has to use a wrapper which adjusts the verbosity for future -log calls. - -Such an implementation should also support values that implement specific -interfaces from both packages for logging (`logr.Marshaler`, `slog.LogValuer`, -`slog.GroupValue`). logr does not convert those. - -Not supporting slog has several drawbacks: -- Recording source code locations works correctly if the handler gets called - through `slog.Logger`, but may be wrong in other cases. That's because a - `logr.Sink` does its own stack unwinding instead of using the program counter - provided by the high-level API. -- slog levels <= 0 can be mapped to logr levels by negating the level without a - loss of information. But all slog levels > 0 (e.g. `slog.LevelWarning` as - used by `slog.Logger.Warn`) must be mapped to 0 before calling the sink - because logr does not support "more important than info" levels. -- The slog group concept is supported by prefixing each key in a key/value - pair with the group names, separated by a dot. For structured output like - JSON it would be better to group the key/value pairs inside an object. -- Special slog values and interfaces don't work as expected. -- The overhead is likely to be higher. - -These drawbacks are severe enough that applications using a mixture of slog and -logr should switch to a different backend. - -### Using a `slog.Handler` as backend for logr - -Using a plain `slog.Handler` without support for logr works better than the -other direction: -- All logr verbosity levels can be mapped 1:1 to their corresponding slog level - by negating them. -- Stack unwinding is done by the `SlogSink` and the resulting program - counter is passed to the `slog.Handler`. -- Names added via `Logger.WithName` are gathered and recorded in an additional - attribute with `logger` as key and the names separated by slash as value. -- `Logger.Error` is turned into a log record with `slog.LevelError` as level - and an additional attribute with `err` as key, if an error was provided. - -The main drawback is that `logr.Marshaler` will not be supported. Types should -ideally support both `logr.Marshaler` and `slog.Valuer`. If compatibility -with logr implementations without slog support is not important, then -`slog.Valuer` is sufficient. - -### Context support for slog - -Storing a logger in a `context.Context` is not supported by -slog. `NewContextWithSlogLogger` and `FromContextAsSlogLogger` can be -used to fill this gap. They store and retrieve a `slog.Logger` pointer -under the same context key that is also used by `NewContext` and -`FromContext` for `logr.Logger` value. - -When `NewContextWithSlogLogger` is followed by `FromContext`, the latter will -automatically convert the `slog.Logger` to a -`logr.Logger`. `FromContextAsSlogLogger` does the same for the other direction. - -With this approach, binaries which use either slog or logr are as efficient as -possible with no unnecessary allocations. This is also why the API stores a -`slog.Logger` pointer: when storing a `slog.Handler`, creating a `slog.Logger` -on retrieval would need to allocate one. - -The downside is that switching back and forth needs more allocations. Because -logr is the API that is already in use by different packages, in particular -Kubernetes, the recommendation is to use the `logr.Logger` API in code which -uses contextual logging. - -An alternative to adding values to a logger and storing that logger in the -context is to store the values in the context and to configure a logging -backend to extract those values when emitting log entries. This only works when -log calls are passed the context, which is not supported by the logr API. - -With the slog API, it is possible, but not -required. https://github.com/veqryn/slog-context is a package for slog which -provides additional support code for this approach. It also contains wrappers -for the context functions in logr, so developers who prefer to not use the logr -APIs directly can use those instead and the resulting code will still be -interoperable with logr. - -## FAQ - -### Conceptual - -#### Why structured logging? - -- **Structured logs are more easily queryable**: Since you've got - key-value pairs, it's much easier to query your structured logs for - particular values by filtering on the contents of a particular key -- - think searching request logs for error codes, Kubernetes reconcilers for - the name and namespace of the reconciled object, etc. - -- **Structured logging makes it easier to have cross-referenceable logs**: - Similarly to searchability, if you maintain conventions around your - keys, it becomes easy to gather all log lines related to a particular - concept. - -- **Structured logs allow better dimensions of filtering**: if you have - structure to your logs, you've got more precise control over how much - information is logged -- you might choose in a particular configuration - to log certain keys but not others, only log lines where a certain key - matches a certain value, etc., instead of just having v-levels and names - to key off of. - -- **Structured logs better represent structured data**: sometimes, the - data that you want to log is inherently structured (think tuple-link - objects.) Structured logs allow you to preserve that structure when - outputting. - -#### Why V-levels? - -**V-levels give operators an easy way to control the chattiness of log -operations**. V-levels provide a way for a given package to distinguish -the relative importance or verbosity of a given log message. Then, if -a particular logger or package is logging too many messages, the user -of the package can simply change the v-levels for that library. - -#### Why not named levels, like Info/Warning/Error? - -Read [Dave Cheney's post][warning-makes-no-sense]. Then read [Differences -from Dave's ideas](#differences-from-daves-ideas). - -#### Why not allow format strings, too? - -**Format strings negate many of the benefits of structured logs**: - -- They're not easily searchable without resorting to fuzzy searching, - regular expressions, etc. - -- They don't store structured data well, since contents are flattened into - a string. - -- They're not cross-referenceable. - -- They don't compress easily, since the message is not constant. - -(Unless you turn positional parameters into key-value pairs with numerical -keys, at which point you've gotten key-value logging with meaningless -keys.) - -### Practical - -#### Why key-value pairs, and not a map? - -Key-value pairs are *much* easier to optimize, especially around -allocations. Zap (a structured logger that inspired logr's interface) has -[performance measurements](https://github.com/uber-go/zap#performance) -that show this quite nicely. - -While the interface ends up being a little less obvious, you get -potentially better performance, plus avoid making users type -`map[string]string{}` every time they want to log. - -#### What if my V-levels differ between libraries? - -That's fine. Control your V-levels on a per-logger basis, and use the -`WithName` method to pass different loggers to different libraries. - -Generally, you should take care to ensure that you have relatively -consistent V-levels within a given logger, however, as this makes deciding -on what verbosity of logs to request easier. - -#### But I really want to use a format string! - -That's not actually a question. Assuming your question is "how do -I convert my mental model of logging with format strings to logging with -constant messages": - -1. Figure out what the error actually is, as you'd write in a TL;DR style, - and use that as a message. - -2. For every place you'd write a format specifier, look to the word before - it, and add that as a key value pair. - -For instance, consider the following examples (all taken from spots in the -Kubernetes codebase): - -- `klog.V(4).Infof("Client is returning errors: code %v, error %v", - responseCode, err)` becomes `logger.Error(err, "client returned an - error", "code", responseCode)` - -- `klog.V(4).Infof("Got a Retry-After %ds response for attempt %d to %v", - seconds, retries, url)` becomes `logger.V(4).Info("got a retry-after - response when requesting url", "attempt", retries, "after - seconds", seconds, "url", url)` - -If you *really* must use a format string, use it in a key's value, and -call `fmt.Sprintf` yourself. For instance: `log.Printf("unable to -reflect over type %T")` becomes `logger.Info("unable to reflect over -type", "type", fmt.Sprintf("%T"))`. In general though, the cases where -this is necessary should be few and far between. - -#### How do I choose my V-levels? - -This is basically the only hard constraint: increase V-levels to denote -more verbose or more debug-y logs. - -Otherwise, you can start out with `0` as "you always want to see this", -`1` as "common logging that you might *possibly* want to turn off", and -`10` as "I would like to performance-test your log collection stack." - -Then gradually choose levels in between as you need them, working your way -down from 10 (for debug and trace style logs) and up from 1 (for chattier -info-type logs). For reference, slog pre-defines -4 for debug logs -(corresponds to 4 in logr), which matches what is -[recommended for Kubernetes](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md#what-method-to-use). - -#### How do I choose my keys? - -Keys are fairly flexible, and can hold more or less any string -value. For best compatibility with implementations and consistency -with existing code in other projects, there are a few conventions you -should consider. - -- Make your keys human-readable. -- Constant keys are generally a good idea. -- Be consistent across your codebase. -- Keys should naturally match parts of the message string. -- Use lower case for simple keys and - [lowerCamelCase](https://en.wiktionary.org/wiki/lowerCamelCase) for - more complex ones. Kubernetes is one example of a project that has - [adopted that - convention](https://github.com/kubernetes/community/blob/HEAD/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#name-arguments). - -While key names are mostly unrestricted (and spaces are acceptable), -it's generally a good idea to stick to printable ascii characters, or at -least match the general character set of your log lines. - -#### Why should keys be constant values? - -The point of structured logging is to make later log processing easier. Your -keys are, effectively, the schema of each log message. If you use different -keys across instances of the same log line, you will make your structured logs -much harder to use. `Sprintf()` is for values, not for keys! - -#### Why is this not a pure interface? - -The Logger type is implemented as a struct in order to allow the Go compiler to -optimize things like high-V `Info` logs that are not triggered. Not all of -these implementations are implemented yet, but this structure was suggested as -a way to ensure they *can* be implemented. All of the real work is behind the -`LogSink` interface. - -[warning-makes-no-sense]: http://dave.cheney.net/2015/11/05/lets-talk-about-logging diff --git a/vendor/github.com/go-logr/logr/SECURITY.md b/vendor/github.com/go-logr/logr/SECURITY.md deleted file mode 100644 index 1ca756fc..00000000 --- a/vendor/github.com/go-logr/logr/SECURITY.md +++ /dev/null @@ -1,18 +0,0 @@ -# Security Policy - -If you have discovered a security vulnerability in this project, please report it -privately. **Do not disclose it as a public issue.** This gives us time to work with you -to fix the issue before public exposure, reducing the chance that the exploit will be -used before a patch is released. - -You may submit the report in the following ways: - -- send an email to go-logr-security@googlegroups.com -- send us a [private vulnerability report](https://github.com/go-logr/logr/security/advisories/new) - -Please provide the following information in your report: - -- A description of the vulnerability and its impact -- How to reproduce the issue - -We ask that you give us 90 days to work on a fix before public exposure. diff --git a/vendor/github.com/go-logr/logr/context.go b/vendor/github.com/go-logr/logr/context.go deleted file mode 100644 index de8bcc3a..00000000 --- a/vendor/github.com/go-logr/logr/context.go +++ /dev/null @@ -1,33 +0,0 @@ -/* -Copyright 2023 The logr Authors. - -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. -*/ - -package logr - -// contextKey is how we find Loggers in a context.Context. With Go < 1.21, -// the value is always a Logger value. With Go >= 1.21, the value can be a -// Logger value or a slog.Logger pointer. -type contextKey struct{} - -// notFoundError exists to carry an IsNotFound method. -type notFoundError struct{} - -func (notFoundError) Error() string { - return "no logr.Logger was present" -} - -func (notFoundError) IsNotFound() bool { - return true -} diff --git a/vendor/github.com/go-logr/logr/context_noslog.go b/vendor/github.com/go-logr/logr/context_noslog.go deleted file mode 100644 index f012f9a1..00000000 --- a/vendor/github.com/go-logr/logr/context_noslog.go +++ /dev/null @@ -1,49 +0,0 @@ -//go:build !go1.21 -// +build !go1.21 - -/* -Copyright 2019 The logr Authors. - -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. -*/ - -package logr - -import ( - "context" -) - -// FromContext returns a Logger from ctx or an error if no Logger is found. -func FromContext(ctx context.Context) (Logger, error) { - if v, ok := ctx.Value(contextKey{}).(Logger); ok { - return v, nil - } - - return Logger{}, notFoundError{} -} - -// FromContextOrDiscard returns a Logger from ctx. If no Logger is found, this -// returns a Logger that discards all log messages. -func FromContextOrDiscard(ctx context.Context) Logger { - if v, ok := ctx.Value(contextKey{}).(Logger); ok { - return v - } - - return Discard() -} - -// NewContext returns a new Context, derived from ctx, which carries the -// provided Logger. -func NewContext(ctx context.Context, logger Logger) context.Context { - return context.WithValue(ctx, contextKey{}, logger) -} diff --git a/vendor/github.com/go-logr/logr/context_slog.go b/vendor/github.com/go-logr/logr/context_slog.go deleted file mode 100644 index 065ef0b8..00000000 --- a/vendor/github.com/go-logr/logr/context_slog.go +++ /dev/null @@ -1,83 +0,0 @@ -//go:build go1.21 -// +build go1.21 - -/* -Copyright 2019 The logr Authors. - -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. -*/ - -package logr - -import ( - "context" - "fmt" - "log/slog" -) - -// FromContext returns a Logger from ctx or an error if no Logger is found. -func FromContext(ctx context.Context) (Logger, error) { - v := ctx.Value(contextKey{}) - if v == nil { - return Logger{}, notFoundError{} - } - - switch v := v.(type) { - case Logger: - return v, nil - case *slog.Logger: - return FromSlogHandler(v.Handler()), nil - default: - // Not reached. - panic(fmt.Sprintf("unexpected value type for logr context key: %T", v)) - } -} - -// FromContextAsSlogLogger returns a slog.Logger from ctx or nil if no such Logger is found. -func FromContextAsSlogLogger(ctx context.Context) *slog.Logger { - v := ctx.Value(contextKey{}) - if v == nil { - return nil - } - - switch v := v.(type) { - case Logger: - return slog.New(ToSlogHandler(v)) - case *slog.Logger: - return v - default: - // Not reached. - panic(fmt.Sprintf("unexpected value type for logr context key: %T", v)) - } -} - -// FromContextOrDiscard returns a Logger from ctx. If no Logger is found, this -// returns a Logger that discards all log messages. -func FromContextOrDiscard(ctx context.Context) Logger { - if logger, err := FromContext(ctx); err == nil { - return logger - } - return Discard() -} - -// NewContext returns a new Context, derived from ctx, which carries the -// provided Logger. -func NewContext(ctx context.Context, logger Logger) context.Context { - return context.WithValue(ctx, contextKey{}, logger) -} - -// NewContextWithSlogLogger returns a new Context, derived from ctx, which carries the -// provided slog.Logger. -func NewContextWithSlogLogger(ctx context.Context, logger *slog.Logger) context.Context { - return context.WithValue(ctx, contextKey{}, logger) -} diff --git a/vendor/github.com/go-logr/logr/discard.go b/vendor/github.com/go-logr/logr/discard.go deleted file mode 100644 index 99fe8be9..00000000 --- a/vendor/github.com/go-logr/logr/discard.go +++ /dev/null @@ -1,24 +0,0 @@ -/* -Copyright 2020 The logr Authors. - -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. -*/ - -package logr - -// Discard returns a Logger that discards all messages logged to it. It can be -// used whenever the caller is not interested in the logs. Logger instances -// produced by this function always compare as equal. -func Discard() Logger { - return New(nil) -} diff --git a/vendor/github.com/go-logr/logr/funcr/funcr.go b/vendor/github.com/go-logr/logr/funcr/funcr.go deleted file mode 100644 index fb2f866f..00000000 --- a/vendor/github.com/go-logr/logr/funcr/funcr.go +++ /dev/null @@ -1,911 +0,0 @@ -/* -Copyright 2021 The logr Authors. - -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. -*/ - -// Package funcr implements formatting of structured log messages and -// optionally captures the call site and timestamp. -// -// The simplest way to use it is via its implementation of a -// github.com/go-logr/logr.LogSink with output through an arbitrary -// "write" function. See New and NewJSON for details. -// -// # Custom LogSinks -// -// For users who need more control, a funcr.Formatter can be embedded inside -// your own custom LogSink implementation. This is useful when the LogSink -// needs to implement additional methods, for example. -// -// # Formatting -// -// This will respect logr.Marshaler, fmt.Stringer, and error interfaces for -// values which are being logged. When rendering a struct, funcr will use Go's -// standard JSON tags (all except "string"). -package funcr - -import ( - "bytes" - "encoding" - "encoding/json" - "fmt" - "path/filepath" - "reflect" - "runtime" - "strconv" - "strings" - "time" - - "github.com/go-logr/logr" -) - -// New returns a logr.Logger which is implemented by an arbitrary function. -func New(fn func(prefix, args string), opts Options) logr.Logger { - return logr.New(newSink(fn, NewFormatter(opts))) -} - -// NewJSON returns a logr.Logger which is implemented by an arbitrary function -// and produces JSON output. -func NewJSON(fn func(obj string), opts Options) logr.Logger { - fnWrapper := func(_, obj string) { - fn(obj) - } - return logr.New(newSink(fnWrapper, NewFormatterJSON(opts))) -} - -// Underlier exposes access to the underlying logging function. Since -// callers only have a logr.Logger, they have to know which -// implementation is in use, so this interface is less of an -// abstraction and more of a way to test type conversion. -type Underlier interface { - GetUnderlying() func(prefix, args string) -} - -func newSink(fn func(prefix, args string), formatter Formatter) logr.LogSink { - l := &fnlogger{ - Formatter: formatter, - write: fn, - } - // For skipping fnlogger.Info and fnlogger.Error. - l.Formatter.AddCallDepth(1) - return l -} - -// Options carries parameters which influence the way logs are generated. -type Options struct { - // LogCaller tells funcr to add a "caller" key to some or all log lines. - // This has some overhead, so some users might not want it. - LogCaller MessageClass - - // LogCallerFunc tells funcr to also log the calling function name. This - // has no effect if caller logging is not enabled (see Options.LogCaller). - LogCallerFunc bool - - // LogTimestamp tells funcr to add a "ts" key to log lines. This has some - // overhead, so some users might not want it. - LogTimestamp bool - - // TimestampFormat tells funcr how to render timestamps when LogTimestamp - // is enabled. If not specified, a default format will be used. For more - // details, see docs for Go's time.Layout. - TimestampFormat string - - // LogInfoLevel tells funcr what key to use to log the info level. - // If not specified, the info level will be logged as "level". - // If this is set to "", the info level will not be logged at all. - LogInfoLevel *string - - // Verbosity tells funcr which V logs to produce. Higher values enable - // more logs. Info logs at or below this level will be written, while logs - // above this level will be discarded. - Verbosity int - - // RenderBuiltinsHook allows users to mutate the list of key-value pairs - // while a log line is being rendered. The kvList argument follows logr - // conventions - each pair of slice elements is comprised of a string key - // and an arbitrary value (verified and sanitized before calling this - // hook). The value returned must follow the same conventions. This hook - // can be used to audit or modify logged data. For example, you might want - // to prefix all of funcr's built-in keys with some string. This hook is - // only called for built-in (provided by funcr itself) key-value pairs. - // Equivalent hooks are offered for key-value pairs saved via - // logr.Logger.WithValues or Formatter.AddValues (see RenderValuesHook) and - // for user-provided pairs (see RenderArgsHook). - RenderBuiltinsHook func(kvList []any) []any - - // RenderValuesHook is the same as RenderBuiltinsHook, except that it is - // only called for key-value pairs saved via logr.Logger.WithValues. See - // RenderBuiltinsHook for more details. - RenderValuesHook func(kvList []any) []any - - // RenderArgsHook is the same as RenderBuiltinsHook, except that it is only - // called for key-value pairs passed directly to Info and Error. See - // RenderBuiltinsHook for more details. - RenderArgsHook func(kvList []any) []any - - // MaxLogDepth tells funcr how many levels of nested fields (e.g. a struct - // that contains a struct, etc.) it may log. Every time it finds a struct, - // slice, array, or map the depth is increased by one. When the maximum is - // reached, the value will be converted to a string indicating that the max - // depth has been exceeded. If this field is not specified, a default - // value will be used. - MaxLogDepth int -} - -// MessageClass indicates which category or categories of messages to consider. -type MessageClass int - -const ( - // None ignores all message classes. - None MessageClass = iota - // All considers all message classes. - All - // Info only considers info messages. - Info - // Error only considers error messages. - Error -) - -// fnlogger inherits some of its LogSink implementation from Formatter -// and just needs to add some glue code. -type fnlogger struct { - Formatter - write func(prefix, args string) -} - -func (l fnlogger) WithName(name string) logr.LogSink { - l.Formatter.AddName(name) - return &l -} - -func (l fnlogger) WithValues(kvList ...any) logr.LogSink { - l.Formatter.AddValues(kvList) - return &l -} - -func (l fnlogger) WithCallDepth(depth int) logr.LogSink { - l.Formatter.AddCallDepth(depth) - return &l -} - -func (l fnlogger) Info(level int, msg string, kvList ...any) { - prefix, args := l.FormatInfo(level, msg, kvList) - l.write(prefix, args) -} - -func (l fnlogger) Error(err error, msg string, kvList ...any) { - prefix, args := l.FormatError(err, msg, kvList) - l.write(prefix, args) -} - -func (l fnlogger) GetUnderlying() func(prefix, args string) { - return l.write -} - -// Assert conformance to the interfaces. -var _ logr.LogSink = &fnlogger{} -var _ logr.CallDepthLogSink = &fnlogger{} -var _ Underlier = &fnlogger{} - -// NewFormatter constructs a Formatter which emits a JSON-like key=value format. -func NewFormatter(opts Options) Formatter { - return newFormatter(opts, outputKeyValue) -} - -// NewFormatterJSON constructs a Formatter which emits strict JSON. -func NewFormatterJSON(opts Options) Formatter { - return newFormatter(opts, outputJSON) -} - -// Defaults for Options. -const defaultTimestampFormat = "2006-01-02 15:04:05.000000" -const defaultMaxLogDepth = 16 - -func newFormatter(opts Options, outfmt outputFormat) Formatter { - if opts.TimestampFormat == "" { - opts.TimestampFormat = defaultTimestampFormat - } - if opts.MaxLogDepth == 0 { - opts.MaxLogDepth = defaultMaxLogDepth - } - if opts.LogInfoLevel == nil { - opts.LogInfoLevel = new(string) - *opts.LogInfoLevel = "level" - } - f := Formatter{ - outputFormat: outfmt, - prefix: "", - values: nil, - depth: 0, - opts: &opts, - } - return f -} - -// Formatter is an opaque struct which can be embedded in a LogSink -// implementation. It should be constructed with NewFormatter. Some of -// its methods directly implement logr.LogSink. -type Formatter struct { - outputFormat outputFormat - prefix string - values []any - valuesStr string - parentValuesStr string - depth int - opts *Options - group string // for slog groups - groupDepth int -} - -// outputFormat indicates which outputFormat to use. -type outputFormat int - -const ( - // outputKeyValue emits a JSON-like key=value format, but not strict JSON. - outputKeyValue outputFormat = iota - // outputJSON emits strict JSON. - outputJSON -) - -// PseudoStruct is a list of key-value pairs that gets logged as a struct. -type PseudoStruct []any - -// render produces a log line, ready to use. -func (f Formatter) render(builtins, args []any) string { - // Empirically bytes.Buffer is faster than strings.Builder for this. - buf := bytes.NewBuffer(make([]byte, 0, 1024)) - if f.outputFormat == outputJSON { - buf.WriteByte('{') // for the whole line - } - - vals := builtins - if hook := f.opts.RenderBuiltinsHook; hook != nil { - vals = hook(f.sanitize(vals)) - } - f.flatten(buf, vals, false, false) // keys are ours, no need to escape - continuing := len(builtins) > 0 - - if f.parentValuesStr != "" { - if continuing { - buf.WriteByte(f.comma()) - } - buf.WriteString(f.parentValuesStr) - continuing = true - } - - groupDepth := f.groupDepth - if f.group != "" { - if f.valuesStr != "" || len(args) != 0 { - if continuing { - buf.WriteByte(f.comma()) - } - buf.WriteString(f.quoted(f.group, true)) // escape user-provided keys - buf.WriteByte(f.colon()) - buf.WriteByte('{') // for the group - continuing = false - } else { - // The group was empty - groupDepth-- - } - } - - if f.valuesStr != "" { - if continuing { - buf.WriteByte(f.comma()) - } - buf.WriteString(f.valuesStr) - continuing = true - } - - vals = args - if hook := f.opts.RenderArgsHook; hook != nil { - vals = hook(f.sanitize(vals)) - } - f.flatten(buf, vals, continuing, true) // escape user-provided keys - - for i := 0; i < groupDepth; i++ { - buf.WriteByte('}') // for the groups - } - - if f.outputFormat == outputJSON { - buf.WriteByte('}') // for the whole line - } - - return buf.String() -} - -// flatten renders a list of key-value pairs into a buffer. If continuing is -// true, it assumes that the buffer has previous values and will emit a -// separator (which depends on the output format) before the first pair it -// writes. If escapeKeys is true, the keys are assumed to have -// non-JSON-compatible characters in them and must be evaluated for escapes. -// -// This function returns a potentially modified version of kvList, which -// ensures that there is a value for every key (adding a value if needed) and -// that each key is a string (substituting a key if needed). -func (f Formatter) flatten(buf *bytes.Buffer, kvList []any, continuing bool, escapeKeys bool) []any { - // This logic overlaps with sanitize() but saves one type-cast per key, - // which can be measurable. - if len(kvList)%2 != 0 { - kvList = append(kvList, noValue) - } - copied := false - for i := 0; i < len(kvList); i += 2 { - k, ok := kvList[i].(string) - if !ok { - if !copied { - newList := make([]any, len(kvList)) - copy(newList, kvList) - kvList = newList - copied = true - } - k = f.nonStringKey(kvList[i]) - kvList[i] = k - } - v := kvList[i+1] - - if i > 0 || continuing { - if f.outputFormat == outputJSON { - buf.WriteByte(f.comma()) - } else { - // In theory the format could be something we don't understand. In - // practice, we control it, so it won't be. - buf.WriteByte(' ') - } - } - - buf.WriteString(f.quoted(k, escapeKeys)) - buf.WriteByte(f.colon()) - buf.WriteString(f.pretty(v)) - } - return kvList -} - -func (f Formatter) quoted(str string, escape bool) string { - if escape { - return prettyString(str) - } - // this is faster - return `"` + str + `"` -} - -func (f Formatter) comma() byte { - if f.outputFormat == outputJSON { - return ',' - } - return ' ' -} - -func (f Formatter) colon() byte { - if f.outputFormat == outputJSON { - return ':' - } - return '=' -} - -func (f Formatter) pretty(value any) string { - return f.prettyWithFlags(value, 0, 0) -} - -const ( - flagRawStruct = 0x1 // do not print braces on structs -) - -// TODO: This is not fast. Most of the overhead goes here. -func (f Formatter) prettyWithFlags(value any, flags uint32, depth int) string { - if depth > f.opts.MaxLogDepth { - return `""` - } - - // Handle types that take full control of logging. - if v, ok := value.(logr.Marshaler); ok { - // Replace the value with what the type wants to get logged. - // That then gets handled below via reflection. - value = invokeMarshaler(v) - } - - // Handle types that want to format themselves. - switch v := value.(type) { - case fmt.Stringer: - value = invokeStringer(v) - case error: - value = invokeError(v) - } - - // Handling the most common types without reflect is a small perf win. - switch v := value.(type) { - case bool: - return strconv.FormatBool(v) - case string: - return prettyString(v) - case int: - return strconv.FormatInt(int64(v), 10) - case int8: - return strconv.FormatInt(int64(v), 10) - case int16: - return strconv.FormatInt(int64(v), 10) - case int32: - return strconv.FormatInt(int64(v), 10) - case int64: - return strconv.FormatInt(int64(v), 10) - case uint: - return strconv.FormatUint(uint64(v), 10) - case uint8: - return strconv.FormatUint(uint64(v), 10) - case uint16: - return strconv.FormatUint(uint64(v), 10) - case uint32: - return strconv.FormatUint(uint64(v), 10) - case uint64: - return strconv.FormatUint(v, 10) - case uintptr: - return strconv.FormatUint(uint64(v), 10) - case float32: - return strconv.FormatFloat(float64(v), 'f', -1, 32) - case float64: - return strconv.FormatFloat(v, 'f', -1, 64) - case complex64: - return `"` + strconv.FormatComplex(complex128(v), 'f', -1, 64) + `"` - case complex128: - return `"` + strconv.FormatComplex(v, 'f', -1, 128) + `"` - case PseudoStruct: - buf := bytes.NewBuffer(make([]byte, 0, 1024)) - v = f.sanitize(v) - if flags&flagRawStruct == 0 { - buf.WriteByte('{') - } - for i := 0; i < len(v); i += 2 { - if i > 0 { - buf.WriteByte(f.comma()) - } - k, _ := v[i].(string) // sanitize() above means no need to check success - // arbitrary keys might need escaping - buf.WriteString(prettyString(k)) - buf.WriteByte(f.colon()) - buf.WriteString(f.prettyWithFlags(v[i+1], 0, depth+1)) - } - if flags&flagRawStruct == 0 { - buf.WriteByte('}') - } - return buf.String() - } - - buf := bytes.NewBuffer(make([]byte, 0, 256)) - t := reflect.TypeOf(value) - if t == nil { - return "null" - } - v := reflect.ValueOf(value) - switch t.Kind() { - case reflect.Bool: - return strconv.FormatBool(v.Bool()) - case reflect.String: - return prettyString(v.String()) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return strconv.FormatInt(int64(v.Int()), 10) - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return strconv.FormatUint(uint64(v.Uint()), 10) - case reflect.Float32: - return strconv.FormatFloat(float64(v.Float()), 'f', -1, 32) - case reflect.Float64: - return strconv.FormatFloat(v.Float(), 'f', -1, 64) - case reflect.Complex64: - return `"` + strconv.FormatComplex(complex128(v.Complex()), 'f', -1, 64) + `"` - case reflect.Complex128: - return `"` + strconv.FormatComplex(v.Complex(), 'f', -1, 128) + `"` - case reflect.Struct: - if flags&flagRawStruct == 0 { - buf.WriteByte('{') - } - printComma := false // testing i>0 is not enough because of JSON omitted fields - for i := 0; i < t.NumField(); i++ { - fld := t.Field(i) - if fld.PkgPath != "" { - // reflect says this field is only defined for non-exported fields. - continue - } - if !v.Field(i).CanInterface() { - // reflect isn't clear exactly what this means, but we can't use it. - continue - } - name := "" - omitempty := false - if tag, found := fld.Tag.Lookup("json"); found { - if tag == "-" { - continue - } - if comma := strings.Index(tag, ","); comma != -1 { - if n := tag[:comma]; n != "" { - name = n - } - rest := tag[comma:] - if strings.Contains(rest, ",omitempty,") || strings.HasSuffix(rest, ",omitempty") { - omitempty = true - } - } else { - name = tag - } - } - if omitempty && isEmpty(v.Field(i)) { - continue - } - if printComma { - buf.WriteByte(f.comma()) - } - printComma = true // if we got here, we are rendering a field - if fld.Anonymous && fld.Type.Kind() == reflect.Struct && name == "" { - buf.WriteString(f.prettyWithFlags(v.Field(i).Interface(), flags|flagRawStruct, depth+1)) - continue - } - if name == "" { - name = fld.Name - } - // field names can't contain characters which need escaping - buf.WriteString(f.quoted(name, false)) - buf.WriteByte(f.colon()) - buf.WriteString(f.prettyWithFlags(v.Field(i).Interface(), 0, depth+1)) - } - if flags&flagRawStruct == 0 { - buf.WriteByte('}') - } - return buf.String() - case reflect.Slice, reflect.Array: - // If this is outputing as JSON make sure this isn't really a json.RawMessage. - // If so just emit "as-is" and don't pretty it as that will just print - // it as [X,Y,Z,...] which isn't terribly useful vs the string form you really want. - if f.outputFormat == outputJSON { - if rm, ok := value.(json.RawMessage); ok { - // If it's empty make sure we emit an empty value as the array style would below. - if len(rm) > 0 { - buf.Write(rm) - } else { - buf.WriteString("null") - } - return buf.String() - } - } - buf.WriteByte('[') - for i := 0; i < v.Len(); i++ { - if i > 0 { - buf.WriteByte(f.comma()) - } - e := v.Index(i) - buf.WriteString(f.prettyWithFlags(e.Interface(), 0, depth+1)) - } - buf.WriteByte(']') - return buf.String() - case reflect.Map: - buf.WriteByte('{') - // This does not sort the map keys, for best perf. - it := v.MapRange() - i := 0 - for it.Next() { - if i > 0 { - buf.WriteByte(f.comma()) - } - // If a map key supports TextMarshaler, use it. - keystr := "" - if m, ok := it.Key().Interface().(encoding.TextMarshaler); ok { - txt, err := m.MarshalText() - if err != nil { - keystr = fmt.Sprintf("", err.Error()) - } else { - keystr = string(txt) - } - keystr = prettyString(keystr) - } else { - // prettyWithFlags will produce already-escaped values - keystr = f.prettyWithFlags(it.Key().Interface(), 0, depth+1) - if t.Key().Kind() != reflect.String { - // JSON only does string keys. Unlike Go's standard JSON, we'll - // convert just about anything to a string. - keystr = prettyString(keystr) - } - } - buf.WriteString(keystr) - buf.WriteByte(f.colon()) - buf.WriteString(f.prettyWithFlags(it.Value().Interface(), 0, depth+1)) - i++ - } - buf.WriteByte('}') - return buf.String() - case reflect.Ptr, reflect.Interface: - if v.IsNil() { - return "null" - } - return f.prettyWithFlags(v.Elem().Interface(), 0, depth) - } - return fmt.Sprintf(`""`, t.Kind().String()) -} - -func prettyString(s string) string { - // Avoid escaping (which does allocations) if we can. - if needsEscape(s) { - return strconv.Quote(s) - } - b := bytes.NewBuffer(make([]byte, 0, 1024)) - b.WriteByte('"') - b.WriteString(s) - b.WriteByte('"') - return b.String() -} - -// needsEscape determines whether the input string needs to be escaped or not, -// without doing any allocations. -func needsEscape(s string) bool { - for _, r := range s { - if !strconv.IsPrint(r) || r == '\\' || r == '"' { - return true - } - } - return false -} - -func isEmpty(v reflect.Value) bool { - switch v.Kind() { - case reflect.Array, reflect.Map, reflect.Slice, reflect.String: - return v.Len() == 0 - case reflect.Bool: - return !v.Bool() - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.Complex64, reflect.Complex128: - return v.Complex() == 0 - case reflect.Interface, reflect.Ptr: - return v.IsNil() - } - return false -} - -func invokeMarshaler(m logr.Marshaler) (ret any) { - defer func() { - if r := recover(); r != nil { - ret = fmt.Sprintf("", r) - } - }() - return m.MarshalLog() -} - -func invokeStringer(s fmt.Stringer) (ret string) { - defer func() { - if r := recover(); r != nil { - ret = fmt.Sprintf("", r) - } - }() - return s.String() -} - -func invokeError(e error) (ret string) { - defer func() { - if r := recover(); r != nil { - ret = fmt.Sprintf("", r) - } - }() - return e.Error() -} - -// Caller represents the original call site for a log line, after considering -// logr.Logger.WithCallDepth and logr.Logger.WithCallStackHelper. The File and -// Line fields will always be provided, while the Func field is optional. -// Users can set the render hook fields in Options to examine logged key-value -// pairs, one of which will be {"caller", Caller} if the Options.LogCaller -// field is enabled for the given MessageClass. -type Caller struct { - // File is the basename of the file for this call site. - File string `json:"file"` - // Line is the line number in the file for this call site. - Line int `json:"line"` - // Func is the function name for this call site, or empty if - // Options.LogCallerFunc is not enabled. - Func string `json:"function,omitempty"` -} - -func (f Formatter) caller() Caller { - // +1 for this frame, +1 for Info/Error. - pc, file, line, ok := runtime.Caller(f.depth + 2) - if !ok { - return Caller{"", 0, ""} - } - fn := "" - if f.opts.LogCallerFunc { - if fp := runtime.FuncForPC(pc); fp != nil { - fn = fp.Name() - } - } - - return Caller{filepath.Base(file), line, fn} -} - -const noValue = "" - -func (f Formatter) nonStringKey(v any) string { - return fmt.Sprintf("", f.snippet(v)) -} - -// snippet produces a short snippet string of an arbitrary value. -func (f Formatter) snippet(v any) string { - const snipLen = 16 - - snip := f.pretty(v) - if len(snip) > snipLen { - snip = snip[:snipLen] - } - return snip -} - -// sanitize ensures that a list of key-value pairs has a value for every key -// (adding a value if needed) and that each key is a string (substituting a key -// if needed). -func (f Formatter) sanitize(kvList []any) []any { - if len(kvList)%2 != 0 { - kvList = append(kvList, noValue) - } - for i := 0; i < len(kvList); i += 2 { - _, ok := kvList[i].(string) - if !ok { - kvList[i] = f.nonStringKey(kvList[i]) - } - } - return kvList -} - -// startGroup opens a new group scope (basically a sub-struct), which locks all -// the current saved values and starts them anew. This is needed to satisfy -// slog. -func (f *Formatter) startGroup(group string) { - // Unnamed groups are just inlined. - if group == "" { - return - } - - // Any saved values can no longer be changed. - buf := bytes.NewBuffer(make([]byte, 0, 1024)) - continuing := false - - if f.parentValuesStr != "" { - buf.WriteString(f.parentValuesStr) - continuing = true - } - - if f.group != "" && f.valuesStr != "" { - if continuing { - buf.WriteByte(f.comma()) - } - buf.WriteString(f.quoted(f.group, true)) // escape user-provided keys - buf.WriteByte(f.colon()) - buf.WriteByte('{') // for the group - continuing = false - } - - if f.valuesStr != "" { - if continuing { - buf.WriteByte(f.comma()) - } - buf.WriteString(f.valuesStr) - } - - // NOTE: We don't close the scope here - that's done later, when a log line - // is actually rendered (because we have N scopes to close). - - f.parentValuesStr = buf.String() - - // Start collecting new values. - f.group = group - f.groupDepth++ - f.valuesStr = "" - f.values = nil -} - -// Init configures this Formatter from runtime info, such as the call depth -// imposed by logr itself. -// Note that this receiver is a pointer, so depth can be saved. -func (f *Formatter) Init(info logr.RuntimeInfo) { - f.depth += info.CallDepth -} - -// Enabled checks whether an info message at the given level should be logged. -func (f Formatter) Enabled(level int) bool { - return level <= f.opts.Verbosity -} - -// GetDepth returns the current depth of this Formatter. This is useful for -// implementations which do their own caller attribution. -func (f Formatter) GetDepth() int { - return f.depth -} - -// FormatInfo renders an Info log message into strings. The prefix will be -// empty when no names were set (via AddNames), or when the output is -// configured for JSON. -func (f Formatter) FormatInfo(level int, msg string, kvList []any) (prefix, argsStr string) { - args := make([]any, 0, 64) // using a constant here impacts perf - prefix = f.prefix - if f.outputFormat == outputJSON { - args = append(args, "logger", prefix) - prefix = "" - } - if f.opts.LogTimestamp { - args = append(args, "ts", time.Now().Format(f.opts.TimestampFormat)) - } - if policy := f.opts.LogCaller; policy == All || policy == Info { - args = append(args, "caller", f.caller()) - } - if key := *f.opts.LogInfoLevel; key != "" { - args = append(args, key, level) - } - args = append(args, "msg", msg) - return prefix, f.render(args, kvList) -} - -// FormatError renders an Error log message into strings. The prefix will be -// empty when no names were set (via AddNames), or when the output is -// configured for JSON. -func (f Formatter) FormatError(err error, msg string, kvList []any) (prefix, argsStr string) { - args := make([]any, 0, 64) // using a constant here impacts perf - prefix = f.prefix - if f.outputFormat == outputJSON { - args = append(args, "logger", prefix) - prefix = "" - } - if f.opts.LogTimestamp { - args = append(args, "ts", time.Now().Format(f.opts.TimestampFormat)) - } - if policy := f.opts.LogCaller; policy == All || policy == Error { - args = append(args, "caller", f.caller()) - } - args = append(args, "msg", msg) - var loggableErr any - if err != nil { - loggableErr = err.Error() - } - args = append(args, "error", loggableErr) - return prefix, f.render(args, kvList) -} - -// AddName appends the specified name. funcr uses '/' characters to separate -// name elements. Callers should not pass '/' in the provided name string, but -// this library does not actually enforce that. -func (f *Formatter) AddName(name string) { - if len(f.prefix) > 0 { - f.prefix += "/" - } - f.prefix += name -} - -// AddValues adds key-value pairs to the set of saved values to be logged with -// each log line. -func (f *Formatter) AddValues(kvList []any) { - // Three slice args forces a copy. - n := len(f.values) - f.values = append(f.values[:n:n], kvList...) - - vals := f.values - if hook := f.opts.RenderValuesHook; hook != nil { - vals = hook(f.sanitize(vals)) - } - - // Pre-render values, so we don't have to do it on each Info/Error call. - buf := bytes.NewBuffer(make([]byte, 0, 1024)) - f.flatten(buf, vals, false, true) // escape user-provided keys - f.valuesStr = buf.String() -} - -// AddCallDepth increases the number of stack-frames to skip when attributing -// the log line to a file and line. -func (f *Formatter) AddCallDepth(depth int) { - f.depth += depth -} diff --git a/vendor/github.com/go-logr/logr/funcr/slogsink.go b/vendor/github.com/go-logr/logr/funcr/slogsink.go deleted file mode 100644 index 7bd84761..00000000 --- a/vendor/github.com/go-logr/logr/funcr/slogsink.go +++ /dev/null @@ -1,105 +0,0 @@ -//go:build go1.21 -// +build go1.21 - -/* -Copyright 2023 The logr Authors. - -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. -*/ - -package funcr - -import ( - "context" - "log/slog" - - "github.com/go-logr/logr" -) - -var _ logr.SlogSink = &fnlogger{} - -const extraSlogSinkDepth = 3 // 2 for slog, 1 for SlogSink - -func (l fnlogger) Handle(_ context.Context, record slog.Record) error { - kvList := make([]any, 0, 2*record.NumAttrs()) - record.Attrs(func(attr slog.Attr) bool { - kvList = attrToKVs(attr, kvList) - return true - }) - - if record.Level >= slog.LevelError { - l.WithCallDepth(extraSlogSinkDepth).Error(nil, record.Message, kvList...) - } else { - level := l.levelFromSlog(record.Level) - l.WithCallDepth(extraSlogSinkDepth).Info(level, record.Message, kvList...) - } - return nil -} - -func (l fnlogger) WithAttrs(attrs []slog.Attr) logr.SlogSink { - kvList := make([]any, 0, 2*len(attrs)) - for _, attr := range attrs { - kvList = attrToKVs(attr, kvList) - } - l.AddValues(kvList) - return &l -} - -func (l fnlogger) WithGroup(name string) logr.SlogSink { - l.startGroup(name) - return &l -} - -// attrToKVs appends a slog.Attr to a logr-style kvList. It handle slog Groups -// and other details of slog. -func attrToKVs(attr slog.Attr, kvList []any) []any { - attrVal := attr.Value.Resolve() - if attrVal.Kind() == slog.KindGroup { - groupVal := attrVal.Group() - grpKVs := make([]any, 0, 2*len(groupVal)) - for _, attr := range groupVal { - grpKVs = attrToKVs(attr, grpKVs) - } - if attr.Key == "" { - // slog says we have to inline these - kvList = append(kvList, grpKVs...) - } else { - kvList = append(kvList, attr.Key, PseudoStruct(grpKVs)) - } - } else if attr.Key != "" { - kvList = append(kvList, attr.Key, attrVal.Any()) - } - - return kvList -} - -// levelFromSlog adjusts the level by the logger's verbosity and negates it. -// It ensures that the result is >= 0. This is necessary because the result is -// passed to a LogSink and that API did not historically document whether -// levels could be negative or what that meant. -// -// Some example usage: -// -// logrV0 := getMyLogger() -// logrV2 := logrV0.V(2) -// slogV2 := slog.New(logr.ToSlogHandler(logrV2)) -// slogV2.Debug("msg") // =~ logrV2.V(4) =~ logrV0.V(6) -// slogV2.Info("msg") // =~ logrV2.V(0) =~ logrV0.V(2) -// slogv2.Warn("msg") // =~ logrV2.V(-4) =~ logrV0.V(0) -func (l fnlogger) levelFromSlog(level slog.Level) int { - result := -level - if result < 0 { - result = 0 // because LogSink doesn't expect negative V levels - } - return int(result) -} diff --git a/vendor/github.com/go-logr/logr/logr.go b/vendor/github.com/go-logr/logr/logr.go deleted file mode 100644 index b4428e10..00000000 --- a/vendor/github.com/go-logr/logr/logr.go +++ /dev/null @@ -1,520 +0,0 @@ -/* -Copyright 2019 The logr Authors. - -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. -*/ - -// This design derives from Dave Cheney's blog: -// http://dave.cheney.net/2015/11/05/lets-talk-about-logging - -// Package logr defines a general-purpose logging API and abstract interfaces -// to back that API. Packages in the Go ecosystem can depend on this package, -// while callers can implement logging with whatever backend is appropriate. -// -// # Usage -// -// Logging is done using a Logger instance. Logger is a concrete type with -// methods, which defers the actual logging to a LogSink interface. The main -// methods of Logger are Info() and Error(). Arguments to Info() and Error() -// are key/value pairs rather than printf-style formatted strings, emphasizing -// "structured logging". -// -// With Go's standard log package, we might write: -// -// log.Printf("setting target value %s", targetValue) -// -// With logr's structured logging, we'd write: -// -// logger.Info("setting target", "value", targetValue) -// -// Errors are much the same. Instead of: -// -// log.Printf("failed to open the pod bay door for user %s: %v", user, err) -// -// We'd write: -// -// logger.Error(err, "failed to open the pod bay door", "user", user) -// -// Info() and Error() are very similar, but they are separate methods so that -// LogSink implementations can choose to do things like attach additional -// information (such as stack traces) on calls to Error(). Error() messages are -// always logged, regardless of the current verbosity. If there is no error -// instance available, passing nil is valid. -// -// # Verbosity -// -// Often we want to log information only when the application in "verbose -// mode". To write log lines that are more verbose, Logger has a V() method. -// The higher the V-level of a log line, the less critical it is considered. -// Log-lines with V-levels that are not enabled (as per the LogSink) will not -// be written. Level V(0) is the default, and logger.V(0).Info() has the same -// meaning as logger.Info(). Negative V-levels have the same meaning as V(0). -// Error messages do not have a verbosity level and are always logged. -// -// Where we might have written: -// -// if flVerbose >= 2 { -// log.Printf("an unusual thing happened") -// } -// -// We can write: -// -// logger.V(2).Info("an unusual thing happened") -// -// # Logger Names -// -// Logger instances can have name strings so that all messages logged through -// that instance have additional context. For example, you might want to add -// a subsystem name: -// -// logger.WithName("compactor").Info("started", "time", time.Now()) -// -// The WithName() method returns a new Logger, which can be passed to -// constructors or other functions for further use. Repeated use of WithName() -// will accumulate name "segments". These name segments will be joined in some -// way by the LogSink implementation. It is strongly recommended that name -// segments contain simple identifiers (letters, digits, and hyphen), and do -// not contain characters that could muddle the log output or confuse the -// joining operation (e.g. whitespace, commas, periods, slashes, brackets, -// quotes, etc). -// -// # Saved Values -// -// Logger instances can store any number of key/value pairs, which will be -// logged alongside all messages logged through that instance. For example, -// you might want to create a Logger instance per managed object: -// -// With the standard log package, we might write: -// -// log.Printf("decided to set field foo to value %q for object %s/%s", -// targetValue, object.Namespace, object.Name) -// -// With logr we'd write: -// -// // Elsewhere: set up the logger to log the object name. -// obj.logger = mainLogger.WithValues( -// "name", obj.name, "namespace", obj.namespace) -// -// // later on... -// obj.logger.Info("setting foo", "value", targetValue) -// -// # Best Practices -// -// Logger has very few hard rules, with the goal that LogSink implementations -// might have a lot of freedom to differentiate. There are, however, some -// things to consider. -// -// The log message consists of a constant message attached to the log line. -// This should generally be a simple description of what's occurring, and should -// never be a format string. Variable information can then be attached using -// named values. -// -// Keys are arbitrary strings, but should generally be constant values. Values -// may be any Go value, but how the value is formatted is determined by the -// LogSink implementation. -// -// Logger instances are meant to be passed around by value. Code that receives -// such a value can call its methods without having to check whether the -// instance is ready for use. -// -// The zero logger (= Logger{}) is identical to Discard() and discards all log -// entries. Code that receives a Logger by value can simply call it, the methods -// will never crash. For cases where passing a logger is optional, a pointer to Logger -// should be used. -// -// # Key Naming Conventions -// -// Keys are not strictly required to conform to any specification or regex, but -// it is recommended that they: -// - be human-readable and meaningful (not auto-generated or simple ordinals) -// - be constant (not dependent on input data) -// - contain only printable characters -// - not contain whitespace or punctuation -// - use lower case for simple keys and lowerCamelCase for more complex ones -// -// These guidelines help ensure that log data is processed properly regardless -// of the log implementation. For example, log implementations will try to -// output JSON data or will store data for later database (e.g. SQL) queries. -// -// While users are generally free to use key names of their choice, it's -// generally best to avoid using the following keys, as they're frequently used -// by implementations: -// - "caller": the calling information (file/line) of a particular log line -// - "error": the underlying error value in the `Error` method -// - "level": the log level -// - "logger": the name of the associated logger -// - "msg": the log message -// - "stacktrace": the stack trace associated with a particular log line or -// error (often from the `Error` message) -// - "ts": the timestamp for a log line -// -// Implementations are encouraged to make use of these keys to represent the -// above concepts, when necessary (for example, in a pure-JSON output form, it -// would be necessary to represent at least message and timestamp as ordinary -// named values). -// -// # Break Glass -// -// Implementations may choose to give callers access to the underlying -// logging implementation. The recommended pattern for this is: -// -// // Underlier exposes access to the underlying logging implementation. -// // Since callers only have a logr.Logger, they have to know which -// // implementation is in use, so this interface is less of an abstraction -// // and more of way to test type conversion. -// type Underlier interface { -// GetUnderlying() -// } -// -// Logger grants access to the sink to enable type assertions like this: -// -// func DoSomethingWithImpl(log logr.Logger) { -// if underlier, ok := log.GetSink().(impl.Underlier); ok { -// implLogger := underlier.GetUnderlying() -// ... -// } -// } -// -// Custom `With*` functions can be implemented by copying the complete -// Logger struct and replacing the sink in the copy: -// -// // WithFooBar changes the foobar parameter in the log sink and returns a -// // new logger with that modified sink. It does nothing for loggers where -// // the sink doesn't support that parameter. -// func WithFoobar(log logr.Logger, foobar int) logr.Logger { -// if foobarLogSink, ok := log.GetSink().(FoobarSink); ok { -// log = log.WithSink(foobarLogSink.WithFooBar(foobar)) -// } -// return log -// } -// -// Don't use New to construct a new Logger with a LogSink retrieved from an -// existing Logger. Source code attribution might not work correctly and -// unexported fields in Logger get lost. -// -// Beware that the same LogSink instance may be shared by different logger -// instances. Calling functions that modify the LogSink will affect all of -// those. -package logr - -// New returns a new Logger instance. This is primarily used by libraries -// implementing LogSink, rather than end users. Passing a nil sink will create -// a Logger which discards all log lines. -func New(sink LogSink) Logger { - logger := Logger{} - logger.setSink(sink) - if sink != nil { - sink.Init(runtimeInfo) - } - return logger -} - -// setSink stores the sink and updates any related fields. It mutates the -// logger and thus is only safe to use for loggers that are not currently being -// used concurrently. -func (l *Logger) setSink(sink LogSink) { - l.sink = sink -} - -// GetSink returns the stored sink. -func (l Logger) GetSink() LogSink { - return l.sink -} - -// WithSink returns a copy of the logger with the new sink. -func (l Logger) WithSink(sink LogSink) Logger { - l.setSink(sink) - return l -} - -// Logger is an interface to an abstract logging implementation. This is a -// concrete type for performance reasons, but all the real work is passed on to -// a LogSink. Implementations of LogSink should provide their own constructors -// that return Logger, not LogSink. -// -// The underlying sink can be accessed through GetSink and be modified through -// WithSink. This enables the implementation of custom extensions (see "Break -// Glass" in the package documentation). Normally the sink should be used only -// indirectly. -type Logger struct { - sink LogSink - level int -} - -// Enabled tests whether this Logger is enabled. For example, commandline -// flags might be used to set the logging verbosity and disable some info logs. -func (l Logger) Enabled() bool { - // Some implementations of LogSink look at the caller in Enabled (e.g. - // different verbosity levels per package or file), but we only pass one - // CallDepth in (via Init). This means that all calls from Logger to the - // LogSink's Enabled, Info, and Error methods must have the same number of - // frames. In other words, Logger methods can't call other Logger methods - // which call these LogSink methods unless we do it the same in all paths. - return l.sink != nil && l.sink.Enabled(l.level) -} - -// Info logs a non-error message with the given key/value pairs as context. -// -// The msg argument should be used to add some constant description to the log -// line. The key/value pairs can then be used to add additional variable -// information. The key/value pairs must alternate string keys and arbitrary -// values. -func (l Logger) Info(msg string, keysAndValues ...any) { - if l.sink == nil { - return - } - if l.sink.Enabled(l.level) { // see comment in Enabled - if withHelper, ok := l.sink.(CallStackHelperLogSink); ok { - withHelper.GetCallStackHelper()() - } - l.sink.Info(l.level, msg, keysAndValues...) - } -} - -// Error logs an error, with the given message and key/value pairs as context. -// It functions similarly to Info, but may have unique behavior, and should be -// preferred for logging errors (see the package documentations for more -// information). The log message will always be emitted, regardless of -// verbosity level. -// -// The msg argument should be used to add context to any underlying error, -// while the err argument should be used to attach the actual error that -// triggered this log line, if present. The err parameter is optional -// and nil may be passed instead of an error instance. -func (l Logger) Error(err error, msg string, keysAndValues ...any) { - if l.sink == nil { - return - } - if withHelper, ok := l.sink.(CallStackHelperLogSink); ok { - withHelper.GetCallStackHelper()() - } - l.sink.Error(err, msg, keysAndValues...) -} - -// V returns a new Logger instance for a specific verbosity level, relative to -// this Logger. In other words, V-levels are additive. A higher verbosity -// level means a log message is less important. Negative V-levels are treated -// as 0. -func (l Logger) V(level int) Logger { - if l.sink == nil { - return l - } - if level < 0 { - level = 0 - } - l.level += level - return l -} - -// GetV returns the verbosity level of the logger. If the logger's LogSink is -// nil as in the Discard logger, this will always return 0. -func (l Logger) GetV() int { - // 0 if l.sink nil because of the if check in V above. - return l.level -} - -// WithValues returns a new Logger instance with additional key/value pairs. -// See Info for documentation on how key/value pairs work. -func (l Logger) WithValues(keysAndValues ...any) Logger { - if l.sink == nil { - return l - } - l.setSink(l.sink.WithValues(keysAndValues...)) - return l -} - -// WithName returns a new Logger instance with the specified name element added -// to the Logger's name. Successive calls with WithName append additional -// suffixes to the Logger's name. It's strongly recommended that name segments -// contain only letters, digits, and hyphens (see the package documentation for -// more information). -func (l Logger) WithName(name string) Logger { - if l.sink == nil { - return l - } - l.setSink(l.sink.WithName(name)) - return l -} - -// WithCallDepth returns a Logger instance that offsets the call stack by the -// specified number of frames when logging call site information, if possible. -// This is useful for users who have helper functions between the "real" call -// site and the actual calls to Logger methods. If depth is 0 the attribution -// should be to the direct caller of this function. If depth is 1 the -// attribution should skip 1 call frame, and so on. Successive calls to this -// are additive. -// -// If the underlying log implementation supports a WithCallDepth(int) method, -// it will be called and the result returned. If the implementation does not -// support CallDepthLogSink, the original Logger will be returned. -// -// To skip one level, WithCallStackHelper() should be used instead of -// WithCallDepth(1) because it works with implementions that support the -// CallDepthLogSink and/or CallStackHelperLogSink interfaces. -func (l Logger) WithCallDepth(depth int) Logger { - if l.sink == nil { - return l - } - if withCallDepth, ok := l.sink.(CallDepthLogSink); ok { - l.setSink(withCallDepth.WithCallDepth(depth)) - } - return l -} - -// WithCallStackHelper returns a new Logger instance that skips the direct -// caller when logging call site information, if possible. This is useful for -// users who have helper functions between the "real" call site and the actual -// calls to Logger methods and want to support loggers which depend on marking -// each individual helper function, like loggers based on testing.T. -// -// In addition to using that new logger instance, callers also must call the -// returned function. -// -// If the underlying log implementation supports a WithCallDepth(int) method, -// WithCallDepth(1) will be called to produce a new logger. If it supports a -// WithCallStackHelper() method, that will be also called. If the -// implementation does not support either of these, the original Logger will be -// returned. -func (l Logger) WithCallStackHelper() (func(), Logger) { - if l.sink == nil { - return func() {}, l - } - var helper func() - if withCallDepth, ok := l.sink.(CallDepthLogSink); ok { - l.setSink(withCallDepth.WithCallDepth(1)) - } - if withHelper, ok := l.sink.(CallStackHelperLogSink); ok { - helper = withHelper.GetCallStackHelper() - } else { - helper = func() {} - } - return helper, l -} - -// IsZero returns true if this logger is an uninitialized zero value -func (l Logger) IsZero() bool { - return l.sink == nil -} - -// RuntimeInfo holds information that the logr "core" library knows which -// LogSinks might want to know. -type RuntimeInfo struct { - // CallDepth is the number of call frames the logr library adds between the - // end-user and the LogSink. LogSink implementations which choose to print - // the original logging site (e.g. file & line) should climb this many - // additional frames to find it. - CallDepth int -} - -// runtimeInfo is a static global. It must not be changed at run time. -var runtimeInfo = RuntimeInfo{ - CallDepth: 1, -} - -// LogSink represents a logging implementation. End-users will generally not -// interact with this type. -type LogSink interface { - // Init receives optional information about the logr library for LogSink - // implementations that need it. - Init(info RuntimeInfo) - - // Enabled tests whether this LogSink is enabled at the specified V-level. - // For example, commandline flags might be used to set the logging - // verbosity and disable some info logs. - Enabled(level int) bool - - // Info logs a non-error message with the given key/value pairs as context. - // The level argument is provided for optional logging. This method will - // only be called when Enabled(level) is true. See Logger.Info for more - // details. - Info(level int, msg string, keysAndValues ...any) - - // Error logs an error, with the given message and key/value pairs as - // context. See Logger.Error for more details. - Error(err error, msg string, keysAndValues ...any) - - // WithValues returns a new LogSink with additional key/value pairs. See - // Logger.WithValues for more details. - WithValues(keysAndValues ...any) LogSink - - // WithName returns a new LogSink with the specified name appended. See - // Logger.WithName for more details. - WithName(name string) LogSink -} - -// CallDepthLogSink represents a LogSink that knows how to climb the call stack -// to identify the original call site and can offset the depth by a specified -// number of frames. This is useful for users who have helper functions -// between the "real" call site and the actual calls to Logger methods. -// Implementations that log information about the call site (such as file, -// function, or line) would otherwise log information about the intermediate -// helper functions. -// -// This is an optional interface and implementations are not required to -// support it. -type CallDepthLogSink interface { - // WithCallDepth returns a LogSink that will offset the call - // stack by the specified number of frames when logging call - // site information. - // - // If depth is 0, the LogSink should skip exactly the number - // of call frames defined in RuntimeInfo.CallDepth when Info - // or Error are called, i.e. the attribution should be to the - // direct caller of Logger.Info or Logger.Error. - // - // If depth is 1 the attribution should skip 1 call frame, and so on. - // Successive calls to this are additive. - WithCallDepth(depth int) LogSink -} - -// CallStackHelperLogSink represents a LogSink that knows how to climb -// the call stack to identify the original call site and can skip -// intermediate helper functions if they mark themselves as -// helper. Go's testing package uses that approach. -// -// This is useful for users who have helper functions between the -// "real" call site and the actual calls to Logger methods. -// Implementations that log information about the call site (such as -// file, function, or line) would otherwise log information about the -// intermediate helper functions. -// -// This is an optional interface and implementations are not required -// to support it. Implementations that choose to support this must not -// simply implement it as WithCallDepth(1), because -// Logger.WithCallStackHelper will call both methods if they are -// present. This should only be implemented for LogSinks that actually -// need it, as with testing.T. -type CallStackHelperLogSink interface { - // GetCallStackHelper returns a function that must be called - // to mark the direct caller as helper function when logging - // call site information. - GetCallStackHelper() func() -} - -// Marshaler is an optional interface that logged values may choose to -// implement. Loggers with structured output, such as JSON, should -// log the object return by the MarshalLog method instead of the -// original value. -type Marshaler interface { - // MarshalLog can be used to: - // - ensure that structs are not logged as strings when the original - // value has a String method: return a different type without a - // String method - // - select which fields of a complex type should get logged: - // return a simpler struct with fewer fields - // - log unexported fields: return a different struct - // with exported fields - // - // It may return any value of any type. - MarshalLog() any -} diff --git a/vendor/github.com/go-logr/logr/sloghandler.go b/vendor/github.com/go-logr/logr/sloghandler.go deleted file mode 100644 index 82d1ba49..00000000 --- a/vendor/github.com/go-logr/logr/sloghandler.go +++ /dev/null @@ -1,192 +0,0 @@ -//go:build go1.21 -// +build go1.21 - -/* -Copyright 2023 The logr Authors. - -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. -*/ - -package logr - -import ( - "context" - "log/slog" -) - -type slogHandler struct { - // May be nil, in which case all logs get discarded. - sink LogSink - // Non-nil if sink is non-nil and implements SlogSink. - slogSink SlogSink - - // groupPrefix collects values from WithGroup calls. It gets added as - // prefix to value keys when handling a log record. - groupPrefix string - - // levelBias can be set when constructing the handler to influence the - // slog.Level of log records. A positive levelBias reduces the - // slog.Level value. slog has no API to influence this value after the - // handler got created, so it can only be set indirectly through - // Logger.V. - levelBias slog.Level -} - -var _ slog.Handler = &slogHandler{} - -// groupSeparator is used to concatenate WithGroup names and attribute keys. -const groupSeparator = "." - -// GetLevel is used for black box unit testing. -func (l *slogHandler) GetLevel() slog.Level { - return l.levelBias -} - -func (l *slogHandler) Enabled(_ context.Context, level slog.Level) bool { - return l.sink != nil && (level >= slog.LevelError || l.sink.Enabled(l.levelFromSlog(level))) -} - -func (l *slogHandler) Handle(ctx context.Context, record slog.Record) error { - if l.slogSink != nil { - // Only adjust verbosity level of log entries < slog.LevelError. - if record.Level < slog.LevelError { - record.Level -= l.levelBias - } - return l.slogSink.Handle(ctx, record) - } - - // No need to check for nil sink here because Handle will only be called - // when Enabled returned true. - - kvList := make([]any, 0, 2*record.NumAttrs()) - record.Attrs(func(attr slog.Attr) bool { - kvList = attrToKVs(attr, l.groupPrefix, kvList) - return true - }) - if record.Level >= slog.LevelError { - l.sinkWithCallDepth().Error(nil, record.Message, kvList...) - } else { - level := l.levelFromSlog(record.Level) - l.sinkWithCallDepth().Info(level, record.Message, kvList...) - } - return nil -} - -// sinkWithCallDepth adjusts the stack unwinding so that when Error or Info -// are called by Handle, code in slog gets skipped. -// -// This offset currently (Go 1.21.0) works for calls through -// slog.New(ToSlogHandler(...)). There's no guarantee that the call -// chain won't change. Wrapping the handler will also break unwinding. It's -// still better than not adjusting at all.... -// -// This cannot be done when constructing the handler because FromSlogHandler needs -// access to the original sink without this adjustment. A second copy would -// work, but then WithAttrs would have to be called for both of them. -func (l *slogHandler) sinkWithCallDepth() LogSink { - if sink, ok := l.sink.(CallDepthLogSink); ok { - return sink.WithCallDepth(2) - } - return l.sink -} - -func (l *slogHandler) WithAttrs(attrs []slog.Attr) slog.Handler { - if l.sink == nil || len(attrs) == 0 { - return l - } - - clone := *l - if l.slogSink != nil { - clone.slogSink = l.slogSink.WithAttrs(attrs) - clone.sink = clone.slogSink - } else { - kvList := make([]any, 0, 2*len(attrs)) - for _, attr := range attrs { - kvList = attrToKVs(attr, l.groupPrefix, kvList) - } - clone.sink = l.sink.WithValues(kvList...) - } - return &clone -} - -func (l *slogHandler) WithGroup(name string) slog.Handler { - if l.sink == nil { - return l - } - if name == "" { - // slog says to inline empty groups - return l - } - clone := *l - if l.slogSink != nil { - clone.slogSink = l.slogSink.WithGroup(name) - clone.sink = clone.slogSink - } else { - clone.groupPrefix = addPrefix(clone.groupPrefix, name) - } - return &clone -} - -// attrToKVs appends a slog.Attr to a logr-style kvList. It handle slog Groups -// and other details of slog. -func attrToKVs(attr slog.Attr, groupPrefix string, kvList []any) []any { - attrVal := attr.Value.Resolve() - if attrVal.Kind() == slog.KindGroup { - groupVal := attrVal.Group() - grpKVs := make([]any, 0, 2*len(groupVal)) - prefix := groupPrefix - if attr.Key != "" { - prefix = addPrefix(groupPrefix, attr.Key) - } - for _, attr := range groupVal { - grpKVs = attrToKVs(attr, prefix, grpKVs) - } - kvList = append(kvList, grpKVs...) - } else if attr.Key != "" { - kvList = append(kvList, addPrefix(groupPrefix, attr.Key), attrVal.Any()) - } - - return kvList -} - -func addPrefix(prefix, name string) string { - if prefix == "" { - return name - } - if name == "" { - return prefix - } - return prefix + groupSeparator + name -} - -// levelFromSlog adjusts the level by the logger's verbosity and negates it. -// It ensures that the result is >= 0. This is necessary because the result is -// passed to a LogSink and that API did not historically document whether -// levels could be negative or what that meant. -// -// Some example usage: -// -// logrV0 := getMyLogger() -// logrV2 := logrV0.V(2) -// slogV2 := slog.New(logr.ToSlogHandler(logrV2)) -// slogV2.Debug("msg") // =~ logrV2.V(4) =~ logrV0.V(6) -// slogV2.Info("msg") // =~ logrV2.V(0) =~ logrV0.V(2) -// slogv2.Warn("msg") // =~ logrV2.V(-4) =~ logrV0.V(0) -func (l *slogHandler) levelFromSlog(level slog.Level) int { - result := -level - result += l.levelBias // in case the original Logger had a V level - if result < 0 { - result = 0 // because LogSink doesn't expect negative V levels - } - return int(result) -} diff --git a/vendor/github.com/go-logr/logr/slogr.go b/vendor/github.com/go-logr/logr/slogr.go deleted file mode 100644 index 28a83d02..00000000 --- a/vendor/github.com/go-logr/logr/slogr.go +++ /dev/null @@ -1,100 +0,0 @@ -//go:build go1.21 -// +build go1.21 - -/* -Copyright 2023 The logr Authors. - -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. -*/ - -package logr - -import ( - "context" - "log/slog" -) - -// FromSlogHandler returns a Logger which writes to the slog.Handler. -// -// The logr verbosity level is mapped to slog levels such that V(0) becomes -// slog.LevelInfo and V(4) becomes slog.LevelDebug. -func FromSlogHandler(handler slog.Handler) Logger { - if handler, ok := handler.(*slogHandler); ok { - if handler.sink == nil { - return Discard() - } - return New(handler.sink).V(int(handler.levelBias)) - } - return New(&slogSink{handler: handler}) -} - -// ToSlogHandler returns a slog.Handler which writes to the same sink as the Logger. -// -// The returned logger writes all records with level >= slog.LevelError as -// error log entries with LogSink.Error, regardless of the verbosity level of -// the Logger: -// -// logger := -// slog.New(ToSlogHandler(logger.V(10))).Error(...) -> logSink.Error(...) -// -// The level of all other records gets reduced by the verbosity -// level of the Logger and the result is negated. If it happens -// to be negative, then it gets replaced by zero because a LogSink -// is not expected to handled negative levels: -// -// slog.New(ToSlogHandler(logger)).Debug(...) -> logger.GetSink().Info(level=4, ...) -// slog.New(ToSlogHandler(logger)).Warning(...) -> logger.GetSink().Info(level=0, ...) -// slog.New(ToSlogHandler(logger)).Info(...) -> logger.GetSink().Info(level=0, ...) -// slog.New(ToSlogHandler(logger.V(4))).Info(...) -> logger.GetSink().Info(level=4, ...) -func ToSlogHandler(logger Logger) slog.Handler { - if sink, ok := logger.GetSink().(*slogSink); ok && logger.GetV() == 0 { - return sink.handler - } - - handler := &slogHandler{sink: logger.GetSink(), levelBias: slog.Level(logger.GetV())} - if slogSink, ok := handler.sink.(SlogSink); ok { - handler.slogSink = slogSink - } - return handler -} - -// SlogSink is an optional interface that a LogSink can implement to support -// logging through the slog.Logger or slog.Handler APIs better. It then should -// also support special slog values like slog.Group. When used as a -// slog.Handler, the advantages are: -// -// - stack unwinding gets avoided in favor of logging the pre-recorded PC, -// as intended by slog -// - proper grouping of key/value pairs via WithGroup -// - verbosity levels > slog.LevelInfo can be recorded -// - less overhead -// -// Both APIs (Logger and slog.Logger/Handler) then are supported equally -// well. Developers can pick whatever API suits them better and/or mix -// packages which use either API in the same binary with a common logging -// implementation. -// -// This interface is necessary because the type implementing the LogSink -// interface cannot also implement the slog.Handler interface due to the -// different prototype of the common Enabled method. -// -// An implementation could support both interfaces in two different types, but then -// additional interfaces would be needed to convert between those types in FromSlogHandler -// and ToSlogHandler. -type SlogSink interface { - LogSink - - Handle(ctx context.Context, record slog.Record) error - WithAttrs(attrs []slog.Attr) SlogSink - WithGroup(name string) SlogSink -} diff --git a/vendor/github.com/go-logr/logr/slogsink.go b/vendor/github.com/go-logr/logr/slogsink.go deleted file mode 100644 index 4060fcbc..00000000 --- a/vendor/github.com/go-logr/logr/slogsink.go +++ /dev/null @@ -1,120 +0,0 @@ -//go:build go1.21 -// +build go1.21 - -/* -Copyright 2023 The logr Authors. - -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. -*/ - -package logr - -import ( - "context" - "log/slog" - "runtime" - "time" -) - -var ( - _ LogSink = &slogSink{} - _ CallDepthLogSink = &slogSink{} - _ Underlier = &slogSink{} -) - -// Underlier is implemented by the LogSink returned by NewFromLogHandler. -type Underlier interface { - // GetUnderlying returns the Handler used by the LogSink. - GetUnderlying() slog.Handler -} - -const ( - // nameKey is used to log the `WithName` values as an additional attribute. - nameKey = "logger" - - // errKey is used to log the error parameter of Error as an additional attribute. - errKey = "err" -) - -type slogSink struct { - callDepth int - name string - handler slog.Handler -} - -func (l *slogSink) Init(info RuntimeInfo) { - l.callDepth = info.CallDepth -} - -func (l *slogSink) GetUnderlying() slog.Handler { - return l.handler -} - -func (l *slogSink) WithCallDepth(depth int) LogSink { - newLogger := *l - newLogger.callDepth += depth - return &newLogger -} - -func (l *slogSink) Enabled(level int) bool { - return l.handler.Enabled(context.Background(), slog.Level(-level)) -} - -func (l *slogSink) Info(level int, msg string, kvList ...interface{}) { - l.log(nil, msg, slog.Level(-level), kvList...) -} - -func (l *slogSink) Error(err error, msg string, kvList ...interface{}) { - l.log(err, msg, slog.LevelError, kvList...) -} - -func (l *slogSink) log(err error, msg string, level slog.Level, kvList ...interface{}) { - var pcs [1]uintptr - // skip runtime.Callers, this function, Info/Error, and all helper functions above that. - runtime.Callers(3+l.callDepth, pcs[:]) - - record := slog.NewRecord(time.Now(), level, msg, pcs[0]) - if l.name != "" { - record.AddAttrs(slog.String(nameKey, l.name)) - } - if err != nil { - record.AddAttrs(slog.Any(errKey, err)) - } - record.Add(kvList...) - _ = l.handler.Handle(context.Background(), record) -} - -func (l slogSink) WithName(name string) LogSink { - if l.name != "" { - l.name += "/" - } - l.name += name - return &l -} - -func (l slogSink) WithValues(kvList ...interface{}) LogSink { - l.handler = l.handler.WithAttrs(kvListToAttrs(kvList...)) - return &l -} - -func kvListToAttrs(kvList ...interface{}) []slog.Attr { - // We don't need the record itself, only its Add method. - record := slog.NewRecord(time.Time{}, 0, "", 0) - record.Add(kvList...) - attrs := make([]slog.Attr, 0, record.NumAttrs()) - record.Attrs(func(attr slog.Attr) bool { - attrs = append(attrs, attr) - return true - }) - return attrs -} diff --git a/vendor/github.com/go-logr/stdr/LICENSE b/vendor/github.com/go-logr/stdr/LICENSE deleted file mode 100644 index 261eeb9e..00000000 --- a/vendor/github.com/go-logr/stdr/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. diff --git a/vendor/github.com/go-logr/stdr/README.md b/vendor/github.com/go-logr/stdr/README.md deleted file mode 100644 index 51586678..00000000 --- a/vendor/github.com/go-logr/stdr/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Minimal Go logging using logr and Go's standard library - -[![Go Reference](https://pkg.go.dev/badge/github.com/go-logr/stdr.svg)](https://pkg.go.dev/github.com/go-logr/stdr) - -This package implements the [logr interface](https://github.com/go-logr/logr) -in terms of Go's standard log package(https://pkg.go.dev/log). diff --git a/vendor/github.com/go-logr/stdr/stdr.go b/vendor/github.com/go-logr/stdr/stdr.go deleted file mode 100644 index 93a8aab5..00000000 --- a/vendor/github.com/go-logr/stdr/stdr.go +++ /dev/null @@ -1,170 +0,0 @@ -/* -Copyright 2019 The logr Authors. - -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. -*/ - -// Package stdr implements github.com/go-logr/logr.Logger in terms of -// Go's standard log package. -package stdr - -import ( - "log" - "os" - - "github.com/go-logr/logr" - "github.com/go-logr/logr/funcr" -) - -// The global verbosity level. See SetVerbosity(). -var globalVerbosity int - -// SetVerbosity sets the global level against which all info logs will be -// compared. If this is greater than or equal to the "V" of the logger, the -// message will be logged. A higher value here means more logs will be written. -// The previous verbosity value is returned. This is not concurrent-safe - -// callers must be sure to call it from only one goroutine. -func SetVerbosity(v int) int { - old := globalVerbosity - globalVerbosity = v - return old -} - -// New returns a logr.Logger which is implemented by Go's standard log package, -// or something like it. If std is nil, this will use a default logger -// instead. -// -// Example: stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile))) -func New(std StdLogger) logr.Logger { - return NewWithOptions(std, Options{}) -} - -// NewWithOptions returns a logr.Logger which is implemented by Go's standard -// log package, or something like it. See New for details. -func NewWithOptions(std StdLogger, opts Options) logr.Logger { - if std == nil { - // Go's log.Default() is only available in 1.16 and higher. - std = log.New(os.Stderr, "", log.LstdFlags) - } - - if opts.Depth < 0 { - opts.Depth = 0 - } - - fopts := funcr.Options{ - LogCaller: funcr.MessageClass(opts.LogCaller), - } - - sl := &logger{ - Formatter: funcr.NewFormatter(fopts), - std: std, - } - - // For skipping our own logger.Info/Error. - sl.Formatter.AddCallDepth(1 + opts.Depth) - - return logr.New(sl) -} - -// Options carries parameters which influence the way logs are generated. -type Options struct { - // Depth biases the assumed number of call frames to the "true" caller. - // This is useful when the calling code calls a function which then calls - // stdr (e.g. a logging shim to another API). Values less than zero will - // be treated as zero. - Depth int - - // LogCaller tells stdr to add a "caller" key to some or all log lines. - // Go's log package has options to log this natively, too. - LogCaller MessageClass - - // TODO: add an option to log the date/time -} - -// MessageClass indicates which category or categories of messages to consider. -type MessageClass int - -const ( - // None ignores all message classes. - None MessageClass = iota - // All considers all message classes. - All - // Info only considers info messages. - Info - // Error only considers error messages. - Error -) - -// StdLogger is the subset of the Go stdlib log.Logger API that is needed for -// this adapter. -type StdLogger interface { - // Output is the same as log.Output and log.Logger.Output. - Output(calldepth int, logline string) error -} - -type logger struct { - funcr.Formatter - std StdLogger -} - -var _ logr.LogSink = &logger{} -var _ logr.CallDepthLogSink = &logger{} - -func (l logger) Enabled(level int) bool { - return globalVerbosity >= level -} - -func (l logger) Info(level int, msg string, kvList ...interface{}) { - prefix, args := l.FormatInfo(level, msg, kvList) - if prefix != "" { - args = prefix + ": " + args - } - _ = l.std.Output(l.Formatter.GetDepth()+1, args) -} - -func (l logger) Error(err error, msg string, kvList ...interface{}) { - prefix, args := l.FormatError(err, msg, kvList) - if prefix != "" { - args = prefix + ": " + args - } - _ = l.std.Output(l.Formatter.GetDepth()+1, args) -} - -func (l logger) WithName(name string) logr.LogSink { - l.Formatter.AddName(name) - return &l -} - -func (l logger) WithValues(kvList ...interface{}) logr.LogSink { - l.Formatter.AddValues(kvList) - return &l -} - -func (l logger) WithCallDepth(depth int) logr.LogSink { - l.Formatter.AddCallDepth(depth) - return &l -} - -// Underlier exposes access to the underlying logging implementation. Since -// callers only have a logr.Logger, they have to know which implementation is -// in use, so this interface is less of an abstraction and more of way to test -// type conversion. -type Underlier interface { - GetUnderlying() StdLogger -} - -// GetUnderlying returns the StdLogger underneath this logger. Since StdLogger -// is itself an interface, the result may or may not be a Go log.Logger. -func (l logger) GetUnderlying() StdLogger { - return l.std -} diff --git a/vendor/github.com/google/uuid/CHANGELOG.md b/vendor/github.com/google/uuid/CHANGELOG.md deleted file mode 100644 index 7ec5ac7e..00000000 --- a/vendor/github.com/google/uuid/CHANGELOG.md +++ /dev/null @@ -1,41 +0,0 @@ -# Changelog - -## [1.6.0](https://github.com/google/uuid/compare/v1.5.0...v1.6.0) (2024-01-16) - - -### Features - -* add Max UUID constant ([#149](https://github.com/google/uuid/issues/149)) ([c58770e](https://github.com/google/uuid/commit/c58770eb495f55fe2ced6284f93c5158a62e53e3)) - - -### Bug Fixes - -* fix typo in version 7 uuid documentation ([#153](https://github.com/google/uuid/issues/153)) ([016b199](https://github.com/google/uuid/commit/016b199544692f745ffc8867b914129ecb47ef06)) -* Monotonicity in UUIDv7 ([#150](https://github.com/google/uuid/issues/150)) ([a2b2b32](https://github.com/google/uuid/commit/a2b2b32373ff0b1a312b7fdf6d38a977099698a6)) - -## [1.5.0](https://github.com/google/uuid/compare/v1.4.0...v1.5.0) (2023-12-12) - - -### Features - -* Validate UUID without creating new UUID ([#141](https://github.com/google/uuid/issues/141)) ([9ee7366](https://github.com/google/uuid/commit/9ee7366e66c9ad96bab89139418a713dc584ae29)) - -## [1.4.0](https://github.com/google/uuid/compare/v1.3.1...v1.4.0) (2023-10-26) - - -### Features - -* UUIDs slice type with Strings() convenience method ([#133](https://github.com/google/uuid/issues/133)) ([cd5fbbd](https://github.com/google/uuid/commit/cd5fbbdd02f3e3467ac18940e07e062be1f864b4)) - -### Fixes - -* Clarify that Parse's job is to parse but not necessarily validate strings. (Documents current behavior) - -## [1.3.1](https://github.com/google/uuid/compare/v1.3.0...v1.3.1) (2023-08-18) - - -### Bug Fixes - -* Use .EqualFold() to parse urn prefixed UUIDs ([#118](https://github.com/google/uuid/issues/118)) ([574e687](https://github.com/google/uuid/commit/574e6874943741fb99d41764c705173ada5293f0)) - -## Changelog diff --git a/vendor/github.com/google/uuid/CONTRIBUTING.md b/vendor/github.com/google/uuid/CONTRIBUTING.md deleted file mode 100644 index a502fdc5..00000000 --- a/vendor/github.com/google/uuid/CONTRIBUTING.md +++ /dev/null @@ -1,26 +0,0 @@ -# How to contribute - -We definitely welcome patches and contribution to this project! - -### Tips - -Commits must be formatted according to the [Conventional Commits Specification](https://www.conventionalcommits.org). - -Always try to include a test case! If it is not possible or not necessary, -please explain why in the pull request description. - -### Releasing - -Commits that would precipitate a SemVer change, as described in the Conventional -Commits Specification, will trigger [`release-please`](https://github.com/google-github-actions/release-please-action) -to create a release candidate pull request. Once submitted, `release-please` -will create a release. - -For tips on how to work with `release-please`, see its documentation. - -### Legal requirements - -In order to protect both you and ourselves, you will need to sign the -[Contributor License Agreement](https://cla.developers.google.com/clas). - -You may have already signed it for other Google projects. diff --git a/vendor/github.com/google/uuid/CONTRIBUTORS b/vendor/github.com/google/uuid/CONTRIBUTORS deleted file mode 100644 index b4bb97f6..00000000 --- a/vendor/github.com/google/uuid/CONTRIBUTORS +++ /dev/null @@ -1,9 +0,0 @@ -Paul Borman -bmatsuo -shawnps -theory -jboverfelt -dsymonds -cd1 -wallclockbuilder -dansouza diff --git a/vendor/github.com/google/uuid/LICENSE b/vendor/github.com/google/uuid/LICENSE deleted file mode 100644 index 5dc68268..00000000 --- a/vendor/github.com/google/uuid/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009,2014 Google Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/google/uuid/README.md b/vendor/github.com/google/uuid/README.md deleted file mode 100644 index 3e9a6188..00000000 --- a/vendor/github.com/google/uuid/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# uuid -The uuid package generates and inspects UUIDs based on -[RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122) -and DCE 1.1: Authentication and Security Services. - -This package is based on the github.com/pborman/uuid package (previously named -code.google.com/p/go-uuid). It differs from these earlier packages in that -a UUID is a 16 byte array rather than a byte slice. One loss due to this -change is the ability to represent an invalid UUID (vs a NIL UUID). - -###### Install -```sh -go get github.com/google/uuid -``` - -###### Documentation -[![Go Reference](https://pkg.go.dev/badge/github.com/google/uuid.svg)](https://pkg.go.dev/github.com/google/uuid) - -Full `go doc` style documentation for the package can be viewed online without -installing this package by using the GoDoc site here: -http://pkg.go.dev/github.com/google/uuid diff --git a/vendor/github.com/google/uuid/dce.go b/vendor/github.com/google/uuid/dce.go deleted file mode 100644 index fa820b9d..00000000 --- a/vendor/github.com/google/uuid/dce.go +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "encoding/binary" - "fmt" - "os" -) - -// A Domain represents a Version 2 domain -type Domain byte - -// Domain constants for DCE Security (Version 2) UUIDs. -const ( - Person = Domain(0) - Group = Domain(1) - Org = Domain(2) -) - -// NewDCESecurity returns a DCE Security (Version 2) UUID. -// -// The domain should be one of Person, Group or Org. -// On a POSIX system the id should be the users UID for the Person -// domain and the users GID for the Group. The meaning of id for -// the domain Org or on non-POSIX systems is site defined. -// -// For a given domain/id pair the same token may be returned for up to -// 7 minutes and 10 seconds. -func NewDCESecurity(domain Domain, id uint32) (UUID, error) { - uuid, err := NewUUID() - if err == nil { - uuid[6] = (uuid[6] & 0x0f) | 0x20 // Version 2 - uuid[9] = byte(domain) - binary.BigEndian.PutUint32(uuid[0:], id) - } - return uuid, err -} - -// NewDCEPerson returns a DCE Security (Version 2) UUID in the person -// domain with the id returned by os.Getuid. -// -// NewDCESecurity(Person, uint32(os.Getuid())) -func NewDCEPerson() (UUID, error) { - return NewDCESecurity(Person, uint32(os.Getuid())) -} - -// NewDCEGroup returns a DCE Security (Version 2) UUID in the group -// domain with the id returned by os.Getgid. -// -// NewDCESecurity(Group, uint32(os.Getgid())) -func NewDCEGroup() (UUID, error) { - return NewDCESecurity(Group, uint32(os.Getgid())) -} - -// Domain returns the domain for a Version 2 UUID. Domains are only defined -// for Version 2 UUIDs. -func (uuid UUID) Domain() Domain { - return Domain(uuid[9]) -} - -// ID returns the id for a Version 2 UUID. IDs are only defined for Version 2 -// UUIDs. -func (uuid UUID) ID() uint32 { - return binary.BigEndian.Uint32(uuid[0:4]) -} - -func (d Domain) String() string { - switch d { - case Person: - return "Person" - case Group: - return "Group" - case Org: - return "Org" - } - return fmt.Sprintf("Domain%d", int(d)) -} diff --git a/vendor/github.com/google/uuid/doc.go b/vendor/github.com/google/uuid/doc.go deleted file mode 100644 index 5b8a4b9a..00000000 --- a/vendor/github.com/google/uuid/doc.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package uuid generates and inspects UUIDs. -// -// UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security -// Services. -// -// A UUID is a 16 byte (128 bit) array. UUIDs may be used as keys to -// maps or compared directly. -package uuid diff --git a/vendor/github.com/google/uuid/hash.go b/vendor/github.com/google/uuid/hash.go deleted file mode 100644 index dc60082d..00000000 --- a/vendor/github.com/google/uuid/hash.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "crypto/md5" - "crypto/sha1" - "hash" -) - -// Well known namespace IDs and UUIDs -var ( - NameSpaceDNS = Must(Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8")) - NameSpaceURL = Must(Parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8")) - NameSpaceOID = Must(Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8")) - NameSpaceX500 = Must(Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8")) - Nil UUID // empty UUID, all zeros - - // The Max UUID is special form of UUID that is specified to have all 128 bits set to 1. - Max = UUID{ - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - } -) - -// NewHash returns a new UUID derived from the hash of space concatenated with -// data generated by h. The hash should be at least 16 byte in length. The -// first 16 bytes of the hash are used to form the UUID. The version of the -// UUID will be the lower 4 bits of version. NewHash is used to implement -// NewMD5 and NewSHA1. -func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID { - h.Reset() - h.Write(space[:]) //nolint:errcheck - h.Write(data) //nolint:errcheck - s := h.Sum(nil) - var uuid UUID - copy(uuid[:], s) - uuid[6] = (uuid[6] & 0x0f) | uint8((version&0xf)<<4) - uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 4122 variant - return uuid -} - -// NewMD5 returns a new MD5 (Version 3) UUID based on the -// supplied name space and data. It is the same as calling: -// -// NewHash(md5.New(), space, data, 3) -func NewMD5(space UUID, data []byte) UUID { - return NewHash(md5.New(), space, data, 3) -} - -// NewSHA1 returns a new SHA1 (Version 5) UUID based on the -// supplied name space and data. It is the same as calling: -// -// NewHash(sha1.New(), space, data, 5) -func NewSHA1(space UUID, data []byte) UUID { - return NewHash(sha1.New(), space, data, 5) -} diff --git a/vendor/github.com/google/uuid/marshal.go b/vendor/github.com/google/uuid/marshal.go deleted file mode 100644 index 14bd3407..00000000 --- a/vendor/github.com/google/uuid/marshal.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import "fmt" - -// MarshalText implements encoding.TextMarshaler. -func (uuid UUID) MarshalText() ([]byte, error) { - var js [36]byte - encodeHex(js[:], uuid) - return js[:], nil -} - -// UnmarshalText implements encoding.TextUnmarshaler. -func (uuid *UUID) UnmarshalText(data []byte) error { - id, err := ParseBytes(data) - if err != nil { - return err - } - *uuid = id - return nil -} - -// MarshalBinary implements encoding.BinaryMarshaler. -func (uuid UUID) MarshalBinary() ([]byte, error) { - return uuid[:], nil -} - -// UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (uuid *UUID) UnmarshalBinary(data []byte) error { - if len(data) != 16 { - return fmt.Errorf("invalid UUID (got %d bytes)", len(data)) - } - copy(uuid[:], data) - return nil -} diff --git a/vendor/github.com/google/uuid/node.go b/vendor/github.com/google/uuid/node.go deleted file mode 100644 index d651a2b0..00000000 --- a/vendor/github.com/google/uuid/node.go +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "sync" -) - -var ( - nodeMu sync.Mutex - ifname string // name of interface being used - nodeID [6]byte // hardware for version 1 UUIDs - zeroID [6]byte // nodeID with only 0's -) - -// NodeInterface returns the name of the interface from which the NodeID was -// derived. The interface "user" is returned if the NodeID was set by -// SetNodeID. -func NodeInterface() string { - defer nodeMu.Unlock() - nodeMu.Lock() - return ifname -} - -// SetNodeInterface selects the hardware address to be used for Version 1 UUIDs. -// If name is "" then the first usable interface found will be used or a random -// Node ID will be generated. If a named interface cannot be found then false -// is returned. -// -// SetNodeInterface never fails when name is "". -func SetNodeInterface(name string) bool { - defer nodeMu.Unlock() - nodeMu.Lock() - return setNodeInterface(name) -} - -func setNodeInterface(name string) bool { - iname, addr := getHardwareInterface(name) // null implementation for js - if iname != "" && addr != nil { - ifname = iname - copy(nodeID[:], addr) - return true - } - - // We found no interfaces with a valid hardware address. If name - // does not specify a specific interface generate a random Node ID - // (section 4.1.6) - if name == "" { - ifname = "random" - randomBits(nodeID[:]) - return true - } - return false -} - -// NodeID returns a slice of a copy of the current Node ID, setting the Node ID -// if not already set. -func NodeID() []byte { - defer nodeMu.Unlock() - nodeMu.Lock() - if nodeID == zeroID { - setNodeInterface("") - } - nid := nodeID - return nid[:] -} - -// SetNodeID sets the Node ID to be used for Version 1 UUIDs. The first 6 bytes -// of id are used. If id is less than 6 bytes then false is returned and the -// Node ID is not set. -func SetNodeID(id []byte) bool { - if len(id) < 6 { - return false - } - defer nodeMu.Unlock() - nodeMu.Lock() - copy(nodeID[:], id) - ifname = "user" - return true -} - -// NodeID returns the 6 byte node id encoded in uuid. It returns nil if uuid is -// not valid. The NodeID is only well defined for version 1 and 2 UUIDs. -func (uuid UUID) NodeID() []byte { - var node [6]byte - copy(node[:], uuid[10:]) - return node[:] -} diff --git a/vendor/github.com/google/uuid/node_js.go b/vendor/github.com/google/uuid/node_js.go deleted file mode 100644 index b2a0bc87..00000000 --- a/vendor/github.com/google/uuid/node_js.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2017 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build js - -package uuid - -// getHardwareInterface returns nil values for the JS version of the code. -// This removes the "net" dependency, because it is not used in the browser. -// Using the "net" library inflates the size of the transpiled JS code by 673k bytes. -func getHardwareInterface(name string) (string, []byte) { return "", nil } diff --git a/vendor/github.com/google/uuid/node_net.go b/vendor/github.com/google/uuid/node_net.go deleted file mode 100644 index 0cbbcddb..00000000 --- a/vendor/github.com/google/uuid/node_net.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2017 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !js - -package uuid - -import "net" - -var interfaces []net.Interface // cached list of interfaces - -// getHardwareInterface returns the name and hardware address of interface name. -// If name is "" then the name and hardware address of one of the system's -// interfaces is returned. If no interfaces are found (name does not exist or -// there are no interfaces) then "", nil is returned. -// -// Only addresses of at least 6 bytes are returned. -func getHardwareInterface(name string) (string, []byte) { - if interfaces == nil { - var err error - interfaces, err = net.Interfaces() - if err != nil { - return "", nil - } - } - for _, ifs := range interfaces { - if len(ifs.HardwareAddr) >= 6 && (name == "" || name == ifs.Name) { - return ifs.Name, ifs.HardwareAddr - } - } - return "", nil -} diff --git a/vendor/github.com/google/uuid/null.go b/vendor/github.com/google/uuid/null.go deleted file mode 100644 index d7fcbf28..00000000 --- a/vendor/github.com/google/uuid/null.go +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2021 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "bytes" - "database/sql/driver" - "encoding/json" - "fmt" -) - -var jsonNull = []byte("null") - -// NullUUID represents a UUID that may be null. -// NullUUID implements the SQL driver.Scanner interface so -// it can be used as a scan destination: -// -// var u uuid.NullUUID -// err := db.QueryRow("SELECT name FROM foo WHERE id=?", id).Scan(&u) -// ... -// if u.Valid { -// // use u.UUID -// } else { -// // NULL value -// } -// -type NullUUID struct { - UUID UUID - Valid bool // Valid is true if UUID is not NULL -} - -// Scan implements the SQL driver.Scanner interface. -func (nu *NullUUID) Scan(value interface{}) error { - if value == nil { - nu.UUID, nu.Valid = Nil, false - return nil - } - - err := nu.UUID.Scan(value) - if err != nil { - nu.Valid = false - return err - } - - nu.Valid = true - return nil -} - -// Value implements the driver Valuer interface. -func (nu NullUUID) Value() (driver.Value, error) { - if !nu.Valid { - return nil, nil - } - // Delegate to UUID Value function - return nu.UUID.Value() -} - -// MarshalBinary implements encoding.BinaryMarshaler. -func (nu NullUUID) MarshalBinary() ([]byte, error) { - if nu.Valid { - return nu.UUID[:], nil - } - - return []byte(nil), nil -} - -// UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (nu *NullUUID) UnmarshalBinary(data []byte) error { - if len(data) != 16 { - return fmt.Errorf("invalid UUID (got %d bytes)", len(data)) - } - copy(nu.UUID[:], data) - nu.Valid = true - return nil -} - -// MarshalText implements encoding.TextMarshaler. -func (nu NullUUID) MarshalText() ([]byte, error) { - if nu.Valid { - return nu.UUID.MarshalText() - } - - return jsonNull, nil -} - -// UnmarshalText implements encoding.TextUnmarshaler. -func (nu *NullUUID) UnmarshalText(data []byte) error { - id, err := ParseBytes(data) - if err != nil { - nu.Valid = false - return err - } - nu.UUID = id - nu.Valid = true - return nil -} - -// MarshalJSON implements json.Marshaler. -func (nu NullUUID) MarshalJSON() ([]byte, error) { - if nu.Valid { - return json.Marshal(nu.UUID) - } - - return jsonNull, nil -} - -// UnmarshalJSON implements json.Unmarshaler. -func (nu *NullUUID) UnmarshalJSON(data []byte) error { - if bytes.Equal(data, jsonNull) { - *nu = NullUUID{} - return nil // valid null UUID - } - err := json.Unmarshal(data, &nu.UUID) - nu.Valid = err == nil - return err -} diff --git a/vendor/github.com/google/uuid/sql.go b/vendor/github.com/google/uuid/sql.go deleted file mode 100644 index 2e02ec06..00000000 --- a/vendor/github.com/google/uuid/sql.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "database/sql/driver" - "fmt" -) - -// Scan implements sql.Scanner so UUIDs can be read from databases transparently. -// Currently, database types that map to string and []byte are supported. Please -// consult database-specific driver documentation for matching types. -func (uuid *UUID) Scan(src interface{}) error { - switch src := src.(type) { - case nil: - return nil - - case string: - // if an empty UUID comes from a table, we return a null UUID - if src == "" { - return nil - } - - // see Parse for required string format - u, err := Parse(src) - if err != nil { - return fmt.Errorf("Scan: %v", err) - } - - *uuid = u - - case []byte: - // if an empty UUID comes from a table, we return a null UUID - if len(src) == 0 { - return nil - } - - // assumes a simple slice of bytes if 16 bytes - // otherwise attempts to parse - if len(src) != 16 { - return uuid.Scan(string(src)) - } - copy((*uuid)[:], src) - - default: - return fmt.Errorf("Scan: unable to scan type %T into UUID", src) - } - - return nil -} - -// Value implements sql.Valuer so that UUIDs can be written to databases -// transparently. Currently, UUIDs map to strings. Please consult -// database-specific driver documentation for matching types. -func (uuid UUID) Value() (driver.Value, error) { - return uuid.String(), nil -} diff --git a/vendor/github.com/google/uuid/time.go b/vendor/github.com/google/uuid/time.go deleted file mode 100644 index c3511292..00000000 --- a/vendor/github.com/google/uuid/time.go +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "encoding/binary" - "sync" - "time" -) - -// A Time represents a time as the number of 100's of nanoseconds since 15 Oct -// 1582. -type Time int64 - -const ( - lillian = 2299160 // Julian day of 15 Oct 1582 - unix = 2440587 // Julian day of 1 Jan 1970 - epoch = unix - lillian // Days between epochs - g1582 = epoch * 86400 // seconds between epochs - g1582ns100 = g1582 * 10000000 // 100s of a nanoseconds between epochs -) - -var ( - timeMu sync.Mutex - lasttime uint64 // last time we returned - clockSeq uint16 // clock sequence for this run - - timeNow = time.Now // for testing -) - -// UnixTime converts t the number of seconds and nanoseconds using the Unix -// epoch of 1 Jan 1970. -func (t Time) UnixTime() (sec, nsec int64) { - sec = int64(t - g1582ns100) - nsec = (sec % 10000000) * 100 - sec /= 10000000 - return sec, nsec -} - -// GetTime returns the current Time (100s of nanoseconds since 15 Oct 1582) and -// clock sequence as well as adjusting the clock sequence as needed. An error -// is returned if the current time cannot be determined. -func GetTime() (Time, uint16, error) { - defer timeMu.Unlock() - timeMu.Lock() - return getTime() -} - -func getTime() (Time, uint16, error) { - t := timeNow() - - // If we don't have a clock sequence already, set one. - if clockSeq == 0 { - setClockSequence(-1) - } - now := uint64(t.UnixNano()/100) + g1582ns100 - - // If time has gone backwards with this clock sequence then we - // increment the clock sequence - if now <= lasttime { - clockSeq = ((clockSeq + 1) & 0x3fff) | 0x8000 - } - lasttime = now - return Time(now), clockSeq, nil -} - -// ClockSequence returns the current clock sequence, generating one if not -// already set. The clock sequence is only used for Version 1 UUIDs. -// -// The uuid package does not use global static storage for the clock sequence or -// the last time a UUID was generated. Unless SetClockSequence is used, a new -// random clock sequence is generated the first time a clock sequence is -// requested by ClockSequence, GetTime, or NewUUID. (section 4.2.1.1) -func ClockSequence() int { - defer timeMu.Unlock() - timeMu.Lock() - return clockSequence() -} - -func clockSequence() int { - if clockSeq == 0 { - setClockSequence(-1) - } - return int(clockSeq & 0x3fff) -} - -// SetClockSequence sets the clock sequence to the lower 14 bits of seq. Setting to -// -1 causes a new sequence to be generated. -func SetClockSequence(seq int) { - defer timeMu.Unlock() - timeMu.Lock() - setClockSequence(seq) -} - -func setClockSequence(seq int) { - if seq == -1 { - var b [2]byte - randomBits(b[:]) // clock sequence - seq = int(b[0])<<8 | int(b[1]) - } - oldSeq := clockSeq - clockSeq = uint16(seq&0x3fff) | 0x8000 // Set our variant - if oldSeq != clockSeq { - lasttime = 0 - } -} - -// Time returns the time in 100s of nanoseconds since 15 Oct 1582 encoded in -// uuid. The time is only defined for version 1, 2, 6 and 7 UUIDs. -func (uuid UUID) Time() Time { - var t Time - switch uuid.Version() { - case 6: - time := binary.BigEndian.Uint64(uuid[:8]) // Ignore uuid[6] version b0110 - t = Time(time) - case 7: - time := binary.BigEndian.Uint64(uuid[:8]) - t = Time((time>>16)*10000 + g1582ns100) - default: // forward compatible - time := int64(binary.BigEndian.Uint32(uuid[0:4])) - time |= int64(binary.BigEndian.Uint16(uuid[4:6])) << 32 - time |= int64(binary.BigEndian.Uint16(uuid[6:8])&0xfff) << 48 - t = Time(time) - } - return t -} - -// ClockSequence returns the clock sequence encoded in uuid. -// The clock sequence is only well defined for version 1 and 2 UUIDs. -func (uuid UUID) ClockSequence() int { - return int(binary.BigEndian.Uint16(uuid[8:10])) & 0x3fff -} diff --git a/vendor/github.com/google/uuid/util.go b/vendor/github.com/google/uuid/util.go deleted file mode 100644 index 5ea6c737..00000000 --- a/vendor/github.com/google/uuid/util.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "io" -) - -// randomBits completely fills slice b with random data. -func randomBits(b []byte) { - if _, err := io.ReadFull(rander, b); err != nil { - panic(err.Error()) // rand should never fail - } -} - -// xvalues returns the value of a byte as a hexadecimal digit or 255. -var xvalues = [256]byte{ - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255, - 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -} - -// xtob converts hex characters x1 and x2 into a byte. -func xtob(x1, x2 byte) (byte, bool) { - b1 := xvalues[x1] - b2 := xvalues[x2] - return (b1 << 4) | b2, b1 != 255 && b2 != 255 -} diff --git a/vendor/github.com/google/uuid/uuid.go b/vendor/github.com/google/uuid/uuid.go deleted file mode 100644 index 5232b486..00000000 --- a/vendor/github.com/google/uuid/uuid.go +++ /dev/null @@ -1,365 +0,0 @@ -// Copyright 2018 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "bytes" - "crypto/rand" - "encoding/hex" - "errors" - "fmt" - "io" - "strings" - "sync" -) - -// A UUID is a 128 bit (16 byte) Universal Unique IDentifier as defined in RFC -// 4122. -type UUID [16]byte - -// A Version represents a UUID's version. -type Version byte - -// A Variant represents a UUID's variant. -type Variant byte - -// Constants returned by Variant. -const ( - Invalid = Variant(iota) // Invalid UUID - RFC4122 // The variant specified in RFC4122 - Reserved // Reserved, NCS backward compatibility. - Microsoft // Reserved, Microsoft Corporation backward compatibility. - Future // Reserved for future definition. -) - -const randPoolSize = 16 * 16 - -var ( - rander = rand.Reader // random function - poolEnabled = false - poolMu sync.Mutex - poolPos = randPoolSize // protected with poolMu - pool [randPoolSize]byte // protected with poolMu -) - -type invalidLengthError struct{ len int } - -func (err invalidLengthError) Error() string { - return fmt.Sprintf("invalid UUID length: %d", err.len) -} - -// IsInvalidLengthError is matcher function for custom error invalidLengthError -func IsInvalidLengthError(err error) bool { - _, ok := err.(invalidLengthError) - return ok -} - -// Parse decodes s into a UUID or returns an error if it cannot be parsed. Both -// the standard UUID forms defined in RFC 4122 -// (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and -// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) are decoded. In addition, -// Parse accepts non-standard strings such as the raw hex encoding -// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx and 38 byte "Microsoft style" encodings, -// e.g. {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}. Only the middle 36 bytes are -// examined in the latter case. Parse should not be used to validate strings as -// it parses non-standard encodings as indicated above. -func Parse(s string) (UUID, error) { - var uuid UUID - switch len(s) { - // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - case 36: - - // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - case 36 + 9: - if !strings.EqualFold(s[:9], "urn:uuid:") { - return uuid, fmt.Errorf("invalid urn prefix: %q", s[:9]) - } - s = s[9:] - - // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} - case 36 + 2: - s = s[1:] - - // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - case 32: - var ok bool - for i := range uuid { - uuid[i], ok = xtob(s[i*2], s[i*2+1]) - if !ok { - return uuid, errors.New("invalid UUID format") - } - } - return uuid, nil - default: - return uuid, invalidLengthError{len(s)} - } - // s is now at least 36 bytes long - // it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { - return uuid, errors.New("invalid UUID format") - } - for i, x := range [16]int{ - 0, 2, 4, 6, - 9, 11, - 14, 16, - 19, 21, - 24, 26, 28, 30, 32, 34, - } { - v, ok := xtob(s[x], s[x+1]) - if !ok { - return uuid, errors.New("invalid UUID format") - } - uuid[i] = v - } - return uuid, nil -} - -// ParseBytes is like Parse, except it parses a byte slice instead of a string. -func ParseBytes(b []byte) (UUID, error) { - var uuid UUID - switch len(b) { - case 36: // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - case 36 + 9: // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - if !bytes.EqualFold(b[:9], []byte("urn:uuid:")) { - return uuid, fmt.Errorf("invalid urn prefix: %q", b[:9]) - } - b = b[9:] - case 36 + 2: // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} - b = b[1:] - case 32: // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - var ok bool - for i := 0; i < 32; i += 2 { - uuid[i/2], ok = xtob(b[i], b[i+1]) - if !ok { - return uuid, errors.New("invalid UUID format") - } - } - return uuid, nil - default: - return uuid, invalidLengthError{len(b)} - } - // s is now at least 36 bytes long - // it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - if b[8] != '-' || b[13] != '-' || b[18] != '-' || b[23] != '-' { - return uuid, errors.New("invalid UUID format") - } - for i, x := range [16]int{ - 0, 2, 4, 6, - 9, 11, - 14, 16, - 19, 21, - 24, 26, 28, 30, 32, 34, - } { - v, ok := xtob(b[x], b[x+1]) - if !ok { - return uuid, errors.New("invalid UUID format") - } - uuid[i] = v - } - return uuid, nil -} - -// MustParse is like Parse but panics if the string cannot be parsed. -// It simplifies safe initialization of global variables holding compiled UUIDs. -func MustParse(s string) UUID { - uuid, err := Parse(s) - if err != nil { - panic(`uuid: Parse(` + s + `): ` + err.Error()) - } - return uuid -} - -// FromBytes creates a new UUID from a byte slice. Returns an error if the slice -// does not have a length of 16. The bytes are copied from the slice. -func FromBytes(b []byte) (uuid UUID, err error) { - err = uuid.UnmarshalBinary(b) - return uuid, err -} - -// Must returns uuid if err is nil and panics otherwise. -func Must(uuid UUID, err error) UUID { - if err != nil { - panic(err) - } - return uuid -} - -// Validate returns an error if s is not a properly formatted UUID in one of the following formats: -// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -// {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} -// It returns an error if the format is invalid, otherwise nil. -func Validate(s string) error { - switch len(s) { - // Standard UUID format - case 36: - - // UUID with "urn:uuid:" prefix - case 36 + 9: - if !strings.EqualFold(s[:9], "urn:uuid:") { - return fmt.Errorf("invalid urn prefix: %q", s[:9]) - } - s = s[9:] - - // UUID enclosed in braces - case 36 + 2: - if s[0] != '{' || s[len(s)-1] != '}' { - return fmt.Errorf("invalid bracketed UUID format") - } - s = s[1 : len(s)-1] - - // UUID without hyphens - case 32: - for i := 0; i < len(s); i += 2 { - _, ok := xtob(s[i], s[i+1]) - if !ok { - return errors.New("invalid UUID format") - } - } - - default: - return invalidLengthError{len(s)} - } - - // Check for standard UUID format - if len(s) == 36 { - if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { - return errors.New("invalid UUID format") - } - for _, x := range []int{0, 2, 4, 6, 9, 11, 14, 16, 19, 21, 24, 26, 28, 30, 32, 34} { - if _, ok := xtob(s[x], s[x+1]); !ok { - return errors.New("invalid UUID format") - } - } - } - - return nil -} - -// String returns the string form of uuid, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -// , or "" if uuid is invalid. -func (uuid UUID) String() string { - var buf [36]byte - encodeHex(buf[:], uuid) - return string(buf[:]) -} - -// URN returns the RFC 2141 URN form of uuid, -// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, or "" if uuid is invalid. -func (uuid UUID) URN() string { - var buf [36 + 9]byte - copy(buf[:], "urn:uuid:") - encodeHex(buf[9:], uuid) - return string(buf[:]) -} - -func encodeHex(dst []byte, uuid UUID) { - hex.Encode(dst, uuid[:4]) - dst[8] = '-' - hex.Encode(dst[9:13], uuid[4:6]) - dst[13] = '-' - hex.Encode(dst[14:18], uuid[6:8]) - dst[18] = '-' - hex.Encode(dst[19:23], uuid[8:10]) - dst[23] = '-' - hex.Encode(dst[24:], uuid[10:]) -} - -// Variant returns the variant encoded in uuid. -func (uuid UUID) Variant() Variant { - switch { - case (uuid[8] & 0xc0) == 0x80: - return RFC4122 - case (uuid[8] & 0xe0) == 0xc0: - return Microsoft - case (uuid[8] & 0xe0) == 0xe0: - return Future - default: - return Reserved - } -} - -// Version returns the version of uuid. -func (uuid UUID) Version() Version { - return Version(uuid[6] >> 4) -} - -func (v Version) String() string { - if v > 15 { - return fmt.Sprintf("BAD_VERSION_%d", v) - } - return fmt.Sprintf("VERSION_%d", v) -} - -func (v Variant) String() string { - switch v { - case RFC4122: - return "RFC4122" - case Reserved: - return "Reserved" - case Microsoft: - return "Microsoft" - case Future: - return "Future" - case Invalid: - return "Invalid" - } - return fmt.Sprintf("BadVariant%d", int(v)) -} - -// SetRand sets the random number generator to r, which implements io.Reader. -// If r.Read returns an error when the package requests random data then -// a panic will be issued. -// -// Calling SetRand with nil sets the random number generator to the default -// generator. -func SetRand(r io.Reader) { - if r == nil { - rander = rand.Reader - return - } - rander = r -} - -// EnableRandPool enables internal randomness pool used for Random -// (Version 4) UUID generation. The pool contains random bytes read from -// the random number generator on demand in batches. Enabling the pool -// may improve the UUID generation throughput significantly. -// -// Since the pool is stored on the Go heap, this feature may be a bad fit -// for security sensitive applications. -// -// Both EnableRandPool and DisableRandPool are not thread-safe and should -// only be called when there is no possibility that New or any other -// UUID Version 4 generation function will be called concurrently. -func EnableRandPool() { - poolEnabled = true -} - -// DisableRandPool disables the randomness pool if it was previously -// enabled with EnableRandPool. -// -// Both EnableRandPool and DisableRandPool are not thread-safe and should -// only be called when there is no possibility that New or any other -// UUID Version 4 generation function will be called concurrently. -func DisableRandPool() { - poolEnabled = false - defer poolMu.Unlock() - poolMu.Lock() - poolPos = randPoolSize -} - -// UUIDs is a slice of UUID types. -type UUIDs []UUID - -// Strings returns a string slice containing the string form of each UUID in uuids. -func (uuids UUIDs) Strings() []string { - var uuidStrs = make([]string, len(uuids)) - for i, uuid := range uuids { - uuidStrs[i] = uuid.String() - } - return uuidStrs -} diff --git a/vendor/github.com/google/uuid/version1.go b/vendor/github.com/google/uuid/version1.go deleted file mode 100644 index 46310962..00000000 --- a/vendor/github.com/google/uuid/version1.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "encoding/binary" -) - -// NewUUID returns a Version 1 UUID based on the current NodeID and clock -// sequence, and the current time. If the NodeID has not been set by SetNodeID -// or SetNodeInterface then it will be set automatically. If the NodeID cannot -// be set NewUUID returns nil. If clock sequence has not been set by -// SetClockSequence then it will be set automatically. If GetTime fails to -// return the current NewUUID returns nil and an error. -// -// In most cases, New should be used. -func NewUUID() (UUID, error) { - var uuid UUID - now, seq, err := GetTime() - if err != nil { - return uuid, err - } - - timeLow := uint32(now & 0xffffffff) - timeMid := uint16((now >> 32) & 0xffff) - timeHi := uint16((now >> 48) & 0x0fff) - timeHi |= 0x1000 // Version 1 - - binary.BigEndian.PutUint32(uuid[0:], timeLow) - binary.BigEndian.PutUint16(uuid[4:], timeMid) - binary.BigEndian.PutUint16(uuid[6:], timeHi) - binary.BigEndian.PutUint16(uuid[8:], seq) - - nodeMu.Lock() - if nodeID == zeroID { - setNodeInterface("") - } - copy(uuid[10:], nodeID[:]) - nodeMu.Unlock() - - return uuid, nil -} diff --git a/vendor/github.com/google/uuid/version4.go b/vendor/github.com/google/uuid/version4.go deleted file mode 100644 index 7697802e..00000000 --- a/vendor/github.com/google/uuid/version4.go +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import "io" - -// New creates a new random UUID or panics. New is equivalent to -// the expression -// -// uuid.Must(uuid.NewRandom()) -func New() UUID { - return Must(NewRandom()) -} - -// NewString creates a new random UUID and returns it as a string or panics. -// NewString is equivalent to the expression -// -// uuid.New().String() -func NewString() string { - return Must(NewRandom()).String() -} - -// NewRandom returns a Random (Version 4) UUID. -// -// The strength of the UUIDs is based on the strength of the crypto/rand -// package. -// -// Uses the randomness pool if it was enabled with EnableRandPool. -// -// A note about uniqueness derived from the UUID Wikipedia entry: -// -// Randomly generated UUIDs have 122 random bits. One's annual risk of being -// hit by a meteorite is estimated to be one chance in 17 billion, that -// means the probability is about 0.00000000006 (6 × 10−11), -// equivalent to the odds of creating a few tens of trillions of UUIDs in a -// year and having one duplicate. -func NewRandom() (UUID, error) { - if !poolEnabled { - return NewRandomFromReader(rander) - } - return newRandomFromPool() -} - -// NewRandomFromReader returns a UUID based on bytes read from a given io.Reader. -func NewRandomFromReader(r io.Reader) (UUID, error) { - var uuid UUID - _, err := io.ReadFull(r, uuid[:]) - if err != nil { - return Nil, err - } - uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4 - uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10 - return uuid, nil -} - -func newRandomFromPool() (UUID, error) { - var uuid UUID - poolMu.Lock() - if poolPos == randPoolSize { - _, err := io.ReadFull(rander, pool[:]) - if err != nil { - poolMu.Unlock() - return Nil, err - } - poolPos = 0 - } - copy(uuid[:], pool[poolPos:(poolPos+16)]) - poolPos += 16 - poolMu.Unlock() - - uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4 - uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10 - return uuid, nil -} diff --git a/vendor/github.com/google/uuid/version6.go b/vendor/github.com/google/uuid/version6.go deleted file mode 100644 index 339a959a..00000000 --- a/vendor/github.com/google/uuid/version6.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2023 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import "encoding/binary" - -// UUID version 6 is a field-compatible version of UUIDv1, reordered for improved DB locality. -// It is expected that UUIDv6 will primarily be used in contexts where there are existing v1 UUIDs. -// Systems that do not involve legacy UUIDv1 SHOULD consider using UUIDv7 instead. -// -// see https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-03#uuidv6 -// -// NewV6 returns a Version 6 UUID based on the current NodeID and clock -// sequence, and the current time. If the NodeID has not been set by SetNodeID -// or SetNodeInterface then it will be set automatically. If the NodeID cannot -// be set NewV6 set NodeID is random bits automatically . If clock sequence has not been set by -// SetClockSequence then it will be set automatically. If GetTime fails to -// return the current NewV6 returns Nil and an error. -func NewV6() (UUID, error) { - var uuid UUID - now, seq, err := GetTime() - if err != nil { - return uuid, err - } - - /* - 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | time_high | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | time_mid | time_low_and_version | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - |clk_seq_hi_res | clk_seq_low | node (0-1) | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | node (2-5) | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - */ - - binary.BigEndian.PutUint64(uuid[0:], uint64(now)) - binary.BigEndian.PutUint16(uuid[8:], seq) - - uuid[6] = 0x60 | (uuid[6] & 0x0F) - uuid[8] = 0x80 | (uuid[8] & 0x3F) - - nodeMu.Lock() - if nodeID == zeroID { - setNodeInterface("") - } - copy(uuid[10:], nodeID[:]) - nodeMu.Unlock() - - return uuid, nil -} diff --git a/vendor/github.com/google/uuid/version7.go b/vendor/github.com/google/uuid/version7.go deleted file mode 100644 index 3167b643..00000000 --- a/vendor/github.com/google/uuid/version7.go +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2023 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "io" -) - -// UUID version 7 features a time-ordered value field derived from the widely -// implemented and well known Unix Epoch timestamp source, -// the number of milliseconds seconds since midnight 1 Jan 1970 UTC, leap seconds excluded. -// As well as improved entropy characteristics over versions 1 or 6. -// -// see https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-03#name-uuid-version-7 -// -// Implementations SHOULD utilize UUID version 7 over UUID version 1 and 6 if possible. -// -// NewV7 returns a Version 7 UUID based on the current time(Unix Epoch). -// Uses the randomness pool if it was enabled with EnableRandPool. -// On error, NewV7 returns Nil and an error -func NewV7() (UUID, error) { - uuid, err := NewRandom() - if err != nil { - return uuid, err - } - makeV7(uuid[:]) - return uuid, nil -} - -// NewV7FromReader returns a Version 7 UUID based on the current time(Unix Epoch). -// it use NewRandomFromReader fill random bits. -// On error, NewV7FromReader returns Nil and an error. -func NewV7FromReader(r io.Reader) (UUID, error) { - uuid, err := NewRandomFromReader(r) - if err != nil { - return uuid, err - } - - makeV7(uuid[:]) - return uuid, nil -} - -// makeV7 fill 48 bits time (uuid[0] - uuid[5]), set version b0111 (uuid[6]) -// uuid[8] already has the right version number (Variant is 10) -// see function NewV7 and NewV7FromReader -func makeV7(uuid []byte) { - /* - 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | unix_ts_ms | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | unix_ts_ms | ver | rand_a (12 bit seq) | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - |var| rand_b | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | rand_b | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - */ - _ = uuid[15] // bounds check - - t, s := getV7Time() - - uuid[0] = byte(t >> 40) - uuid[1] = byte(t >> 32) - uuid[2] = byte(t >> 24) - uuid[3] = byte(t >> 16) - uuid[4] = byte(t >> 8) - uuid[5] = byte(t) - - uuid[6] = 0x70 | (0x0F & byte(s>>8)) - uuid[7] = byte(s) -} - -// lastV7time is the last time we returned stored as: -// -// 52 bits of time in milliseconds since epoch -// 12 bits of (fractional nanoseconds) >> 8 -var lastV7time int64 - -const nanoPerMilli = 1000000 - -// getV7Time returns the time in milliseconds and nanoseconds / 256. -// The returned (milli << 12 + seq) is guarenteed to be greater than -// (milli << 12 + seq) returned by any previous call to getV7Time. -func getV7Time() (milli, seq int64) { - timeMu.Lock() - defer timeMu.Unlock() - - nano := timeNow().UnixNano() - milli = nano / nanoPerMilli - // Sequence number is between 0 and 3906 (nanoPerMilli>>8) - seq = (nano - milli*nanoPerMilli) >> 8 - now := milli<<12 + seq - if now <= lastV7time { - now = lastV7time + 1 - milli = now >> 12 - seq = now & 0xfff - } - lastV7time = now - return milli, seq -} diff --git a/vendor/github.com/mitchellh/go-homedir/LICENSE b/vendor/github.com/mitchellh/go-homedir/LICENSE deleted file mode 100644 index f9c841a5..00000000 --- a/vendor/github.com/mitchellh/go-homedir/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 Mitchell Hashimoto - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/mitchellh/go-homedir/README.md b/vendor/github.com/mitchellh/go-homedir/README.md deleted file mode 100644 index d70706d5..00000000 --- a/vendor/github.com/mitchellh/go-homedir/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# go-homedir - -This is a Go library for detecting the user's home directory without -the use of cgo, so the library can be used in cross-compilation environments. - -Usage is incredibly simple, just call `homedir.Dir()` to get the home directory -for a user, and `homedir.Expand()` to expand the `~` in a path to the home -directory. - -**Why not just use `os/user`?** The built-in `os/user` package requires -cgo on Darwin systems. This means that any Go code that uses that package -cannot cross compile. But 99% of the time the use for `os/user` is just to -retrieve the home directory, which we can do for the current user without -cgo. This library does that, enabling cross-compilation. diff --git a/vendor/github.com/mitchellh/go-homedir/homedir.go b/vendor/github.com/mitchellh/go-homedir/homedir.go deleted file mode 100644 index 25378537..00000000 --- a/vendor/github.com/mitchellh/go-homedir/homedir.go +++ /dev/null @@ -1,167 +0,0 @@ -package homedir - -import ( - "bytes" - "errors" - "os" - "os/exec" - "path/filepath" - "runtime" - "strconv" - "strings" - "sync" -) - -// DisableCache will disable caching of the home directory. Caching is enabled -// by default. -var DisableCache bool - -var homedirCache string -var cacheLock sync.RWMutex - -// Dir returns the home directory for the executing user. -// -// This uses an OS-specific method for discovering the home directory. -// An error is returned if a home directory cannot be detected. -func Dir() (string, error) { - if !DisableCache { - cacheLock.RLock() - cached := homedirCache - cacheLock.RUnlock() - if cached != "" { - return cached, nil - } - } - - cacheLock.Lock() - defer cacheLock.Unlock() - - var result string - var err error - if runtime.GOOS == "windows" { - result, err = dirWindows() - } else { - // Unix-like system, so just assume Unix - result, err = dirUnix() - } - - if err != nil { - return "", err - } - homedirCache = result - return result, nil -} - -// Expand expands the path to include the home directory if the path -// is prefixed with `~`. If it isn't prefixed with `~`, the path is -// returned as-is. -func Expand(path string) (string, error) { - if len(path) == 0 { - return path, nil - } - - if path[0] != '~' { - return path, nil - } - - if len(path) > 1 && path[1] != '/' && path[1] != '\\' { - return "", errors.New("cannot expand user-specific home dir") - } - - dir, err := Dir() - if err != nil { - return "", err - } - - return filepath.Join(dir, path[1:]), nil -} - -// Reset clears the cache, forcing the next call to Dir to re-detect -// the home directory. This generally never has to be called, but can be -// useful in tests if you're modifying the home directory via the HOME -// env var or something. -func Reset() { - cacheLock.Lock() - defer cacheLock.Unlock() - homedirCache = "" -} - -func dirUnix() (string, error) { - homeEnv := "HOME" - if runtime.GOOS == "plan9" { - // On plan9, env vars are lowercase. - homeEnv = "home" - } - - // First prefer the HOME environmental variable - if home := os.Getenv(homeEnv); home != "" { - return home, nil - } - - var stdout bytes.Buffer - - // If that fails, try OS specific commands - if runtime.GOOS == "darwin" { - cmd := exec.Command("sh", "-c", `dscl -q . -read /Users/"$(whoami)" NFSHomeDirectory | sed 's/^[^ ]*: //'`) - cmd.Stdout = &stdout - if err := cmd.Run(); err == nil { - result := strings.TrimSpace(stdout.String()) - if result != "" { - return result, nil - } - } - } else { - cmd := exec.Command("getent", "passwd", strconv.Itoa(os.Getuid())) - cmd.Stdout = &stdout - if err := cmd.Run(); err != nil { - // If the error is ErrNotFound, we ignore it. Otherwise, return it. - if err != exec.ErrNotFound { - return "", err - } - } else { - if passwd := strings.TrimSpace(stdout.String()); passwd != "" { - // username:password:uid:gid:gecos:home:shell - passwdParts := strings.SplitN(passwd, ":", 7) - if len(passwdParts) > 5 { - return passwdParts[5], nil - } - } - } - } - - // If all else fails, try the shell - stdout.Reset() - cmd := exec.Command("sh", "-c", "cd && pwd") - cmd.Stdout = &stdout - if err := cmd.Run(); err != nil { - return "", err - } - - result := strings.TrimSpace(stdout.String()) - if result == "" { - return "", errors.New("blank output when reading home directory") - } - - return result, nil -} - -func dirWindows() (string, error) { - // First prefer the HOME environmental variable - if home := os.Getenv("HOME"); home != "" { - return home, nil - } - - // Prefer standard environment variable USERPROFILE - if home := os.Getenv("USERPROFILE"); home != "" { - return home, nil - } - - drive := os.Getenv("HOMEDRIVE") - path := os.Getenv("HOMEPATH") - home := drive + path - if drive == "" || path == "" { - return "", errors.New("HOMEDRIVE, HOMEPATH, or USERPROFILE are blank") - } - - return home, nil -} diff --git a/vendor/github.com/sosodev/duration/.gitignore b/vendor/github.com/sosodev/duration/.gitignore deleted file mode 100644 index 485dee64..00000000 --- a/vendor/github.com/sosodev/duration/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.idea diff --git a/vendor/github.com/sosodev/duration/LICENSE b/vendor/github.com/sosodev/duration/LICENSE deleted file mode 100644 index 0e660e6f..00000000 --- a/vendor/github.com/sosodev/duration/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2022 Kyle McGough - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/sosodev/duration/duration.go b/vendor/github.com/sosodev/duration/duration.go deleted file mode 100644 index 17235535..00000000 --- a/vendor/github.com/sosodev/duration/duration.go +++ /dev/null @@ -1,301 +0,0 @@ -package duration - -import ( - "errors" - "fmt" - "math" - "strconv" - "time" - "unicode" -) - -// Duration holds all the smaller units that make up the duration -type Duration struct { - Years float64 - Months float64 - Weeks float64 - Days float64 - Hours float64 - Minutes float64 - Seconds float64 - Negative bool -} - -const ( - parsingPeriod = iota - parsingTime - - hoursPerDay = 24 - hoursPerWeek = hoursPerDay * 7 - hoursPerMonth = hoursPerYear / 12 - hoursPerYear = hoursPerDay * 365 - - nsPerSecond = 1000000000 - nsPerMinute = nsPerSecond * 60 - nsPerHour = nsPerMinute * 60 - nsPerDay = nsPerHour * hoursPerDay - nsPerWeek = nsPerHour * hoursPerWeek - nsPerMonth = nsPerHour * hoursPerMonth - nsPerYear = nsPerHour * hoursPerYear -) - -var ( - // ErrUnexpectedInput is returned when an input in the duration string does not match expectations - ErrUnexpectedInput = errors.New("unexpected input") -) - -// Parse attempts to parse the given duration string into a *Duration, -// if parsing fails an error is returned instead -func Parse(d string) (*Duration, error) { - state := parsingPeriod - duration := &Duration{} - num := "" - var err error - - for _, char := range d { - switch char { - case '-': - duration.Negative = true - case 'P': - state = parsingPeriod - case 'T': - state = parsingTime - case 'Y': - if state != parsingPeriod { - return nil, ErrUnexpectedInput - } - - duration.Years, err = strconv.ParseFloat(num, 64) - if err != nil { - return nil, err - } - num = "" - case 'M': - if state == parsingPeriod { - duration.Months, err = strconv.ParseFloat(num, 64) - if err != nil { - return nil, err - } - num = "" - } else if state == parsingTime { - duration.Minutes, err = strconv.ParseFloat(num, 64) - if err != nil { - return nil, err - } - num = "" - } - case 'W': - if state != parsingPeriod { - return nil, ErrUnexpectedInput - } - - duration.Weeks, err = strconv.ParseFloat(num, 64) - if err != nil { - return nil, err - } - num = "" - case 'D': - if state != parsingPeriod { - return nil, ErrUnexpectedInput - } - - duration.Days, err = strconv.ParseFloat(num, 64) - if err != nil { - return nil, err - } - num = "" - case 'H': - if state != parsingTime { - return nil, ErrUnexpectedInput - } - - duration.Hours, err = strconv.ParseFloat(num, 64) - if err != nil { - return nil, err - } - num = "" - case 'S': - if state != parsingTime { - return nil, ErrUnexpectedInput - } - - duration.Seconds, err = strconv.ParseFloat(num, 64) - if err != nil { - return nil, err - } - num = "" - default: - if unicode.IsNumber(char) || char == '.' { - num += string(char) - continue - } - - return nil, ErrUnexpectedInput - } - } - - return duration, nil -} - -// FromTimeDuration converts the given time.Duration into duration.Duration. -// Note that for *Duration's with period values of a month or year that the duration becomes a bit fuzzy -// since obviously those things vary month to month and year to year -func FromTimeDuration(d time.Duration) *Duration { - duration := &Duration{} - if d == 0 { - return duration - } - - if d < 0 { - d = -d - duration.Negative = true - } - - if d.Hours() >= hoursPerYear { - duration.Years = math.Floor(d.Hours() / hoursPerYear) - d -= time.Duration(duration.Years) * nsPerYear - } - if d.Hours() >= hoursPerMonth { - duration.Months = math.Floor(d.Hours() / hoursPerMonth) - d -= time.Duration(duration.Months) * nsPerMonth - } - if d.Hours() >= hoursPerWeek { - duration.Weeks = math.Floor(d.Hours() / hoursPerWeek) - d -= time.Duration(duration.Weeks) * nsPerWeek - } - if d.Hours() >= hoursPerDay { - duration.Days = math.Floor(d.Hours() / hoursPerDay) - d -= time.Duration(duration.Days) * nsPerDay - } - if d.Hours() >= 1 { - duration.Hours = math.Floor(d.Hours()) - d -= time.Duration(duration.Hours) * nsPerHour - } - if d.Minutes() >= 1 { - duration.Minutes = math.Floor(d.Minutes()) - d -= time.Duration(duration.Minutes) * nsPerMinute - } - duration.Seconds = d.Seconds() - - return duration -} - -// Format formats the given time.Duration into an ISO 8601 duration string (e.g. P1DT6H5M), -// negative durations are prefixed with a minus sign, for a zero duration "PT0S" is returned. -// Note that for *Duration's with period values of a month or year that the duration becomes a bit fuzzy -// since obviously those things vary month to month and year to year -func Format(d time.Duration) string { - return FromTimeDuration(d).String() -} - -// ToTimeDuration converts the *Duration to the standard library's time.Duration. -// Note that for *Duration's with period values of a month or year that the duration becomes a bit fuzzy -// since obviously those things vary month to month and year to year -func (duration *Duration) ToTimeDuration() time.Duration { - var timeDuration time.Duration - - // zero checks are here to avoid unnecessary math operations, on a durations such as `PT5M` - if duration.Years != 0 { - timeDuration += time.Duration(math.Round(duration.Years * nsPerYear)) - } - if duration.Months != 0 { - timeDuration += time.Duration(math.Round(duration.Months * nsPerMonth)) - } - if duration.Weeks != 0 { - timeDuration += time.Duration(math.Round(duration.Weeks * nsPerWeek)) - } - if duration.Days != 0 { - timeDuration += time.Duration(math.Round(duration.Days * nsPerDay)) - } - if duration.Hours != 0 { - timeDuration += time.Duration(math.Round(duration.Hours * nsPerHour)) - } - if duration.Minutes != 0 { - timeDuration += time.Duration(math.Round(duration.Minutes * nsPerMinute)) - } - if duration.Seconds != 0 { - timeDuration += time.Duration(math.Round(duration.Seconds * nsPerSecond)) - } - if duration.Negative { - timeDuration = -timeDuration - } - - return timeDuration -} - -// String returns the ISO8601 duration string for the *Duration -func (duration *Duration) String() string { - d := "P" - hasTime := false - - appendD := func(designator string, value float64, isTime bool) { - if !hasTime && isTime { - d += "T" - hasTime = true - } - - d += strconv.FormatFloat(value, 'f', -1, 64) + designator - } - - if duration.Years != 0 { - appendD("Y", duration.Years, false) - } - - if duration.Months != 0 { - appendD("M", duration.Months, false) - } - - if duration.Weeks != 0 { - appendD("W", duration.Weeks, false) - } - - if duration.Days != 0 { - appendD("D", duration.Days, false) - } - - if duration.Hours != 0 { - appendD("H", duration.Hours, true) - } - - if duration.Minutes != 0 { - appendD("M", duration.Minutes, true) - } - - if duration.Seconds != 0 { - appendD("S", duration.Seconds, true) - } - - // if the duration is zero, return "PT0S" - if d == "P" { - d += "T0S" - } - - if duration.Negative { - return "-" + d - } - - return d -} - -func (duration Duration) MarshalJSON() ([]byte, error) { - return []byte("\"" + duration.String() + "\""), nil -} - -func (duration *Duration) UnmarshalJSON(source []byte) error { - strVal := string(source) - if len(strVal) < 2 { - return fmt.Errorf("invalid ISO 8601 duration: %s", strVal) - } - strVal = strVal[1 : len(strVal)-1] - - if strVal == "null" { - return nil - } - - parsed, err := Parse(strVal) - if err != nil { - return fmt.Errorf("invalid ISO 8601 duration: %s", strVal) - } - *duration = *parsed - return nil -} diff --git a/vendor/github.com/sosodev/duration/readme.md b/vendor/github.com/sosodev/duration/readme.md deleted file mode 100644 index ec987dc5..00000000 --- a/vendor/github.com/sosodev/duration/readme.md +++ /dev/null @@ -1,54 +0,0 @@ -# duration - -[![Go Reference](https://pkg.go.dev/badge/github.com/sosodev/duration.svg)](https://pkg.go.dev/github.com/sosodev/duration) - -It's a Go module for parsing [ISO 8601 durations](https://en.wikipedia.org/wiki/ISO_8601#Durations) and converting them to the often much more useful `time.Duration`. - -## why? - -ISO 8601 is a pretty common standard and sometimes these durations show up in the wild. - -## installation - -`go get github.com/sosodev/duration` - -## [usage](https://go.dev/play/p/Nz5akjy1c6W) - -```go -package main - -import ( - "fmt" - "time" - "github.com/sosodev/duration" -) - -func main() { - d, err := duration.Parse("P3Y6M4DT12H30M5.5S") - if err != nil { - panic(err) - } - - fmt.Println(d.Years) // 3 - fmt.Println(d.Months) // 6 - fmt.Println(d.Days) // 4 - fmt.Println(d.Hours) // 12 - fmt.Println(d.Minutes) // 30 - fmt.Println(d.Seconds) // 5.5 - - d, err = duration.Parse("T33.3S") - if err != nil { - panic(err) - } - - fmt.Println(d.ToTimeDuration() == time.Second*33+time.Millisecond*300) // true -} -``` - -## correctness - -This module aims to implement the ISO 8601 duration specification correctly. It properly supports fractional units and has unit tests -that assert the correctness of it's parsing and conversion to a `time.Duration`. - -With that said durations with months or years specified will be converted to `time.Duration` with a little fuzziness. Since I -couldn't find a standard value, and they obviously vary, for those I used `2.628e+15` nanoseconds for a month and `3.154e+16` nanoseconds for a year. diff --git a/vendor/github.com/vektah/gqlparser/v2/LICENSE b/vendor/github.com/vektah/gqlparser/v2/LICENSE deleted file mode 100644 index 1221b9d3..00000000 --- a/vendor/github.com/vektah/gqlparser/v2/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2018 Adam Scarr - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/argmap.go b/vendor/github.com/vektah/gqlparser/v2/ast/argmap.go deleted file mode 100644 index 43f6a3d6..00000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/argmap.go +++ /dev/null @@ -1,37 +0,0 @@ -package ast - -func arg2map(defs ArgumentDefinitionList, args ArgumentList, vars map[string]interface{}) map[string]interface{} { - result := map[string]interface{}{} - var err error - - for _, argDef := range defs { - var val interface{} - var hasValue bool - - if argValue := args.ForName(argDef.Name); argValue != nil { - if argValue.Value.Kind == Variable { - val, hasValue = vars[argValue.Value.Raw] - } else { - val, err = argValue.Value.Value(vars) - if err != nil { - panic(err) - } - hasValue = true - } - } - - if !hasValue && argDef.DefaultValue != nil { - val, err = argDef.DefaultValue.Value(vars) - if err != nil { - panic(err) - } - hasValue = true - } - - if hasValue { - result[argDef.Name] = val - } - } - - return result -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/collections.go b/vendor/github.com/vektah/gqlparser/v2/ast/collections.go deleted file mode 100644 index 94b800ee..00000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/collections.go +++ /dev/null @@ -1,148 +0,0 @@ -package ast - -type FieldList []*FieldDefinition - -func (l FieldList) ForName(name string) *FieldDefinition { - for _, it := range l { - if it.Name == name { - return it - } - } - return nil -} - -type EnumValueList []*EnumValueDefinition - -func (l EnumValueList) ForName(name string) *EnumValueDefinition { - for _, it := range l { - if it.Name == name { - return it - } - } - return nil -} - -type DirectiveList []*Directive - -func (l DirectiveList) ForName(name string) *Directive { - for _, it := range l { - if it.Name == name { - return it - } - } - return nil -} - -func (l DirectiveList) ForNames(name string) []*Directive { - resp := []*Directive{} - for _, it := range l { - if it.Name == name { - resp = append(resp, it) - } - } - return resp -} - -type OperationList []*OperationDefinition - -func (l OperationList) ForName(name string) *OperationDefinition { - if name == "" && len(l) == 1 { - return l[0] - } - for _, it := range l { - if it.Name == name { - return it - } - } - return nil -} - -type FragmentDefinitionList []*FragmentDefinition - -func (l FragmentDefinitionList) ForName(name string) *FragmentDefinition { - for _, it := range l { - if it.Name == name { - return it - } - } - return nil -} - -type VariableDefinitionList []*VariableDefinition - -func (l VariableDefinitionList) ForName(name string) *VariableDefinition { - for _, it := range l { - if it.Variable == name { - return it - } - } - return nil -} - -type ArgumentList []*Argument - -func (l ArgumentList) ForName(name string) *Argument { - for _, it := range l { - if it.Name == name { - return it - } - } - return nil -} - -type ArgumentDefinitionList []*ArgumentDefinition - -func (l ArgumentDefinitionList) ForName(name string) *ArgumentDefinition { - for _, it := range l { - if it.Name == name { - return it - } - } - return nil -} - -type SchemaDefinitionList []*SchemaDefinition - -type DirectiveDefinitionList []*DirectiveDefinition - -func (l DirectiveDefinitionList) ForName(name string) *DirectiveDefinition { - for _, it := range l { - if it.Name == name { - return it - } - } - return nil -} - -type DefinitionList []*Definition - -func (l DefinitionList) ForName(name string) *Definition { - for _, it := range l { - if it.Name == name { - return it - } - } - return nil -} - -type OperationTypeDefinitionList []*OperationTypeDefinition - -func (l OperationTypeDefinitionList) ForType(name string) *OperationTypeDefinition { - for _, it := range l { - if it.Type == name { - return it - } - } - return nil -} - -type ChildValueList []*ChildValue - -func (v ChildValueList) ForName(name string) *Value { - for _, f := range v { - if f.Name == name { - return f.Value - } - } - return nil -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/comment.go b/vendor/github.com/vektah/gqlparser/v2/ast/comment.go deleted file mode 100644 index 8fcfda58..00000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/comment.go +++ /dev/null @@ -1,31 +0,0 @@ -package ast - -import ( - "strconv" - "strings" -) - -type Comment struct { - Value string - Position *Position -} - -func (c *Comment) Text() string { - return strings.TrimPrefix(c.Value, "#") -} - -type CommentGroup struct { - List []*Comment -} - -func (c *CommentGroup) Dump() string { - if len(c.List) == 0 { - return "" - } - var builder strings.Builder - for _, comment := range c.List { - builder.WriteString(comment.Value) - builder.WriteString("\n") - } - return strconv.Quote(builder.String()) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/decode.go b/vendor/github.com/vektah/gqlparser/v2/ast/decode.go deleted file mode 100644 index d0092055..00000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/decode.go +++ /dev/null @@ -1,216 +0,0 @@ -package ast - -import ( - "encoding/json" -) - -func UnmarshalSelectionSet(b []byte) (SelectionSet, error) { - var tmp []json.RawMessage - - if err := json.Unmarshal(b, &tmp); err != nil { - return nil, err - } - - var result = make([]Selection, 0) - for _, item := range tmp { - var field Field - if err := json.Unmarshal(item, &field); err == nil { - result = append(result, &field) - continue - } - var fragmentSpread FragmentSpread - if err := json.Unmarshal(item, &fragmentSpread); err == nil { - result = append(result, &fragmentSpread) - continue - } - var inlineFragment InlineFragment - if err := json.Unmarshal(item, &inlineFragment); err == nil { - result = append(result, &inlineFragment) - continue - } - } - - return result, nil -} - -func (f *FragmentDefinition) UnmarshalJSON(b []byte) error { - var tmp map[string]json.RawMessage - if err := json.Unmarshal(b, &tmp); err != nil { - return err - } - for k := range tmp { - switch k { - case "Name": - err := json.Unmarshal(tmp[k], &f.Name) - if err != nil { - return err - } - case "VariableDefinition": - err := json.Unmarshal(tmp[k], &f.VariableDefinition) - if err != nil { - return err - } - case "TypeCondition": - err := json.Unmarshal(tmp[k], &f.TypeCondition) - if err != nil { - return err - } - case "Directives": - err := json.Unmarshal(tmp[k], &f.Directives) - if err != nil { - return err - } - case "SelectionSet": - ss, err := UnmarshalSelectionSet(tmp[k]) - if err != nil { - return err - } - f.SelectionSet = ss - case "Definition": - err := json.Unmarshal(tmp[k], &f.Definition) - if err != nil { - return err - } - case "Position": - err := json.Unmarshal(tmp[k], &f.Position) - if err != nil { - return err - } - } - } - return nil -} - -func (f *InlineFragment) UnmarshalJSON(b []byte) error { - var tmp map[string]json.RawMessage - if err := json.Unmarshal(b, &tmp); err != nil { - return err - } - for k := range tmp { - switch k { - case "TypeCondition": - err := json.Unmarshal(tmp[k], &f.TypeCondition) - if err != nil { - return err - } - case "Directives": - err := json.Unmarshal(tmp[k], &f.Directives) - if err != nil { - return err - } - case "SelectionSet": - ss, err := UnmarshalSelectionSet(tmp[k]) - if err != nil { - return err - } - f.SelectionSet = ss - case "ObjectDefinition": - err := json.Unmarshal(tmp[k], &f.ObjectDefinition) - if err != nil { - return err - } - case "Position": - err := json.Unmarshal(tmp[k], &f.Position) - if err != nil { - return err - } - } - } - return nil -} - -func (f *OperationDefinition) UnmarshalJSON(b []byte) error { - var tmp map[string]json.RawMessage - if err := json.Unmarshal(b, &tmp); err != nil { - return err - } - for k := range tmp { - switch k { - case "Operation": - err := json.Unmarshal(tmp[k], &f.Operation) - if err != nil { - return err - } - case "Name": - err := json.Unmarshal(tmp[k], &f.Name) - if err != nil { - return err - } - case "VariableDefinitions": - err := json.Unmarshal(tmp[k], &f.VariableDefinitions) - if err != nil { - return err - } - case "Directives": - err := json.Unmarshal(tmp[k], &f.Directives) - if err != nil { - return err - } - case "SelectionSet": - ss, err := UnmarshalSelectionSet(tmp[k]) - if err != nil { - return err - } - f.SelectionSet = ss - case "Position": - err := json.Unmarshal(tmp[k], &f.Position) - if err != nil { - return err - } - } - } - return nil -} - -func (f *Field) UnmarshalJSON(b []byte) error { - var tmp map[string]json.RawMessage - if err := json.Unmarshal(b, &tmp); err != nil { - return err - } - for k := range tmp { - switch k { - case "Alias": - err := json.Unmarshal(tmp[k], &f.Alias) - if err != nil { - return err - } - case "Name": - err := json.Unmarshal(tmp[k], &f.Name) - if err != nil { - return err - } - case "Arguments": - err := json.Unmarshal(tmp[k], &f.Arguments) - if err != nil { - return err - } - case "Directives": - err := json.Unmarshal(tmp[k], &f.Directives) - if err != nil { - return err - } - case "SelectionSet": - ss, err := UnmarshalSelectionSet(tmp[k]) - if err != nil { - return err - } - f.SelectionSet = ss - case "Position": - err := json.Unmarshal(tmp[k], &f.Position) - if err != nil { - return err - } - case "Definition": - err := json.Unmarshal(tmp[k], &f.Definition) - if err != nil { - return err - } - case "ObjectDefinition": - err := json.Unmarshal(tmp[k], &f.ObjectDefinition) - if err != nil { - return err - } - } - } - return nil -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/definition.go b/vendor/github.com/vektah/gqlparser/v2/ast/definition.go deleted file mode 100644 index 3f0aa53d..00000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/definition.go +++ /dev/null @@ -1,110 +0,0 @@ -package ast - -type DefinitionKind string - -const ( - Scalar DefinitionKind = "SCALAR" - Object DefinitionKind = "OBJECT" - Interface DefinitionKind = "INTERFACE" - Union DefinitionKind = "UNION" - Enum DefinitionKind = "ENUM" - InputObject DefinitionKind = "INPUT_OBJECT" -) - -// Definition is the core type definition object, it includes all of the definable types -// but does *not* cover schema or directives. -// -// @vektah: Javascript implementation has different types for all of these, but they are -// more similar than different and don't define any behaviour. I think this style of -// "some hot" struct works better, at least for go. -// -// Type extensions are also represented by this same struct. -type Definition struct { - Kind DefinitionKind - Description string - Name string - Directives DirectiveList - Interfaces []string // object and input object - Fields FieldList // object and input object - Types []string // union - EnumValues EnumValueList // enum - - Position *Position `dump:"-"` - BuiltIn bool `dump:"-"` - - BeforeDescriptionComment *CommentGroup - AfterDescriptionComment *CommentGroup - EndOfDefinitionComment *CommentGroup -} - -func (d *Definition) IsLeafType() bool { - return d.Kind == Enum || d.Kind == Scalar -} - -func (d *Definition) IsAbstractType() bool { - return d.Kind == Interface || d.Kind == Union -} - -func (d *Definition) IsCompositeType() bool { - return d.Kind == Object || d.Kind == Interface || d.Kind == Union -} - -func (d *Definition) IsInputType() bool { - return d.Kind == Scalar || d.Kind == Enum || d.Kind == InputObject -} - -func (d *Definition) OneOf(types ...string) bool { - for _, t := range types { - if d.Name == t { - return true - } - } - return false -} - -type FieldDefinition struct { - Description string - Name string - Arguments ArgumentDefinitionList // only for objects - DefaultValue *Value // only for input objects - Type *Type - Directives DirectiveList - Position *Position `dump:"-"` - - BeforeDescriptionComment *CommentGroup - AfterDescriptionComment *CommentGroup -} - -type ArgumentDefinition struct { - Description string - Name string - DefaultValue *Value - Type *Type - Directives DirectiveList - Position *Position `dump:"-"` - - BeforeDescriptionComment *CommentGroup - AfterDescriptionComment *CommentGroup -} - -type EnumValueDefinition struct { - Description string - Name string - Directives DirectiveList - Position *Position `dump:"-"` - - BeforeDescriptionComment *CommentGroup - AfterDescriptionComment *CommentGroup -} - -type DirectiveDefinition struct { - Description string - Name string - Arguments ArgumentDefinitionList - Locations []DirectiveLocation - IsRepeatable bool - Position *Position `dump:"-"` - - BeforeDescriptionComment *CommentGroup - AfterDescriptionComment *CommentGroup -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/directive.go b/vendor/github.com/vektah/gqlparser/v2/ast/directive.go deleted file mode 100644 index 5f6e8531..00000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/directive.go +++ /dev/null @@ -1,43 +0,0 @@ -package ast - -type DirectiveLocation string - -const ( - // Executable - LocationQuery DirectiveLocation = `QUERY` - LocationMutation DirectiveLocation = `MUTATION` - LocationSubscription DirectiveLocation = `SUBSCRIPTION` - LocationField DirectiveLocation = `FIELD` - LocationFragmentDefinition DirectiveLocation = `FRAGMENT_DEFINITION` - LocationFragmentSpread DirectiveLocation = `FRAGMENT_SPREAD` - LocationInlineFragment DirectiveLocation = `INLINE_FRAGMENT` - - // Type System - LocationSchema DirectiveLocation = `SCHEMA` - LocationScalar DirectiveLocation = `SCALAR` - LocationObject DirectiveLocation = `OBJECT` - LocationFieldDefinition DirectiveLocation = `FIELD_DEFINITION` - LocationArgumentDefinition DirectiveLocation = `ARGUMENT_DEFINITION` - LocationInterface DirectiveLocation = `INTERFACE` - LocationUnion DirectiveLocation = `UNION` - LocationEnum DirectiveLocation = `ENUM` - LocationEnumValue DirectiveLocation = `ENUM_VALUE` - LocationInputObject DirectiveLocation = `INPUT_OBJECT` - LocationInputFieldDefinition DirectiveLocation = `INPUT_FIELD_DEFINITION` - LocationVariableDefinition DirectiveLocation = `VARIABLE_DEFINITION` -) - -type Directive struct { - Name string - Arguments ArgumentList - Position *Position `dump:"-"` - - // Requires validation - ParentDefinition *Definition - Definition *DirectiveDefinition - Location DirectiveLocation -} - -func (d *Directive) ArgumentMap(vars map[string]interface{}) map[string]interface{} { - return arg2map(d.Definition.Arguments, d.Arguments, vars) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/document.go b/vendor/github.com/vektah/gqlparser/v2/ast/document.go deleted file mode 100644 index a3a9e98d..00000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/document.go +++ /dev/null @@ -1,88 +0,0 @@ -package ast - -type QueryDocument struct { - Operations OperationList - Fragments FragmentDefinitionList - Position *Position `dump:"-"` - Comment *CommentGroup -} - -type SchemaDocument struct { - Schema SchemaDefinitionList - SchemaExtension SchemaDefinitionList - Directives DirectiveDefinitionList - Definitions DefinitionList - Extensions DefinitionList - Position *Position `dump:"-"` - Comment *CommentGroup -} - -func (d *SchemaDocument) Merge(other *SchemaDocument) { - d.Schema = append(d.Schema, other.Schema...) - d.SchemaExtension = append(d.SchemaExtension, other.SchemaExtension...) - d.Directives = append(d.Directives, other.Directives...) - d.Definitions = append(d.Definitions, other.Definitions...) - d.Extensions = append(d.Extensions, other.Extensions...) -} - -type Schema struct { - Query *Definition - Mutation *Definition - Subscription *Definition - - Types map[string]*Definition - Directives map[string]*DirectiveDefinition - - PossibleTypes map[string][]*Definition - Implements map[string][]*Definition - - Description string - - Comment *CommentGroup -} - -// AddTypes is the helper to add types definition to the schema -func (s *Schema) AddTypes(defs ...*Definition) { - if s.Types == nil { - s.Types = make(map[string]*Definition) - } - for _, def := range defs { - s.Types[def.Name] = def - } -} - -func (s *Schema) AddPossibleType(name string, def *Definition) { - s.PossibleTypes[name] = append(s.PossibleTypes[name], def) -} - -// GetPossibleTypes will enumerate all the definitions for a given interface or union -func (s *Schema) GetPossibleTypes(def *Definition) []*Definition { - return s.PossibleTypes[def.Name] -} - -func (s *Schema) AddImplements(name string, iface *Definition) { - s.Implements[name] = append(s.Implements[name], iface) -} - -// GetImplements returns all the interface and union definitions that the given definition satisfies -func (s *Schema) GetImplements(def *Definition) []*Definition { - return s.Implements[def.Name] -} - -type SchemaDefinition struct { - Description string - Directives DirectiveList - OperationTypes OperationTypeDefinitionList - Position *Position `dump:"-"` - - BeforeDescriptionComment *CommentGroup - AfterDescriptionComment *CommentGroup - EndOfDefinitionComment *CommentGroup -} - -type OperationTypeDefinition struct { - Operation Operation - Type string - Position *Position `dump:"-"` - Comment *CommentGroup -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/dumper.go b/vendor/github.com/vektah/gqlparser/v2/ast/dumper.go deleted file mode 100644 index dbb7a7ef..00000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/dumper.go +++ /dev/null @@ -1,159 +0,0 @@ -package ast - -import ( - "bytes" - "fmt" - "reflect" - "strconv" - "strings" -) - -// Dump turns ast into a stable string format for assertions in tests -func Dump(i interface{}) string { - v := reflect.ValueOf(i) - - d := dumper{Buffer: &bytes.Buffer{}} - d.dump(v) - - return d.String() -} - -type dumper struct { - *bytes.Buffer - indent int -} - -type Dumpable interface { - Dump() string -} - -func (d *dumper) dump(v reflect.Value) { - if dumpable, isDumpable := v.Interface().(Dumpable); isDumpable { - d.WriteString(dumpable.Dump()) - return - } - switch v.Kind() { - case reflect.Bool: - if v.Bool() { - d.WriteString("true") - } else { - d.WriteString("false") - } - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - d.WriteString(fmt.Sprintf("%d", v.Int())) - - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - d.WriteString(fmt.Sprintf("%d", v.Uint())) - - case reflect.Float32, reflect.Float64: - d.WriteString(fmt.Sprintf("%.2f", v.Float())) - - case reflect.String: - if v.Type().Name() != "string" { - d.WriteString(v.Type().Name() + "(" + strconv.Quote(v.String()) + ")") - } else { - d.WriteString(strconv.Quote(v.String())) - } - - case reflect.Array, reflect.Slice: - d.dumpArray(v) - - case reflect.Interface, reflect.Ptr: - d.dumpPtr(v) - - case reflect.Struct: - d.dumpStruct(v) - - default: - panic(fmt.Errorf("unsupported kind: %s\n buf: %s", v.Kind().String(), d.String())) - } -} - -func (d *dumper) writeIndent() { - d.Buffer.WriteString(strings.Repeat(" ", d.indent)) -} - -func (d *dumper) nl() { - d.Buffer.WriteByte('\n') - d.writeIndent() -} - -func typeName(t reflect.Type) string { - if t.Kind() == reflect.Ptr { - return typeName(t.Elem()) - } - return t.Name() -} - -func (d *dumper) dumpArray(v reflect.Value) { - d.WriteString("[" + typeName(v.Type().Elem()) + "]") - - for i := 0; i < v.Len(); i++ { - d.nl() - d.WriteString("- ") - d.indent++ - d.dump(v.Index(i)) - d.indent-- - } -} - -func (d *dumper) dumpStruct(v reflect.Value) { - d.WriteString("<" + v.Type().Name() + ">") - d.indent++ - - typ := v.Type() - for i := 0; i < v.NumField(); i++ { - f := v.Field(i) - if typ.Field(i).Tag.Get("dump") == "-" { - continue - } - - if isZero(f) { - continue - } - d.nl() - d.WriteString(typ.Field(i).Name) - d.WriteString(": ") - d.dump(v.Field(i)) - } - - d.indent-- -} - -func isZero(v reflect.Value) bool { - switch v.Kind() { - case reflect.Ptr, reflect.Interface: - return v.IsNil() - case reflect.Func, reflect.Map: - return v.IsNil() - - case reflect.Array, reflect.Slice: - if v.IsNil() { - return true - } - z := true - for i := 0; i < v.Len(); i++ { - z = z && isZero(v.Index(i)) - } - return z - case reflect.Struct: - z := true - for i := 0; i < v.NumField(); i++ { - z = z && isZero(v.Field(i)) - } - return z - case reflect.String: - return v.String() == "" - } - - // Compare other types directly: - return reflect.DeepEqual(v.Interface(), reflect.Zero(v.Type())) -} - -func (d *dumper) dumpPtr(v reflect.Value) { - if v.IsNil() { - d.WriteString("nil") - return - } - d.dump(v.Elem()) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/fragment.go b/vendor/github.com/vektah/gqlparser/v2/ast/fragment.go deleted file mode 100644 index 7bd7dbce..00000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/fragment.go +++ /dev/null @@ -1,41 +0,0 @@ -package ast - -type FragmentSpread struct { - Name string - Directives DirectiveList - - // Require validation - ObjectDefinition *Definition - Definition *FragmentDefinition - - Position *Position `dump:"-"` - Comment *CommentGroup -} - -type InlineFragment struct { - TypeCondition string - Directives DirectiveList - SelectionSet SelectionSet - - // Require validation - ObjectDefinition *Definition - - Position *Position `dump:"-"` - Comment *CommentGroup -} - -type FragmentDefinition struct { - Name string - // Note: fragment variable definitions are experimental and may be changed - // or removed in the future. - VariableDefinition VariableDefinitionList - TypeCondition string - Directives DirectiveList - SelectionSet SelectionSet - - // Require validation - Definition *Definition - - Position *Position `dump:"-"` - Comment *CommentGroup -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/operation.go b/vendor/github.com/vektah/gqlparser/v2/ast/operation.go deleted file mode 100644 index 16ee064d..00000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/operation.go +++ /dev/null @@ -1,32 +0,0 @@ -package ast - -type Operation string - -const ( - Query Operation = "query" - Mutation Operation = "mutation" - Subscription Operation = "subscription" -) - -type OperationDefinition struct { - Operation Operation - Name string - VariableDefinitions VariableDefinitionList - Directives DirectiveList - SelectionSet SelectionSet - Position *Position `dump:"-"` - Comment *CommentGroup -} - -type VariableDefinition struct { - Variable string - Type *Type - DefaultValue *Value - Directives DirectiveList - Position *Position `dump:"-"` - Comment *CommentGroup - - // Requires validation - Definition *Definition - Used bool `dump:"-"` -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/path.go b/vendor/github.com/vektah/gqlparser/v2/ast/path.go deleted file mode 100644 index 4f5c6748..00000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/path.go +++ /dev/null @@ -1,70 +0,0 @@ -package ast - -import ( - "bytes" - "encoding/json" - "fmt" -) - -var _ json.Unmarshaler = (*Path)(nil) - -type Path []PathElement - -type PathElement interface { - isPathElement() -} - -var _ PathElement = PathIndex(0) -var _ PathElement = PathName("") - -func (path Path) String() string { - if path == nil { - return "" - } - var str bytes.Buffer - for i, v := range path { - switch v := v.(type) { - case PathIndex: - str.WriteString(fmt.Sprintf("[%d]", v)) - case PathName: - if i != 0 { - str.WriteByte('.') - } - str.WriteString(string(v)) - default: - panic(fmt.Sprintf("unknown type: %T", v)) - } - } - return str.String() -} - -func (path *Path) UnmarshalJSON(b []byte) error { - var vs []interface{} - err := json.Unmarshal(b, &vs) - if err != nil { - return err - } - - *path = make([]PathElement, 0, len(vs)) - for _, v := range vs { - switch v := v.(type) { - case string: - *path = append(*path, PathName(v)) - case int: - *path = append(*path, PathIndex(v)) - case float64: - *path = append(*path, PathIndex(int(v))) - default: - return fmt.Errorf("unknown path element type: %T", v) - } - } - return nil -} - -type PathIndex int - -func (PathIndex) isPathElement() {} - -type PathName string - -func (PathName) isPathElement() {} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/selection.go b/vendor/github.com/vektah/gqlparser/v2/ast/selection.go deleted file mode 100644 index c927a4d3..00000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/selection.go +++ /dev/null @@ -1,41 +0,0 @@ -package ast - -type SelectionSet []Selection - -type Selection interface { - isSelection() - GetPosition() *Position -} - -func (*Field) isSelection() {} -func (*FragmentSpread) isSelection() {} -func (*InlineFragment) isSelection() {} - -func (f *Field) GetPosition() *Position { return f.Position } -func (s *FragmentSpread) GetPosition() *Position { return s.Position } -func (f *InlineFragment) GetPosition() *Position { return f.Position } - -type Field struct { - Alias string - Name string - Arguments ArgumentList - Directives DirectiveList - SelectionSet SelectionSet - Position *Position `dump:"-"` - Comment *CommentGroup - - // Require validation - Definition *FieldDefinition - ObjectDefinition *Definition -} - -type Argument struct { - Name string - Value *Value - Position *Position `dump:"-"` - Comment *CommentGroup -} - -func (f *Field) ArgumentMap(vars map[string]interface{}) map[string]interface{} { - return arg2map(f.Definition.Arguments, f.Arguments, vars) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/source.go b/vendor/github.com/vektah/gqlparser/v2/ast/source.go deleted file mode 100644 index 2949f83f..00000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/source.go +++ /dev/null @@ -1,19 +0,0 @@ -package ast - -// Source covers a single *.graphql file -type Source struct { - // Name is the filename of the source - Name string - // Input is the actual contents of the source file - Input string - // BuiltIn indicate whether the source is a part of the specification - BuiltIn bool -} - -type Position struct { - Start int // The starting position, in runes, of this token in the input. - End int // The end position, in runes, of this token in the input. - Line int // The line number at the start of this item. - Column int // The column number at the start of this item. - Src *Source // The source document this token belongs to -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/type.go b/vendor/github.com/vektah/gqlparser/v2/ast/type.go deleted file mode 100644 index 5f77bc7c..00000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/type.go +++ /dev/null @@ -1,68 +0,0 @@ -package ast - -func NonNullNamedType(named string, pos *Position) *Type { - return &Type{NamedType: named, NonNull: true, Position: pos} -} - -func NamedType(named string, pos *Position) *Type { - return &Type{NamedType: named, NonNull: false, Position: pos} -} - -func NonNullListType(elem *Type, pos *Position) *Type { - return &Type{Elem: elem, NonNull: true, Position: pos} -} - -func ListType(elem *Type, pos *Position) *Type { - return &Type{Elem: elem, NonNull: false, Position: pos} -} - -type Type struct { - NamedType string - Elem *Type - NonNull bool - Position *Position `dump:"-"` -} - -func (t *Type) Name() string { - if t.NamedType != "" { - return t.NamedType - } - - return t.Elem.Name() -} - -func (t *Type) String() string { - nn := "" - if t.NonNull { - nn = "!" - } - if t.NamedType != "" { - return t.NamedType + nn - } - - return "[" + t.Elem.String() + "]" + nn -} - -func (t *Type) IsCompatible(other *Type) bool { - if t.NamedType != other.NamedType { - return false - } - - if t.Elem != nil && other.Elem == nil { - return false - } - - if t.Elem != nil && !t.Elem.IsCompatible(other.Elem) { - return false - } - - if other.NonNull { - return t.NonNull - } - - return true -} - -func (t *Type) Dump() string { - return t.String() -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/value.go b/vendor/github.com/vektah/gqlparser/v2/ast/value.go deleted file mode 100644 index 10f7b1cc..00000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/value.go +++ /dev/null @@ -1,122 +0,0 @@ -package ast - -import ( - "fmt" - "strconv" - "strings" -) - -type ValueKind int - -const ( - Variable ValueKind = iota - IntValue - FloatValue - StringValue - BlockValue - BooleanValue - NullValue - EnumValue - ListValue - ObjectValue -) - -type Value struct { - Raw string - Children ChildValueList - Kind ValueKind - Position *Position `dump:"-"` - Comment *CommentGroup - - // Require validation - Definition *Definition - VariableDefinition *VariableDefinition - ExpectedType *Type -} - -type ChildValue struct { - Name string - Value *Value - Position *Position `dump:"-"` - Comment *CommentGroup -} - -func (v *Value) Value(vars map[string]interface{}) (interface{}, error) { - if v == nil { - return nil, nil - } - switch v.Kind { - case Variable: - if value, ok := vars[v.Raw]; ok { - return value, nil - } - if v.VariableDefinition != nil && v.VariableDefinition.DefaultValue != nil { - return v.VariableDefinition.DefaultValue.Value(vars) - } - return nil, nil - case IntValue: - return strconv.ParseInt(v.Raw, 10, 64) - case FloatValue: - return strconv.ParseFloat(v.Raw, 64) - case StringValue, BlockValue, EnumValue: - return v.Raw, nil - case BooleanValue: - return strconv.ParseBool(v.Raw) - case NullValue: - return nil, nil - case ListValue: - var val []interface{} - for _, elem := range v.Children { - elemVal, err := elem.Value.Value(vars) - if err != nil { - return val, err - } - val = append(val, elemVal) - } - return val, nil - case ObjectValue: - val := map[string]interface{}{} - for _, elem := range v.Children { - elemVal, err := elem.Value.Value(vars) - if err != nil { - return val, err - } - val[elem.Name] = elemVal - } - return val, nil - default: - panic(fmt.Errorf("unknown value kind %d", v.Kind)) - } -} - -func (v *Value) String() string { - if v == nil { - return "" - } - switch v.Kind { - case Variable: - return "$" + v.Raw - case IntValue, FloatValue, EnumValue, BooleanValue, NullValue: - return v.Raw - case StringValue, BlockValue: - return strconv.Quote(v.Raw) - case ListValue: - var val []string - for _, elem := range v.Children { - val = append(val, elem.Value.String()) - } - return "[" + strings.Join(val, ",") + "]" - case ObjectValue: - var val []string - for _, elem := range v.Children { - val = append(val, elem.Name+":"+elem.Value.String()) - } - return "{" + strings.Join(val, ",") + "}" - default: - panic(fmt.Errorf("unknown value kind %d", v.Kind)) - } -} - -func (v *Value) Dump() string { - return v.String() -} diff --git a/vendor/github.com/vektah/gqlparser/v2/gqlerror/error.go b/vendor/github.com/vektah/gqlparser/v2/gqlerror/error.go deleted file mode 100644 index 483a086d..00000000 --- a/vendor/github.com/vektah/gqlparser/v2/gqlerror/error.go +++ /dev/null @@ -1,186 +0,0 @@ -package gqlerror - -import ( - "bytes" - "errors" - "fmt" - "strconv" - - "github.com/vektah/gqlparser/v2/ast" -) - -// Error is the standard graphql error type described in https://spec.graphql.org/draft/#sec-Errors -type Error struct { - Err error `json:"-"` - Message string `json:"message"` - Path ast.Path `json:"path,omitempty"` - Locations []Location `json:"locations,omitempty"` - Extensions map[string]interface{} `json:"extensions,omitempty"` - Rule string `json:"-"` -} - -func (err *Error) SetFile(file string) { - if file == "" { - return - } - if err.Extensions == nil { - err.Extensions = map[string]interface{}{} - } - - err.Extensions["file"] = file -} - -type Location struct { - Line int `json:"line,omitempty"` - Column int `json:"column,omitempty"` -} - -type List []*Error - -func (err *Error) Error() string { - var res bytes.Buffer - if err == nil { - return "" - } - filename, _ := err.Extensions["file"].(string) - if filename == "" { - filename = "input" - } - res.WriteString(filename) - - if len(err.Locations) > 0 { - res.WriteByte(':') - res.WriteString(strconv.Itoa(err.Locations[0].Line)) - } - - res.WriteString(": ") - if ps := err.pathString(); ps != "" { - res.WriteString(ps) - res.WriteByte(' ') - } - - res.WriteString(err.Message) - - return res.String() -} - -func (err *Error) pathString() string { - return err.Path.String() -} - -func (err *Error) Unwrap() error { - return err.Err -} - -func (err *Error) AsError() error { - if err == nil { - return nil - } - return err -} - -func (errs List) Error() string { - var buf bytes.Buffer - for _, err := range errs { - buf.WriteString(err.Error()) - buf.WriteByte('\n') - } - return buf.String() -} - -func (errs List) Is(target error) bool { - for _, err := range errs { - if errors.Is(err, target) { - return true - } - } - return false -} - -func (errs List) As(target interface{}) bool { - for _, err := range errs { - if errors.As(err, target) { - return true - } - } - return false -} - -func (errs List) Unwrap() []error { - l := make([]error, len(errs)) - for i, err := range errs { - l[i] = err - } - return l -} - -func WrapPath(path ast.Path, err error) *Error { - if err == nil { - return nil - } - return &Error{ - Err: err, - Message: err.Error(), - Path: path, - } -} - -func Wrap(err error) *Error { - if err == nil { - return nil - } - return &Error{ - Err: err, - Message: err.Error(), - } -} - -func WrapIfUnwrapped(err error) *Error { - if err == nil { - return nil - } - if gqlErr, ok := err.(*Error); ok { - return gqlErr - } - return &Error{ - Err: err, - Message: err.Error(), - } -} - -func Errorf(message string, args ...interface{}) *Error { - return &Error{ - Message: fmt.Sprintf(message, args...), - } -} - -func ErrorPathf(path ast.Path, message string, args ...interface{}) *Error { - return &Error{ - Message: fmt.Sprintf(message, args...), - Path: path, - } -} - -func ErrorPosf(pos *ast.Position, message string, args ...interface{}) *Error { - return ErrorLocf( - pos.Src.Name, - pos.Line, - pos.Column, - message, - args..., - ) -} - -func ErrorLocf(file string, line int, col int, message string, args ...interface{}) *Error { - var extensions map[string]interface{} - if file != "" { - extensions = map[string]interface{}{"file": file} - } - return &Error{ - Message: fmt.Sprintf(message, args...), - Extensions: extensions, - Locations: []Location{ - {Line: line, Column: col}, - }, - } -} diff --git a/vendor/go.opentelemetry.io/otel/.codespellignore b/vendor/go.opentelemetry.io/otel/.codespellignore deleted file mode 100644 index 120b63a9..00000000 --- a/vendor/go.opentelemetry.io/otel/.codespellignore +++ /dev/null @@ -1,7 +0,0 @@ -ot -fo -te -collison -consequentially -ans -nam diff --git a/vendor/go.opentelemetry.io/otel/.codespellrc b/vendor/go.opentelemetry.io/otel/.codespellrc deleted file mode 100644 index 4afbb1fb..00000000 --- a/vendor/go.opentelemetry.io/otel/.codespellrc +++ /dev/null @@ -1,10 +0,0 @@ -# https://github.com/codespell-project/codespell -[codespell] -builtin = clear,rare,informal -check-filenames = -check-hidden = -ignore-words = .codespellignore -interactive = 1 -skip = .git,go.mod,go.sum,semconv,venv,.tools -uri-ignore-words-list = * -write = diff --git a/vendor/go.opentelemetry.io/otel/.gitattributes b/vendor/go.opentelemetry.io/otel/.gitattributes deleted file mode 100644 index 314766e9..00000000 --- a/vendor/go.opentelemetry.io/otel/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -* text=auto eol=lf -*.{cmd,[cC][mM][dD]} text eol=crlf -*.{bat,[bB][aA][tT]} text eol=crlf diff --git a/vendor/go.opentelemetry.io/otel/.gitignore b/vendor/go.opentelemetry.io/otel/.gitignore deleted file mode 100644 index 895c7664..00000000 --- a/vendor/go.opentelemetry.io/otel/.gitignore +++ /dev/null @@ -1,22 +0,0 @@ -.DS_Store -Thumbs.db - -.tools/ -venv/ -.idea/ -.vscode/ -*.iml -*.so -coverage.* -go.work -go.work.sum - -gen/ - -/example/dice/dice -/example/namedtracer/namedtracer -/example/otel-collector/otel-collector -/example/opencensus/opencensus -/example/passthrough/passthrough -/example/prometheus/prometheus -/example/zipkin/zipkin diff --git a/vendor/go.opentelemetry.io/otel/.gitmodules b/vendor/go.opentelemetry.io/otel/.gitmodules deleted file mode 100644 index 38a1f569..00000000 --- a/vendor/go.opentelemetry.io/otel/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "opentelemetry-proto"] - path = exporters/otlp/internal/opentelemetry-proto - url = https://github.com/open-telemetry/opentelemetry-proto diff --git a/vendor/go.opentelemetry.io/otel/.golangci.yml b/vendor/go.opentelemetry.io/otel/.golangci.yml deleted file mode 100644 index a62511f3..00000000 --- a/vendor/go.opentelemetry.io/otel/.golangci.yml +++ /dev/null @@ -1,296 +0,0 @@ -# See https://github.com/golangci/golangci-lint#config-file -run: - issues-exit-code: 1 #Default - tests: true #Default - -linters: - # Disable everything by default so upgrades to not include new "default - # enabled" linters. - disable-all: true - # Specifically enable linters we want to use. - enable: - - depguard - - errcheck - - godot - - gofumpt - - goimports - - gosec - - gosimple - - govet - - ineffassign - - misspell - - revive - - staticcheck - - typecheck - - unused - -issues: - # Maximum issues count per one linter. - # Set to 0 to disable. - # Default: 50 - # Setting to unlimited so the linter only is run once to debug all issues. - max-issues-per-linter: 0 - # Maximum count of issues with the same text. - # Set to 0 to disable. - # Default: 3 - # Setting to unlimited so the linter only is run once to debug all issues. - max-same-issues: 0 - # Excluding configuration per-path, per-linter, per-text and per-source. - exclude-rules: - # TODO: Having appropriate comments for exported objects helps development, - # even for objects in internal packages. Appropriate comments for all - # exported objects should be added and this exclusion removed. - - path: '.*internal/.*' - text: "exported (method|function|type|const) (.+) should have comment or be unexported" - linters: - - revive - # Yes, they are, but it's okay in a test. - - path: _test\.go - text: "exported func.*returns unexported type.*which can be annoying to use" - linters: - - revive - # Example test functions should be treated like main. - - path: example.*_test\.go - text: "calls to (.+) only in main[(][)] or init[(][)] functions" - linters: - - revive - # It's okay to not run gosec in a test. - - path: _test\.go - linters: - - gosec - # Igonoring gosec G404: Use of weak random number generator (math/rand instead of crypto/rand) - # as we commonly use it in tests and examples. - - text: "G404:" - linters: - - gosec - # Igonoring gosec G402: TLS MinVersion too low - # as the https://pkg.go.dev/crypto/tls#Config handles MinVersion default well. - - text: "G402: TLS MinVersion too low." - linters: - - gosec - include: - # revive exported should have comment or be unexported. - - EXC0012 - # revive package comment should be of the form ... - - EXC0013 - -linters-settings: - depguard: - rules: - non-tests: - files: - - "!$test" - - "!**/*test/*.go" - - "!**/internal/matchers/*.go" - deny: - - pkg: "testing" - - pkg: "github.com/stretchr/testify" - - pkg: "crypto/md5" - - pkg: "crypto/sha1" - - pkg: "crypto/**/pkix" - otlp-internal: - files: - - "!**/exporters/otlp/internal/**/*.go" - deny: - - pkg: "go.opentelemetry.io/otel/exporters/otlp/internal" - desc: Do not use cross-module internal packages. - otlptrace-internal: - files: - - "!**/exporters/otlp/otlptrace/*.go" - - "!**/exporters/otlp/otlptrace/internal/**.go" - deny: - - pkg: "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal" - desc: Do not use cross-module internal packages. - otlpmetric-internal: - files: - - "!**/exporters/otlp/otlpmetric/internal/*.go" - - "!**/exporters/otlp/otlpmetric/internal/**/*.go" - deny: - - pkg: "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" - desc: Do not use cross-module internal packages. - otel-internal: - files: - - "**/sdk/*.go" - - "**/sdk/**/*.go" - - "**/exporters/*.go" - - "**/exporters/**/*.go" - - "**/schema/*.go" - - "**/schema/**/*.go" - - "**/metric/*.go" - - "**/metric/**/*.go" - - "**/bridge/*.go" - - "**/bridge/**/*.go" - - "**/example/*.go" - - "**/example/**/*.go" - - "**/trace/*.go" - - "**/trace/**/*.go" - deny: - - pkg: "go.opentelemetry.io/otel/internal$" - desc: Do not use cross-module internal packages. - - pkg: "go.opentelemetry.io/otel/internal/attribute" - desc: Do not use cross-module internal packages. - - pkg: "go.opentelemetry.io/otel/internal/internaltest" - desc: Do not use cross-module internal packages. - - pkg: "go.opentelemetry.io/otel/internal/matchers" - desc: Do not use cross-module internal packages. - godot: - exclude: - # Exclude links. - - '^ *\[[^]]+\]:' - # Exclude sentence fragments for lists. - - '^[ ]*[-•]' - # Exclude sentences prefixing a list. - - ':$' - goimports: - local-prefixes: go.opentelemetry.io - misspell: - locale: US - ignore-words: - - cancelled - revive: - # Sets the default failure confidence. - # This means that linting errors with less than 0.8 confidence will be ignored. - # Default: 0.8 - confidence: 0.01 - rules: - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#blank-imports - - name: blank-imports - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bool-literal-in-expr - - name: bool-literal-in-expr - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#constant-logical-expr - - name: constant-logical-expr - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-as-argument - # TODO (#3372) re-enable linter when it is compatible. https://github.com/golangci/golangci-lint/issues/3280 - - name: context-as-argument - disabled: true - arguments: - allowTypesBefore: "*testing.T" - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-keys-type - - name: context-keys-type - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#deep-exit - - name: deep-exit - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#defer - - name: defer - disabled: false - arguments: - - ["call-chain", "loop"] - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#dot-imports - - name: dot-imports - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#duplicated-imports - - name: duplicated-imports - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#early-return - - name: early-return - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-block - - name: empty-block - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-lines - - name: empty-lines - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-naming - - name: error-naming - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-return - - name: error-return - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-strings - - name: error-strings - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#errorf - - name: errorf - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#exported - - name: exported - disabled: false - arguments: - - "sayRepetitiveInsteadOfStutters" - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#flag-parameter - - name: flag-parameter - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#identical-branches - - name: identical-branches - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#if-return - - name: if-return - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#increment-decrement - - name: increment-decrement - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#indent-error-flow - - name: indent-error-flow - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#import-shadowing - - name: import-shadowing - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#package-comments - - name: package-comments - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#range - - name: range - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#range-val-in-closure - - name: range-val-in-closure - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#range-val-address - - name: range-val-address - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#redefines-builtin-id - - name: redefines-builtin-id - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#string-format - - name: string-format - disabled: false - arguments: - - - panic - - '/^[^\n]*$/' - - must not contain line breaks - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#struct-tag - - name: struct-tag - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#superfluous-else - - name: superfluous-else - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#time-equal - - name: time-equal - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#var-naming - - name: var-naming - disabled: false - arguments: - - ["ID"] # AllowList - - ["Otel", "Aws", "Gcp"] # DenyList - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#var-declaration - - name: var-declaration - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unconditional-recursion - - name: unconditional-recursion - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-return - - name: unexported-return - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unhandled-error - - name: unhandled-error - disabled: false - arguments: - - "fmt.Fprint" - - "fmt.Fprintf" - - "fmt.Fprintln" - - "fmt.Print" - - "fmt.Printf" - - "fmt.Println" - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unnecessary-stmt - - name: unnecessary-stmt - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#useless-break - - name: useless-break - disabled: false - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#waitgroup-by-value - - name: waitgroup-by-value - disabled: false diff --git a/vendor/go.opentelemetry.io/otel/.lycheeignore b/vendor/go.opentelemetry.io/otel/.lycheeignore deleted file mode 100644 index 40d62fa2..00000000 --- a/vendor/go.opentelemetry.io/otel/.lycheeignore +++ /dev/null @@ -1,6 +0,0 @@ -http://localhost -http://jaeger-collector -https://github.com/open-telemetry/opentelemetry-go/milestone/ -https://github.com/open-telemetry/opentelemetry-go/projects -file:///home/runner/work/opentelemetry-go/opentelemetry-go/libraries -file:///home/runner/work/opentelemetry-go/opentelemetry-go/manual diff --git a/vendor/go.opentelemetry.io/otel/.markdownlint.yaml b/vendor/go.opentelemetry.io/otel/.markdownlint.yaml deleted file mode 100644 index 3202496c..00000000 --- a/vendor/go.opentelemetry.io/otel/.markdownlint.yaml +++ /dev/null @@ -1,29 +0,0 @@ -# Default state for all rules -default: true - -# ul-style -MD004: false - -# hard-tabs -MD010: false - -# line-length -MD013: false - -# no-duplicate-header -MD024: - siblings_only: true - -#single-title -MD025: false - -# ol-prefix -MD029: - style: ordered - -# no-inline-html -MD033: false - -# fenced-code-language -MD040: false - diff --git a/vendor/go.opentelemetry.io/otel/CHANGELOG.md b/vendor/go.opentelemetry.io/otel/CHANGELOG.md deleted file mode 100644 index 98f2d204..00000000 --- a/vendor/go.opentelemetry.io/otel/CHANGELOG.md +++ /dev/null @@ -1,2939 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - -This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -## [1.24.0/0.46.0/0.0.1-alpha] 2024-02-23 - -This release is the last to support [Go 1.20]. -The next release will require at least [Go 1.21]. - -### Added - -- Support [Go 1.22]. (#4890) -- Add exemplar support to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4900) -- Add exemplar support to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4900) -- The `go.opentelemetry.io/otel/log` module is added. - This module includes OpenTelemetry Go's implementation of the Logs Bridge API. - This module is in an alpha state, it is subject to breaking changes. - See our [versioning policy](./VERSIONING.md) for more info. (#4961) - -### Fixed - -- Fix registration of multiple callbacks when using the global meter provider from `go.opentelemetry.io/otel`. (#4945) -- Fix negative buckets in output of exponential histograms. (#4956) - -## [1.23.1] 2024-02-07 - -### Fixed - -- Register all callbacks passed during observable instrument creation instead of just the last one multiple times in `go.opentelemetry.io/otel/sdk/metric`. (#4888) - -## [1.23.0] 2024-02-06 - -This release contains the first stable, `v1`, release of the following modules: - -- `go.opentelemetry.io/otel/bridge/opencensus` -- `go.opentelemetry.io/otel/bridge/opencensus/test` -- `go.opentelemetry.io/otel/example/opencensus` -- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` -- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` -- `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` - -See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. - -### Added - -- Add `WithEndpointURL` option to the `exporters/otlp/otlpmetric/otlpmetricgrpc`, `exporters/otlp/otlpmetric/otlpmetrichttp`, `exporters/otlp/otlptrace/otlptracegrpc` and `exporters/otlp/otlptrace/otlptracehttp` packages. (#4808) -- Experimental exemplar exporting is added to the metric SDK. - See [metric documentation](./sdk/metric/internal/x/README.md#exemplars) for more information about this feature and how to enable it. (#4871) -- `ErrSchemaURLConflict` is added to `go.opentelemetry.io/otel/sdk/resource`. - This error is returned when a merge of two `Resource`s with different (non-empty) schema URL is attempted. (#4876) - -### Changed - -- The `Merge` and `New` functions in `go.opentelemetry.io/otel/sdk/resource` now returns a partial result if there is a schema URL merge conflict. - Instead of returning `nil` when two `Resource`s with different (non-empty) schema URLs are merged the merged `Resource`, along with the new `ErrSchemaURLConflict` error, is returned. - It is up to the user to decide if they want to use the returned `Resource` or not. - It may have desired attributes overwritten or include stale semantic conventions. (#4876) - -### Fixed - -- Fix `ContainerID` resource detection on systemd when cgroup path has a colon. (#4449) -- Fix `go.opentelemetry.io/otel/sdk/metric` to cache instruments to avoid leaking memory when the same instrument is created multiple times. (#4820) -- Fix missing `Mix` and `Max` values for `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` by introducing `MarshalText` and `MarshalJSON` for the `Extrema` type in `go.opentelemetry.io/sdk/metric/metricdata`. (#4827) - -## [1.23.0-rc.1] 2024-01-18 - -This is a release candidate for the v1.23.0 release. -That release is expected to include the `v1` release of the following modules: - -- `go.opentelemetry.io/otel/bridge/opencensus` -- `go.opentelemetry.io/otel/bridge/opencensus/test` -- `go.opentelemetry.io/otel/example/opencensus` -- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` -- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` -- `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` - -See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. - -## [1.22.0/0.45.0] 2024-01-17 - -### Added - -- The `go.opentelemetry.io/otel/semconv/v1.22.0` package. - The package contains semantic conventions from the `v1.22.0` version of the OpenTelemetry Semantic Conventions. (#4735) -- The `go.opentelemetry.io/otel/semconv/v1.23.0` package. - The package contains semantic conventions from the `v1.23.0` version of the OpenTelemetry Semantic Conventions. (#4746) -- The `go.opentelemetry.io/otel/semconv/v1.23.1` package. - The package contains semantic conventions from the `v1.23.1` version of the OpenTelemetry Semantic Conventions. (#4749) -- The `go.opentelemetry.io/otel/semconv/v1.24.0` package. - The package contains semantic conventions from the `v1.24.0` version of the OpenTelemetry Semantic Conventions. (#4770) -- Add `WithResourceAsConstantLabels` option to apply resource attributes for every metric emitted by the Prometheus exporter. (#4733) -- Experimental cardinality limiting is added to the metric SDK. - See [metric documentation](./sdk/metric/internal/x/README.md#cardinality-limit) for more information about this feature and how to enable it. (#4457) -- Add `NewMemberRaw` and `NewKeyValuePropertyRaw` in `go.opentelemetry.io/otel/baggage`. (#4804) - -### Changed - -- Upgrade all use of `go.opentelemetry.io/otel/semconv` to use `v1.24.0`. (#4754) -- Update transformations in `go.opentelemetry.io/otel/exporters/zipkin` to follow `v1.24.0` version of the OpenTelemetry specification. (#4754) -- Record synchronous measurements when the passed context is canceled instead of dropping in `go.opentelemetry.io/otel/sdk/metric`. - If you do not want to make a measurement when the context is cancelled, you need to handle it yourself (e.g `if ctx.Err() != nil`). (#4671) -- Improve `go.opentelemetry.io/otel/trace.TraceState`'s performance. (#4722) -- Improve `go.opentelemetry.io/otel/propagation.TraceContext`'s performance. (#4721) -- Improve `go.opentelemetry.io/otel/baggage` performance. (#4743) -- Improve performance of the `(*Set).Filter` method in `go.opentelemetry.io/otel/attribute` when the passed filter does not filter out any attributes from the set. (#4774) -- `Member.String` in `go.opentelemetry.io/otel/baggage` percent-encodes only when necessary. (#4775) -- Improve `go.opentelemetry.io/otel/trace.Span`'s performance when adding multiple attributes. (#4818) -- `Property.Value` in `go.opentelemetry.io/otel/baggage` now returns a raw string instead of a percent-encoded value. (#4804) - -### Fixed - -- Fix `Parse` in `go.opentelemetry.io/otel/baggage` to validate member value before percent-decoding. (#4755) -- Fix whitespace encoding of `Member.String` in `go.opentelemetry.io/otel/baggage`. (#4756) -- Fix observable not registered error when the asynchronous instrument has a drop aggregation in `go.opentelemetry.io/otel/sdk/metric`. (#4772) -- Fix baggage item key so that it is not canonicalized in `go.opentelemetry.io/otel/bridge/opentracing`. (#4776) -- Fix `go.opentelemetry.io/otel/bridge/opentracing` to properly handle baggage values that requires escaping during propagation. (#4804) -- Fix a bug where using multiple readers resulted in incorrect asynchronous counter values in `go.opentelemetry.io/otel/sdk/metric`. (#4742) - -## [1.21.0/0.44.0] 2023-11-16 - -### Removed - -- Remove the deprecated `go.opentelemetry.io/otel/bridge/opencensus.NewTracer`. (#4706) -- Remove the deprecated `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` module. (#4707) -- Remove the deprecated `go.opentelemetry.io/otel/example/view` module. (#4708) -- Remove the deprecated `go.opentelemetry.io/otel/example/fib` module. (#4723) - -### Fixed - -- Do not parse non-protobuf responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4719) -- Do not parse non-protobuf responses in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4719) - -## [1.20.0/0.43.0] 2023-11-10 - -This release brings a breaking change for custom trace API implementations. Some interfaces (`TracerProvider`, `Tracer`, `Span`) now embed the `go.opentelemetry.io/otel/trace/embedded` types. Implementors need to update their implementations based on what they want the default behavior to be. See the "API Implementations" section of the [trace API] package documentation for more information about how to accomplish this. - -### Added - -- Add `go.opentelemetry.io/otel/bridge/opencensus.InstallTraceBridge`, which installs the OpenCensus trace bridge, and replaces `opencensus.NewTracer`. (#4567) -- Add scope version to trace and metric bridges in `go.opentelemetry.io/otel/bridge/opencensus`. (#4584) -- Add the `go.opentelemetry.io/otel/trace/embedded` package to be embedded in the exported trace API interfaces. (#4620) -- Add the `go.opentelemetry.io/otel/trace/noop` package as a default no-op implementation of the trace API. (#4620) -- Add context propagation in `go.opentelemetry.io/otel/example/dice`. (#4644) -- Add view configuration to `go.opentelemetry.io/otel/example/prometheus`. (#4649) -- Add `go.opentelemetry.io/otel/metric.WithExplicitBucketBoundaries`, which allows defining default explicit bucket boundaries when creating histogram instruments. (#4603) -- Add `Version` function in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4660) -- Add `Version` function in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4660) -- Add Summary, SummaryDataPoint, and QuantileValue to `go.opentelemetry.io/sdk/metric/metricdata`. (#4622) -- `go.opentelemetry.io/otel/bridge/opencensus.NewMetricProducer` now supports exemplars from OpenCensus. (#4585) -- Add support for `WithExplicitBucketBoundaries` in `go.opentelemetry.io/otel/sdk/metric`. (#4605) -- Add support for Summary metrics in `go.opentelemetry.io/otel/bridge/opencensus`. (#4668) - -### Deprecated - -- Deprecate `go.opentelemetry.io/otel/bridge/opencensus.NewTracer` in favor of `opencensus.InstallTraceBridge`. (#4567) -- Deprecate `go.opentelemetry.io/otel/example/fib` package is in favor of `go.opentelemetry.io/otel/example/dice`. (#4618) -- Deprecate `go.opentelemetry.io/otel/trace.NewNoopTracerProvider`. - Use the added `NewTracerProvider` function in `go.opentelemetry.io/otel/trace/noop` instead. (#4620) -- Deprecate `go.opentelemetry.io/otel/example/view` package in favor of `go.opentelemetry.io/otel/example/prometheus`. (#4649) -- Deprecate `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4693) - -### Changed - -- `go.opentelemetry.io/otel/bridge/opencensus.NewMetricProducer` returns a `*MetricProducer` struct instead of the metric.Producer interface. (#4583) -- The `TracerProvider` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.TracerProvider` type. - This extends the `TracerProvider` interface and is is a breaking change for any existing implementation. - Implementors need to update their implementations based on what they want the default behavior of the interface to be. - See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more information about how to accomplish this. (#4620) -- The `Tracer` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.Tracer` type. - This extends the `Tracer` interface and is is a breaking change for any existing implementation. - Implementors need to update their implementations based on what they want the default behavior of the interface to be. - See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more information about how to accomplish this. (#4620) -- The `Span` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.Span` type. - This extends the `Span` interface and is is a breaking change for any existing implementation. - Implementors need to update their implementations based on what they want the default behavior of the interface to be. - See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more information about how to accomplish this. (#4620) -- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` does no longer depend on `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4660) -- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` does no longer depend on `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4660) -- Retry for `502 Bad Gateway` and `504 Gateway Timeout` HTTP statuses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4670) -- Retry for `502 Bad Gateway` and `504 Gateway Timeout` HTTP statuses in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4670) -- Retry for `RESOURCE_EXHAUSTED` only if RetryInfo is returned in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4669) -- Retry for `RESOURCE_EXHAUSTED` only if RetryInfo is returned in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#4669) -- Retry temporary HTTP request failures in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4679) -- Retry temporary HTTP request failures in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4679) - -### Fixed - -- Fix improper parsing of characters such us `+`, `/` by `Parse` in `go.opentelemetry.io/otel/baggage` as they were rendered as a whitespace. (#4667) -- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_RESOURCE_ATTRIBUTES` in `go.opentelemetry.io/otel/sdk/resource` as they were rendered as a whitespace. (#4699) -- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_METRICS_HEADERS` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` as they were rendered as a whitespace. (#4699) -- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_METRICS_HEADERS` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` as they were rendered as a whitespace. (#4699) -- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_TRACES_HEADERS` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlptracegrpc` as they were rendered as a whitespace. (#4699) -- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_TRACES_HEADERS` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlptracehttp` as they were rendered as a whitespace. (#4699) -- In `go.opentelemetry.op/otel/exporters/prometheus`, the exporter no longer `Collect`s metrics after `Shutdown` is invoked. (#4648) -- Fix documentation for `WithCompressor` in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#4695) -- Fix documentation for `WithCompressor` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4695) - -## [1.19.0/0.42.0/0.0.7] 2023-09-28 - -This release contains the first stable release of the OpenTelemetry Go [metric SDK]. -Our project stability guarantees now apply to the `go.opentelemetry.io/otel/sdk/metric` package. -See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. - -### Added - -- Add the "Roll the dice" getting started application example in `go.opentelemetry.io/otel/example/dice`. (#4539) -- The `WithWriter` and `WithPrettyPrint` options to `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` to set a custom `io.Writer`, and allow displaying the output in human-readable JSON. (#4507) - -### Changed - -- Allow '/' characters in metric instrument names. (#4501) -- The exporter in `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` does not prettify its output by default anymore. (#4507) -- Upgrade `gopkg.io/yaml` from `v2` to `v3` in `go.opentelemetry.io/otel/schema`. (#4535) - -### Fixed - -- In `go.opentelemetry.op/otel/exporters/prometheus`, don't try to create the Prometheus metric on every `Collect` if we know the scope is invalid. (#4499) - -### Removed - -- Remove `"go.opentelemetry.io/otel/bridge/opencensus".NewMetricExporter`, which is replaced by `NewMetricProducer`. (#4566) - -## [1.19.0-rc.1/0.42.0-rc.1] 2023-09-14 - -This is a release candidate for the v1.19.0/v0.42.0 release. -That release is expected to include the `v1` release of the OpenTelemetry Go metric SDK and will provide stability guarantees of that SDK. -See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. - -### Changed - -- Allow '/' characters in metric instrument names. (#4501) - -### Fixed - -- In `go.opentelemetry.op/otel/exporters/prometheus`, don't try to create the prometheus metric on every `Collect` if we know the scope is invalid. (#4499) - -## [1.18.0/0.41.0/0.0.6] 2023-09-12 - -This release drops the compatibility guarantee of [Go 1.19]. - -### Added - -- Add `WithProducer` option in `go.opentelemetry.op/otel/exporters/prometheus` to restore the ability to register producers on the prometheus exporter's manual reader. (#4473) -- Add `IgnoreValue` option in `go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest` to allow ignoring values when comparing metrics. (#4447) - -### Changed - -- Use a `TestingT` interface instead of `*testing.T` struct in `go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest`. (#4483) - -### Deprecated - -- The `NewMetricExporter` in `go.opentelemetry.io/otel/bridge/opencensus` was deprecated in `v0.35.0` (#3541). - The deprecation notice format for the function has been corrected to trigger Go documentation and build tooling. (#4470) - -### Removed - -- Removed the deprecated `go.opentelemetry.io/otel/exporters/jaeger` package. (#4467) -- Removed the deprecated `go.opentelemetry.io/otel/example/jaeger` package. (#4467) -- Removed the deprecated `go.opentelemetry.io/otel/sdk/metric/aggregation` package. (#4468) -- Removed the deprecated internal packages in `go.opentelemetry.io/otel/exporters/otlp` and its sub-packages. (#4469) -- Dropped guaranteed support for versions of Go less than 1.20. (#4481) - -## [1.17.0/0.40.0/0.0.5] 2023-08-28 - -### Added - -- Export the `ManualReader` struct in `go.opentelemetry.io/otel/sdk/metric`. (#4244) -- Export the `PeriodicReader` struct in `go.opentelemetry.io/otel/sdk/metric`. (#4244) -- Add support for exponential histogram aggregations. - A histogram can be configured as an exponential histogram using a view with `"go.opentelemetry.io/otel/sdk/metric".ExponentialHistogram` as the aggregation. (#4245) -- Export the `Exporter` struct in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4272) -- Export the `Exporter` struct in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4272) -- The exporters in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` now support the `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE` environment variable. (#4287) -- Add `WithoutCounterSuffixes` option in `go.opentelemetry.io/otel/exporters/prometheus` to disable addition of `_total` suffixes. (#4306) -- Add info and debug logging to the metric SDK in `go.opentelemetry.io/otel/sdk/metric`. (#4315) -- The `go.opentelemetry.io/otel/semconv/v1.21.0` package. - The package contains semantic conventions from the `v1.21.0` version of the OpenTelemetry Semantic Conventions. (#4362) -- Accept 201 to 299 HTTP status as success in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4365) -- Document the `Temporality` and `Aggregation` methods of the `"go.opentelemetry.io/otel/sdk/metric".Exporter"` need to be concurrent safe. (#4381) -- Expand the set of units supported by the Prometheus exporter, and don't add unit suffixes if they are already present in `go.opentelemetry.op/otel/exporters/prometheus` (#4374) -- Move the `Aggregation` interface and its implementations from `go.opentelemetry.io/otel/sdk/metric/aggregation` to `go.opentelemetry.io/otel/sdk/metric`. (#4435) -- The exporters in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` now support the `OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION` environment variable. (#4437) -- Add the `NewAllowKeysFilter` and `NewDenyKeysFilter` functions to `go.opentelemetry.io/otel/attribute` to allow convenient creation of allow-keys and deny-keys filters. (#4444) -- Support Go 1.21. (#4463) - -### Changed - -- Starting from `v1.21.0` of semantic conventions, `go.opentelemetry.io/otel/semconv/{version}/httpconv` and `go.opentelemetry.io/otel/semconv/{version}/netconv` packages will no longer be published. (#4145) -- Log duplicate instrument conflict at a warning level instead of info in `go.opentelemetry.io/otel/sdk/metric`. (#4202) -- Return an error on the creation of new instruments in `go.opentelemetry.io/otel/sdk/metric` if their name doesn't pass regexp validation. (#4210) -- `NewManualReader` in `go.opentelemetry.io/otel/sdk/metric` returns `*ManualReader` instead of `Reader`. (#4244) -- `NewPeriodicReader` in `go.opentelemetry.io/otel/sdk/metric` returns `*PeriodicReader` instead of `Reader`. (#4244) -- Count the Collect time in the `PeriodicReader` timeout in `go.opentelemetry.io/otel/sdk/metric`. (#4221) -- The function `New` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` returns `*Exporter` instead of `"go.opentelemetry.io/otel/sdk/metric".Exporter`. (#4272) -- The function `New` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` returns `*Exporter` instead of `"go.opentelemetry.io/otel/sdk/metric".Exporter`. (#4272) -- If an attribute set is omitted from an async callback, the previous value will no longer be exported in `go.opentelemetry.io/otel/sdk/metric`. (#4290) -- If an attribute set is observed multiple times in an async callback in `go.opentelemetry.io/otel/sdk/metric`, the values will be summed instead of the last observation winning. (#4289) -- Allow the explicit bucket histogram aggregation to be used for the up-down counter, observable counter, observable up-down counter, and observable gauge in the `go.opentelemetry.io/otel/sdk/metric` package. (#4332) -- Restrict `Meter`s in `go.opentelemetry.io/otel/sdk/metric` to only register and collect instruments it created. (#4333) -- `PeriodicReader.Shutdown` and `PeriodicReader.ForceFlush` in `go.opentelemetry.io/otel/sdk/metric` now apply the periodic reader's timeout to the operation if the user provided context does not contain a deadline. (#4356, #4377) -- Upgrade all use of `go.opentelemetry.io/otel/semconv` to use `v1.21.0`. (#4408) -- Increase instrument name maximum length from 63 to 255 characters in `go.opentelemetry.io/otel/sdk/metric`. (#4434) -- Add `go.opentelemetry.op/otel/sdk/metric.WithProducer` as an `Option` for `"go.opentelemetry.io/otel/sdk/metric".NewManualReader` and `"go.opentelemetry.io/otel/sdk/metric".NewPeriodicReader`. (#4346) - -### Removed - -- Remove `Reader.RegisterProducer` in `go.opentelemetry.io/otel/metric`. - Use the added `WithProducer` option instead. (#4346) -- Remove `Reader.ForceFlush` in `go.opentelemetry.io/otel/metric`. - Notice that `PeriodicReader.ForceFlush` is still available. (#4375) - -### Fixed - -- Correctly format log messages from the `go.opentelemetry.io/otel/exporters/zipkin` exporter. (#4143) -- Log an error for calls to `NewView` in `go.opentelemetry.io/otel/sdk/metric` that have empty criteria. (#4307) -- Fix `"go.opentelemetry.io/otel/sdk/resource".WithHostID()` to not set an empty `host.id`. (#4317) -- Use the instrument identifying fields to cache aggregators and determine duplicate instrument registrations in `go.opentelemetry.io/otel/sdk/metric`. (#4337) -- Detect duplicate instruments for case-insensitive names in `go.opentelemetry.io/otel/sdk/metric`. (#4338) -- The `ManualReader` will not panic if `AggregationSelector` returns `nil` in `go.opentelemetry.io/otel/sdk/metric`. (#4350) -- If a `Reader`'s `AggregationSelector` returns `nil` or `DefaultAggregation` the pipeline will use the default aggregation. (#4350) -- Log a suggested view that fixes instrument conflicts in `go.opentelemetry.io/otel/sdk/metric`. (#4349) -- Fix possible panic, deadlock and race condition in batch span processor in `go.opentelemetry.io/otel/sdk/trace`. (#4353) -- Improve context cancellation handling in batch span processor's `ForceFlush` in `go.opentelemetry.io/otel/sdk/trace`. (#4369) -- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` using gotmpl. (#4397, #3846) -- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal` using gotmpl. (#4404, #3846) -- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal` using gotmpl. (#4407, #3846) -- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` using gotmpl. (#4400, #3846) -- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` using gotmpl. (#4401, #3846) -- Do not block the metric SDK when OTLP metric exports are blocked in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#3925, #4395) -- Do not append `_total` if the counter already has that suffix for the Prometheus exproter in `go.opentelemetry.io/otel/exporter/prometheus`. (#4373) -- Fix resource detection data race in `go.opentelemetry.io/otel/sdk/resource`. (#4409) -- Use the first-seen instrument name during instrument name conflicts in `go.opentelemetry.io/otel/sdk/metric`. (#4428) - -### Deprecated - -- The `go.opentelemetry.io/otel/exporters/jaeger` package is deprecated. - OpenTelemetry dropped support for Jaeger exporter in July 2023. - Use `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` - or `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc` instead. (#4423) -- The `go.opentelemetry.io/otel/example/jaeger` package is deprecated. (#4423) -- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal` package is deprecated. (#4420) -- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf` package is deprecated. (#4420) -- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest` package is deprecated. (#4420) -- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform` package is deprecated. (#4420) -- The `go.opentelemetry.io/otel/exporters/otlp/internal` package is deprecated. (#4421) -- The `go.opentelemetry.io/otel/exporters/otlp/internal/envconfig` package is deprecated. (#4421) -- The `go.opentelemetry.io/otel/exporters/otlp/internal/retry` package is deprecated. (#4421) -- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` package is deprecated. (#4425) -- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/envconfig` package is deprecated. (#4425) -- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig` package is deprecated. (#4425) -- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlptracetest` package is deprecated. (#4425) -- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry` package is deprecated. (#4425) -- The `go.opentelemetry.io/otel/sdk/metric/aggregation` package is deprecated. - Use the aggregation types added to `go.opentelemetry.io/otel/sdk/metric` instead. (#4435) - -## [1.16.0/0.39.0] 2023-05-18 - -This release contains the first stable release of the OpenTelemetry Go [metric API]. -Our project stability guarantees now apply to the `go.opentelemetry.io/otel/metric` package. -See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. - -### Added - -- The `go.opentelemetry.io/otel/semconv/v1.19.0` package. - The package contains semantic conventions from the `v1.19.0` version of the OpenTelemetry specification. (#3848) -- The `go.opentelemetry.io/otel/semconv/v1.20.0` package. - The package contains semantic conventions from the `v1.20.0` version of the OpenTelemetry specification. (#4078) -- The Exponential Histogram data types in `go.opentelemetry.io/otel/sdk/metric/metricdata`. (#4165) -- OTLP metrics exporter now supports the Exponential Histogram Data Type. (#4222) -- Fix serialization of `time.Time` zero values in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` packages. (#4271) - -### Changed - -- Use `strings.Cut()` instead of `string.SplitN()` for better readability and memory use. (#4049) -- `MeterProvider` returns noop meters once it has been shutdown. (#4154) - -### Removed - -- The deprecated `go.opentelemetry.io/otel/metric/instrument` package is removed. - Use `go.opentelemetry.io/otel/metric` instead. (#4055) - -### Fixed - -- Fix build for BSD based systems in `go.opentelemetry.io/otel/sdk/resource`. (#4077) - -## [1.16.0-rc.1/0.39.0-rc.1] 2023-05-03 - -This is a release candidate for the v1.16.0/v0.39.0 release. -That release is expected to include the `v1` release of the OpenTelemetry Go metric API and will provide stability guarantees of that API. -See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. - -### Added - -- Support global `MeterProvider` in `go.opentelemetry.io/otel`. (#4039) - - Use `Meter` for a `metric.Meter` from the global `metric.MeterProvider`. - - Use `GetMeterProivder` for a global `metric.MeterProvider`. - - Use `SetMeterProivder` to set the global `metric.MeterProvider`. - -### Changed - -- Move the `go.opentelemetry.io/otel/metric` module to the `stable-v1` module set. - This stages the metric API to be released as a stable module. (#4038) - -### Removed - -- The `go.opentelemetry.io/otel/metric/global` package is removed. - Use `go.opentelemetry.io/otel` instead. (#4039) - -## [1.15.1/0.38.1] 2023-05-02 - -### Fixed - -- Remove unused imports from `sdk/resource/host_id_bsd.go` which caused build failures. (#4040, #4041) - -## [1.15.0/0.38.0] 2023-04-27 - -### Added - -- The `go.opentelemetry.io/otel/metric/embedded` package. (#3916) -- The `Version` function to `go.opentelemetry.io/otel/sdk` to return the SDK version. (#3949) -- Add a `WithNamespace` option to `go.opentelemetry.io/otel/exporters/prometheus` to allow users to prefix metrics with a namespace. (#3970) -- The following configuration types were added to `go.opentelemetry.io/otel/metric/instrument` to be used in the configuration of measurement methods. (#3971) - - The `AddConfig` used to hold configuration for addition measurements - - `NewAddConfig` used to create a new `AddConfig` - - `AddOption` used to configure an `AddConfig` - - The `RecordConfig` used to hold configuration for recorded measurements - - `NewRecordConfig` used to create a new `RecordConfig` - - `RecordOption` used to configure a `RecordConfig` - - The `ObserveConfig` used to hold configuration for observed measurements - - `NewObserveConfig` used to create a new `ObserveConfig` - - `ObserveOption` used to configure an `ObserveConfig` -- `WithAttributeSet` and `WithAttributes` are added to `go.opentelemetry.io/otel/metric/instrument`. - They return an option used during a measurement that defines the attribute Set associated with the measurement. (#3971) -- The `Version` function to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` to return the OTLP metrics client version. (#3956) -- The `Version` function to `go.opentelemetry.io/otel/exporters/otlp/otlptrace` to return the OTLP trace client version. (#3956) - -### Changed - -- The `Extrema` in `go.opentelemetry.io/otel/sdk/metric/metricdata` is redefined with a generic argument of `[N int64 | float64]`. (#3870) -- Update all exported interfaces from `go.opentelemetry.io/otel/metric` to embed their corresponding interface from `go.opentelemetry.io/otel/metric/embedded`. - This adds an implementation requirement to set the interface default behavior for unimplemented methods. (#3916) -- Move No-Op implementation from `go.opentelemetry.io/otel/metric` into its own package `go.opentelemetry.io/otel/metric/noop`. (#3941) - - `metric.NewNoopMeterProvider` is replaced with `noop.NewMeterProvider` -- Add all the methods from `"go.opentelemetry.io/otel/trace".SpanContext` to `bridgeSpanContext` by embedding `otel.SpanContext` in `bridgeSpanContext`. (#3966) -- Wrap `UploadMetrics` error in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/` to improve error message when encountering generic grpc errors. (#3974) -- The measurement methods for all instruments in `go.opentelemetry.io/otel/metric/instrument` accept an option instead of the variadic `"go.opentelemetry.io/otel/attribute".KeyValue`. (#3971) - - The `Int64Counter.Add` method now accepts `...AddOption` - - The `Float64Counter.Add` method now accepts `...AddOption` - - The `Int64UpDownCounter.Add` method now accepts `...AddOption` - - The `Float64UpDownCounter.Add` method now accepts `...AddOption` - - The `Int64Histogram.Record` method now accepts `...RecordOption` - - The `Float64Histogram.Record` method now accepts `...RecordOption` - - The `Int64Observer.Observe` method now accepts `...ObserveOption` - - The `Float64Observer.Observe` method now accepts `...ObserveOption` -- The `Observer` methods in `go.opentelemetry.io/otel/metric` accept an option instead of the variadic `"go.opentelemetry.io/otel/attribute".KeyValue`. (#3971) - - The `Observer.ObserveInt64` method now accepts `...ObserveOption` - - The `Observer.ObserveFloat64` method now accepts `...ObserveOption` -- Move global metric back to `go.opentelemetry.io/otel/metric/global` from `go.opentelemetry.io/otel`. (#3986) - -### Fixed - -- `TracerProvider` allows calling `Tracer()` while it's shutting down. - It used to deadlock. (#3924) -- Use the SDK version for the Telemetry SDK resource detector in `go.opentelemetry.io/otel/sdk/resource`. (#3949) -- Fix a data race in `SpanProcessor` returned by `NewSimpleSpanProcessor` in `go.opentelemetry.io/otel/sdk/trace`. (#3951) -- Automatically figure out the default aggregation with `aggregation.Default`. (#3967) - -### Deprecated - -- The `go.opentelemetry.io/otel/metric/instrument` package is deprecated. - Use the equivalent types added to `go.opentelemetry.io/otel/metric` instead. (#4018) - -## [1.15.0-rc.2/0.38.0-rc.2] 2023-03-23 - -This is a release candidate for the v1.15.0/v0.38.0 release. -That release will include the `v1` release of the OpenTelemetry Go metric API and will provide stability guarantees of that API. -See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. - -### Added - -- The `WithHostID` option to `go.opentelemetry.io/otel/sdk/resource`. (#3812) -- The `WithoutTimestamps` option to `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` to sets all timestamps to zero. (#3828) -- The new `Exemplar` type is added to `go.opentelemetry.io/otel/sdk/metric/metricdata`. - Both the `DataPoint` and `HistogramDataPoint` types from that package have a new field of `Exemplars` containing the sampled exemplars for their timeseries. (#3849) -- Configuration for each metric instrument in `go.opentelemetry.io/otel/sdk/metric/instrument`. (#3895) -- The internal logging introduces a warning level verbosity equal to `V(1)`. (#3900) -- Added a log message warning about usage of `SimpleSpanProcessor` in production environments. (#3854) - -### Changed - -- Optimize memory allocation when creation a new `Set` using `NewSet` or `NewSetWithFiltered` in `go.opentelemetry.io/otel/attribute`. (#3832) -- Optimize memory allocation when creation new metric instruments in `go.opentelemetry.io/otel/sdk/metric`. (#3832) -- Avoid creating new objects on all calls to `WithDeferredSetup` and `SkipContextSetup` in OpenTracing bridge. (#3833) -- The `New` and `Detect` functions from `go.opentelemetry.io/otel/sdk/resource` return errors that wrap underlying errors instead of just containing the underlying error strings. (#3844) -- Both the `Histogram` and `HistogramDataPoint` are redefined with a generic argument of `[N int64 | float64]` in `go.opentelemetry.io/otel/sdk/metric/metricdata`. (#3849) -- The metric `Export` interface from `go.opentelemetry.io/otel/sdk/metric` accepts a `*ResourceMetrics` instead of `ResourceMetrics`. (#3853) -- Rename `Asynchronous` to `Observable` in `go.opentelemetry.io/otel/metric/instrument`. (#3892) -- Rename `Int64ObserverOption` to `Int64ObservableOption` in `go.opentelemetry.io/otel/metric/instrument`. (#3895) -- Rename `Float64ObserverOption` to `Float64ObservableOption` in `go.opentelemetry.io/otel/metric/instrument`. (#3895) -- The internal logging changes the verbosity level of info to `V(4)`, the verbosity level of debug to `V(8)`. (#3900) - -### Fixed - -- `TracerProvider` consistently doesn't allow to register a `SpanProcessor` after shutdown. (#3845) - -### Removed - -- The deprecated `go.opentelemetry.io/otel/metric/global` package is removed. (#3829) -- The unneeded `Synchronous` interface in `go.opentelemetry.io/otel/metric/instrument` was removed. (#3892) -- The `Float64ObserverConfig` and `NewFloat64ObserverConfig` in `go.opentelemetry.io/otel/sdk/metric/instrument`. - Use the added `float64` instrument configuration instead. (#3895) -- The `Int64ObserverConfig` and `NewInt64ObserverConfig` in `go.opentelemetry.io/otel/sdk/metric/instrument`. - Use the added `int64` instrument configuration instead. (#3895) -- The `NewNoopMeter` function in `go.opentelemetry.io/otel/metric`, use `NewMeterProvider().Meter("")` instead. (#3893) - -## [1.15.0-rc.1/0.38.0-rc.1] 2023-03-01 - -This is a release candidate for the v1.15.0/v0.38.0 release. -That release will include the `v1` release of the OpenTelemetry Go metric API and will provide stability guarantees of that API. -See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. - -This release drops the compatibility guarantee of [Go 1.18]. - -### Added - -- Support global `MeterProvider` in `go.opentelemetry.io/otel`. (#3818) - - Use `Meter` for a `metric.Meter` from the global `metric.MeterProvider`. - - Use `GetMeterProivder` for a global `metric.MeterProvider`. - - Use `SetMeterProivder` to set the global `metric.MeterProvider`. - -### Changed - -- Dropped compatibility testing for [Go 1.18]. - The project no longer guarantees support for this version of Go. (#3813) - -### Fixed - -- Handle empty environment variable as it they were not set. (#3764) -- Clarify the `httpconv` and `netconv` packages in `go.opentelemetry.io/otel/semconv/*` provide tracing semantic conventions. (#3823) -- Fix race conditions in `go.opentelemetry.io/otel/exporters/metric/prometheus` that could cause a panic. (#3899) -- Fix sending nil `scopeInfo` to metrics channel in `go.opentelemetry.io/otel/exporters/metric/prometheus` that could cause a panic in `github.com/prometheus/client_golang/prometheus`. (#3899) - -### Deprecated - -- The `go.opentelemetry.io/otel/metric/global` package is deprecated. - Use `go.opentelemetry.io/otel` instead. (#3818) - -### Removed - -- The deprecated `go.opentelemetry.io/otel/metric/unit` package is removed. (#3814) - -## [1.14.0/0.37.0/0.0.4] 2023-02-27 - -This release is the last to support [Go 1.18]. -The next release will require at least [Go 1.19]. - -### Added - -- The `event` type semantic conventions are added to `go.opentelemetry.io/otel/semconv/v1.17.0`. (#3697) -- Support [Go 1.20]. (#3693) -- The `go.opentelemetry.io/otel/semconv/v1.18.0` package. - The package contains semantic conventions from the `v1.18.0` version of the OpenTelemetry specification. (#3719) - - The following `const` renames from `go.opentelemetry.io/otel/semconv/v1.17.0` are included: - - `OtelScopeNameKey` -> `OTelScopeNameKey` - - `OtelScopeVersionKey` -> `OTelScopeVersionKey` - - `OtelLibraryNameKey` -> `OTelLibraryNameKey` - - `OtelLibraryVersionKey` -> `OTelLibraryVersionKey` - - `OtelStatusCodeKey` -> `OTelStatusCodeKey` - - `OtelStatusDescriptionKey` -> `OTelStatusDescriptionKey` - - `OtelStatusCodeOk` -> `OTelStatusCodeOk` - - `OtelStatusCodeError` -> `OTelStatusCodeError` - - The following `func` renames from `go.opentelemetry.io/otel/semconv/v1.17.0` are included: - - `OtelScopeName` -> `OTelScopeName` - - `OtelScopeVersion` -> `OTelScopeVersion` - - `OtelLibraryName` -> `OTelLibraryName` - - `OtelLibraryVersion` -> `OTelLibraryVersion` - - `OtelStatusDescription` -> `OTelStatusDescription` -- A `IsSampled` method is added to the `SpanContext` implementation in `go.opentelemetry.io/otel/bridge/opentracing` to expose the span sampled state. - See the [README](./bridge/opentracing/README.md) for more information. (#3570) -- The `WithInstrumentationAttributes` option to `go.opentelemetry.io/otel/metric`. (#3738) -- The `WithInstrumentationAttributes` option to `go.opentelemetry.io/otel/trace`. (#3739) -- The following environment variables are supported by the periodic `Reader` in `go.opentelemetry.io/otel/sdk/metric`. (#3763) - - `OTEL_METRIC_EXPORT_INTERVAL` sets the time between collections and exports. - - `OTEL_METRIC_EXPORT_TIMEOUT` sets the timeout an export is attempted. - -### Changed - -- Fall-back to `TextMapCarrier` when it's not `HttpHeader`s in `go.opentelemetry.io/otel/bridge/opentracing`. (#3679) -- The `Collect` method of the `"go.opentelemetry.io/otel/sdk/metric".Reader` interface is updated to accept the `metricdata.ResourceMetrics` value the collection will be made into. - This change is made to enable memory reuse by SDK users. (#3732) -- The `WithUnit` option in `go.opentelemetry.io/otel/sdk/metric/instrument` is updated to accept a `string` for the unit value. (#3776) - -### Fixed - -- Ensure `go.opentelemetry.io/otel` does not use generics. (#3723, #3725) -- Multi-reader `MeterProvider`s now export metrics for all readers, instead of just the first reader. (#3720, #3724) -- Remove use of deprecated `"math/rand".Seed` in `go.opentelemetry.io/otel/example/prometheus`. (#3733) -- Do not silently drop unknown schema data with `Parse` in `go.opentelemetry.io/otel/schema/v1.1`. (#3743) -- Data race issue in OTLP exporter retry mechanism. (#3755, #3756) -- Wrapping empty errors when exporting in `go.opentelemetry.io/otel/sdk/metric`. (#3698, #3772) -- Incorrect "all" and "resource" definition for schema files in `go.opentelemetry.io/otel/schema/v1.1`. (#3777) - -### Deprecated - -- The `go.opentelemetry.io/otel/metric/unit` package is deprecated. - Use the equivalent unit string instead. (#3776) - - Use `"1"` instead of `unit.Dimensionless` - - Use `"By"` instead of `unit.Bytes` - - Use `"ms"` instead of `unit.Milliseconds` - -## [1.13.0/0.36.0] 2023-02-07 - -### Added - -- Attribute `KeyValue` creations functions to `go.opentelemetry.io/otel/semconv/v1.17.0` for all non-enum semantic conventions. - These functions ensure semantic convention type correctness. (#3675) - -### Fixed - -- Removed the `http.target` attribute from being added by `ServerRequest` in the following packages. (#3687) - - `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv` - - `go.opentelemetry.io/otel/semconv/v1.14.0/httpconv` - - `go.opentelemetry.io/otel/semconv/v1.15.0/httpconv` - - `go.opentelemetry.io/otel/semconv/v1.16.0/httpconv` - - `go.opentelemetry.io/otel/semconv/v1.17.0/httpconv` - -### Removed - -- The deprecated `go.opentelemetry.io/otel/metric/instrument/asyncfloat64` package is removed. (#3631) -- The deprecated `go.opentelemetry.io/otel/metric/instrument/asyncint64` package is removed. (#3631) -- The deprecated `go.opentelemetry.io/otel/metric/instrument/syncfloat64` package is removed. (#3631) -- The deprecated `go.opentelemetry.io/otel/metric/instrument/syncint64` package is removed. (#3631) - -## [1.12.0/0.35.0] 2023-01-28 - -### Added - -- The `WithInt64Callback` option to `go.opentelemetry.io/otel/metric/instrument`. - This options is used to configure `int64` Observer callbacks during their creation. (#3507) -- The `WithFloat64Callback` option to `go.opentelemetry.io/otel/metric/instrument`. - This options is used to configure `float64` Observer callbacks during their creation. (#3507) -- The `Producer` interface and `Reader.RegisterProducer(Producer)` to `go.opentelemetry.io/otel/sdk/metric`. - These additions are used to enable external metric Producers. (#3524) -- The `Callback` function type to `go.opentelemetry.io/otel/metric`. - This new named function type is registered with a `Meter`. (#3564) -- The `go.opentelemetry.io/otel/semconv/v1.13.0` package. - The package contains semantic conventions from the `v1.13.0` version of the OpenTelemetry specification. (#3499) - - The `EndUserAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is merged into `ClientRequest` and `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. - - The `HTTPAttributesFromHTTPStatusCode` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is merged into `ClientResponse` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. - - The `HTTPClientAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ClientRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. - - The `HTTPServerAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. - - The `HTTPServerMetricAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. - - The `NetAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is split into `Transport` in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` and `ClientRequest` or `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. - - The `SpanStatusFromHTTPStatusCode` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ClientStatus` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. - - The `SpanStatusFromHTTPStatusCodeAndSpanKind` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is split into `ClientStatus` and `ServerStatus` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. - - The `Client` function is included in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` to generate attributes for a `net.Conn`. - - The `Server` function is included in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` to generate attributes for a `net.Listener`. -- The `go.opentelemetry.io/otel/semconv/v1.14.0` package. - The package contains semantic conventions from the `v1.14.0` version of the OpenTelemetry specification. (#3566) -- The `go.opentelemetry.io/otel/semconv/v1.15.0` package. - The package contains semantic conventions from the `v1.15.0` version of the OpenTelemetry specification. (#3578) -- The `go.opentelemetry.io/otel/semconv/v1.16.0` package. - The package contains semantic conventions from the `v1.16.0` version of the OpenTelemetry specification. (#3579) -- Metric instruments to `go.opentelemetry.io/otel/metric/instrument`. - These instruments are use as replacements of the deprecated `go.opentelemetry.io/otel/metric/instrument/{asyncfloat64,asyncint64,syncfloat64,syncint64}` packages.(#3575, #3586) - - `Float64ObservableCounter` replaces the `asyncfloat64.Counter` - - `Float64ObservableUpDownCounter` replaces the `asyncfloat64.UpDownCounter` - - `Float64ObservableGauge` replaces the `asyncfloat64.Gauge` - - `Int64ObservableCounter` replaces the `asyncint64.Counter` - - `Int64ObservableUpDownCounter` replaces the `asyncint64.UpDownCounter` - - `Int64ObservableGauge` replaces the `asyncint64.Gauge` - - `Float64Counter` replaces the `syncfloat64.Counter` - - `Float64UpDownCounter` replaces the `syncfloat64.UpDownCounter` - - `Float64Histogram` replaces the `syncfloat64.Histogram` - - `Int64Counter` replaces the `syncint64.Counter` - - `Int64UpDownCounter` replaces the `syncint64.UpDownCounter` - - `Int64Histogram` replaces the `syncint64.Histogram` -- `NewTracerProvider` to `go.opentelemetry.io/otel/bridge/opentracing`. - This is used to create `WrapperTracer` instances from a `TracerProvider`. (#3116) -- The `Extrema` type to `go.opentelemetry.io/otel/sdk/metric/metricdata`. - This type is used to represent min/max values and still be able to distinguish unset and zero values. (#3487) -- The `go.opentelemetry.io/otel/semconv/v1.17.0` package. - The package contains semantic conventions from the `v1.17.0` version of the OpenTelemetry specification. (#3599) - -### Changed - -- Jaeger and Zipkin exporter use `github.com/go-logr/logr` as the logging interface, and add the `WithLogr` option. (#3497, #3500) -- Instrument configuration in `go.opentelemetry.io/otel/metric/instrument` is split into specific options and configuration based on the instrument type. (#3507) - - Use the added `Int64Option` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/syncint64`. - - Use the added `Float64Option` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/syncfloat64`. - - Use the added `Int64ObserverOption` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/asyncint64`. - - Use the added `Float64ObserverOption` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/asyncfloat64`. -- Return a `Registration` from the `RegisterCallback` method of a `Meter` in the `go.opentelemetry.io/otel/metric` package. - This `Registration` can be used to unregister callbacks. (#3522) -- Global error handler uses an atomic value instead of a mutex. (#3543) -- Add `NewMetricProducer` to `go.opentelemetry.io/otel/bridge/opencensus`, which can be used to pass OpenCensus metrics to an OpenTelemetry Reader. (#3541) -- Global logger uses an atomic value instead of a mutex. (#3545) -- The `Shutdown` method of the `"go.opentelemetry.io/otel/sdk/trace".TracerProvider` releases all computational resources when called the first time. (#3551) -- The `Sampler` returned from `TraceIDRatioBased` `go.opentelemetry.io/otel/sdk/trace` now uses the rightmost bits for sampling decisions. - This fixes random sampling when using ID generators like `xray.IDGenerator` and increasing parity with other language implementations. (#3557) -- Errors from `go.opentelemetry.io/otel/exporters/otlp/otlptrace` exporters are wrapped in errors identifying their signal name. - Existing users of the exporters attempting to identify specific errors will need to use `errors.Unwrap()` to get the underlying error. (#3516) -- Exporters from `go.opentelemetry.io/otel/exporters/otlp` will print the final retryable error message when attempts to retry time out. (#3514) -- The instrument kind names in `go.opentelemetry.io/otel/sdk/metric` are updated to match the API. (#3562) - - `InstrumentKindSyncCounter` is renamed to `InstrumentKindCounter` - - `InstrumentKindSyncUpDownCounter` is renamed to `InstrumentKindUpDownCounter` - - `InstrumentKindSyncHistogram` is renamed to `InstrumentKindHistogram` - - `InstrumentKindAsyncCounter` is renamed to `InstrumentKindObservableCounter` - - `InstrumentKindAsyncUpDownCounter` is renamed to `InstrumentKindObservableUpDownCounter` - - `InstrumentKindAsyncGauge` is renamed to `InstrumentKindObservableGauge` -- The `RegisterCallback` method of the `Meter` in `go.opentelemetry.io/otel/metric` changed. - - The named `Callback` replaces the inline function parameter. (#3564) - - `Callback` is required to return an error. (#3576) - - `Callback` accepts the added `Observer` parameter added. - This new parameter is used by `Callback` implementations to observe values for asynchronous instruments instead of calling the `Observe` method of the instrument directly. (#3584) - - The slice of `instrument.Asynchronous` is now passed as a variadic argument. (#3587) -- The exporter from `go.opentelemetry.io/otel/exporters/zipkin` is updated to use the `v1.16.0` version of semantic conventions. - This means it no longer uses the removed `net.peer.ip` or `http.host` attributes to determine the remote endpoint. - Instead it uses the `net.sock.peer` attributes. (#3581) -- The `Min` and `Max` fields of the `HistogramDataPoint` in `go.opentelemetry.io/otel/sdk/metric/metricdata` are now defined with the added `Extrema` type instead of a `*float64`. (#3487) - -### Fixed - -- Asynchronous instruments that use sum aggregators and attribute filters correctly add values from equivalent attribute sets that have been filtered. (#3439, #3549) -- The `RegisterCallback` method of the `Meter` from `go.opentelemetry.io/otel/sdk/metric` only registers a callback for instruments created by that meter. - Trying to register a callback with instruments from a different meter will result in an error being returned. (#3584) - -### Deprecated - -- The `NewMetricExporter` in `go.opentelemetry.io/otel/bridge/opencensus` is deprecated. - Use `NewMetricProducer` instead. (#3541) -- The `go.opentelemetry.io/otel/metric/instrument/asyncfloat64` package is deprecated. - Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) -- The `go.opentelemetry.io/otel/metric/instrument/asyncint64` package is deprecated. - Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) -- The `go.opentelemetry.io/otel/metric/instrument/syncfloat64` package is deprecated. - Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) -- The `go.opentelemetry.io/otel/metric/instrument/syncint64` package is deprecated. - Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) -- The `NewWrappedTracerProvider` in `go.opentelemetry.io/otel/bridge/opentracing` is now deprecated. - Use `NewTracerProvider` instead. (#3116) - -### Removed - -- The deprecated `go.opentelemetry.io/otel/sdk/metric/view` package is removed. (#3520) -- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/asyncint64` is removed. - Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) - - The `Counter` method is replaced by `Meter.Int64ObservableCounter` - - The `UpDownCounter` method is replaced by `Meter.Int64ObservableUpDownCounter` - - The `Gauge` method is replaced by `Meter.Int64ObservableGauge` -- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/asyncfloat64` is removed. - Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) - - The `Counter` method is replaced by `Meter.Float64ObservableCounter` - - The `UpDownCounter` method is replaced by `Meter.Float64ObservableUpDownCounter` - - The `Gauge` method is replaced by `Meter.Float64ObservableGauge` -- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/syncint64` is removed. - Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) - - The `Counter` method is replaced by `Meter.Int64Counter` - - The `UpDownCounter` method is replaced by `Meter.Int64UpDownCounter` - - The `Histogram` method is replaced by `Meter.Int64Histogram` -- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/syncfloat64` is removed. - Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) - - The `Counter` method is replaced by `Meter.Float64Counter` - - The `UpDownCounter` method is replaced by `Meter.Float64UpDownCounter` - - The `Histogram` method is replaced by `Meter.Float64Histogram` - -## [1.11.2/0.34.0] 2022-12-05 - -### Added - -- The `WithView` `Option` is added to the `go.opentelemetry.io/otel/sdk/metric` package. - This option is used to configure the view(s) a `MeterProvider` will use for all `Reader`s that are registered with it. (#3387) -- Add Instrumentation Scope and Version as info metric and label in Prometheus exporter. - This can be disabled using the `WithoutScopeInfo()` option added to that package.(#3273, #3357) -- OTLP exporters now recognize: (#3363) - - `OTEL_EXPORTER_OTLP_INSECURE` - - `OTEL_EXPORTER_OTLP_TRACES_INSECURE` - - `OTEL_EXPORTER_OTLP_METRICS_INSECURE` - - `OTEL_EXPORTER_OTLP_CLIENT_KEY` - - `OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY` - - `OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY` - - `OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE` - - `OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE` - - `OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE` -- The `View` type and related `NewView` function to create a view according to the OpenTelemetry specification are added to `go.opentelemetry.io/otel/sdk/metric`. - These additions are replacements for the `View` type and `New` function from `go.opentelemetry.io/otel/sdk/metric/view`. (#3459) -- The `Instrument` and `InstrumentKind` type are added to `go.opentelemetry.io/otel/sdk/metric`. - These additions are replacements for the `Instrument` and `InstrumentKind` types from `go.opentelemetry.io/otel/sdk/metric/view`. (#3459) -- The `Stream` type is added to `go.opentelemetry.io/otel/sdk/metric` to define a metric data stream a view will produce. (#3459) -- The `AssertHasAttributes` allows instrument authors to test that datapoints returned have appropriate attributes. (#3487) - -### Changed - -- The `"go.opentelemetry.io/otel/sdk/metric".WithReader` option no longer accepts views to associate with the `Reader`. - Instead, views are now registered directly with the `MeterProvider` via the new `WithView` option. - The views registered with the `MeterProvider` apply to all `Reader`s. (#3387) -- The `Temporality(view.InstrumentKind) metricdata.Temporality` and `Aggregation(view.InstrumentKind) aggregation.Aggregation` methods are added to the `"go.opentelemetry.io/otel/sdk/metric".Exporter` interface. (#3260) -- The `Temporality(view.InstrumentKind) metricdata.Temporality` and `Aggregation(view.InstrumentKind) aggregation.Aggregation` methods are added to the `"go.opentelemetry.io/otel/exporters/otlp/otlpmetric".Client` interface. (#3260) -- The `WithTemporalitySelector` and `WithAggregationSelector` `ReaderOption`s have been changed to `ManualReaderOption`s in the `go.opentelemetry.io/otel/sdk/metric` package. (#3260) -- The periodic reader in the `go.opentelemetry.io/otel/sdk/metric` package now uses the temporality and aggregation selectors from its configured exporter instead of accepting them as options. (#3260) - -### Fixed - -- The `go.opentelemetry.io/otel/exporters/prometheus` exporter fixes duplicated `_total` suffixes. (#3369) -- Remove comparable requirement for `Reader`s. (#3387) -- Cumulative metrics from the OpenCensus bridge (`go.opentelemetry.io/otel/bridge/opencensus`) are defined as monotonic sums, instead of non-monotonic. (#3389) -- Asynchronous counters (`Counter` and `UpDownCounter`) from the metric SDK now produce delta sums when configured with delta temporality. (#3398) -- Exported `Status` codes in the `go.opentelemetry.io/otel/exporters/zipkin` exporter are now exported as all upper case values. (#3340) -- `Aggregation`s from `go.opentelemetry.io/otel/sdk/metric` with no data are not exported. (#3394, #3436) -- Re-enabled Attribute Filters in the Metric SDK. (#3396) -- Asynchronous callbacks are only called if they are registered with at least one instrument that does not use drop aggragation. (#3408) -- Do not report empty partial-success responses in the `go.opentelemetry.io/otel/exporters/otlp` exporters. (#3438, #3432) -- Handle partial success responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` exporters. (#3162, #3440) -- Prevent duplicate Prometheus description, unit, and type. (#3469) -- Prevents panic when using incorrect `attribute.Value.As[Type]Slice()`. (#3489) - -### Removed - -- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric.Client` interface is removed. (#3486) -- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric.New` function is removed. Use the `otlpmetric[http|grpc].New` directly. (#3486) - -### Deprecated - -- The `go.opentelemetry.io/otel/sdk/metric/view` package is deprecated. - Use `Instrument`, `InstrumentKind`, `View`, and `NewView` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3476) - -## [1.11.1/0.33.0] 2022-10-19 - -### Added - -- The Prometheus exporter in `go.opentelemetry.io/otel/exporters/prometheus` registers with a Prometheus registerer on creation. - By default, it will register with the default Prometheus registerer. - A non-default registerer can be used by passing the `WithRegisterer` option. (#3239) -- Added the `WithAggregationSelector` option to the `go.opentelemetry.io/otel/exporters/prometheus` package to change the default `AggregationSelector` used. (#3341) -- The Prometheus exporter in `go.opentelemetry.io/otel/exporters/prometheus` converts the `Resource` associated with metric exports into a `target_info` metric. (#3285) - -### Changed - -- The `"go.opentelemetry.io/otel/exporters/prometheus".New` function is updated to return an error. - It will return an error if the exporter fails to register with Prometheus. (#3239) - -### Fixed - -- The URL-encoded values from the `OTEL_RESOURCE_ATTRIBUTES` environment variable are decoded. (#2963) -- The `baggage.NewMember` function decodes the `value` parameter instead of directly using it. - This fixes the implementation to be compliant with the W3C specification. (#3226) -- Slice attributes of the `attribute` package are now comparable based on their value, not instance. (#3108 #3252) -- The `Shutdown` and `ForceFlush` methods of the `"go.opentelemetry.io/otel/sdk/trace".TraceProvider` no longer return an error when no processor is registered. (#3268) -- The Prometheus exporter in `go.opentelemetry.io/otel/exporters/prometheus` cumulatively sums histogram buckets. (#3281) -- The sum of each histogram data point is now uniquely exported by the `go.opentelemetry.io/otel/exporters/otlpmetric` exporters. (#3284, #3293) -- Recorded values for asynchronous counters (`Counter` and `UpDownCounter`) are interpreted as exact, not incremental, sum values by the metric SDK. (#3350, #3278) -- `UpDownCounters` are now correctly output as Prometheus gauges in the `go.opentelemetry.io/otel/exporters/prometheus` exporter. (#3358) -- The Prometheus exporter in `go.opentelemetry.io/otel/exporters/prometheus` no longer describes the metrics it will send to Prometheus on startup. - Instead the exporter is defined as an "unchecked" collector for Prometheus. - This fixes the `reader is not registered` warning currently emitted on startup. (#3291 #3342) -- The `go.opentelemetry.io/otel/exporters/prometheus` exporter now correctly adds `_total` suffixes to counter metrics. (#3360) -- The `go.opentelemetry.io/otel/exporters/prometheus` exporter now adds a unit suffix to metric names. - This can be disabled using the `WithoutUnits()` option added to that package. (#3352) - -## [1.11.0/0.32.3] 2022-10-12 - -### Added - -- Add default User-Agent header to OTLP exporter requests (`go.opentelemetry.io/otel/exporters/otlptrace/otlptracegrpc` and `go.opentelemetry.io/otel/exporters/otlptrace/otlptracehttp`). (#3261) - -### Changed - -- `span.SetStatus` has been updated such that calls that lower the status are now no-ops. (#3214) -- Upgrade `golang.org/x/sys/unix` from `v0.0.0-20210423185535-09eb48e85fd7` to `v0.0.0-20220919091848-fb04ddd9f9c8`. - This addresses [GO-2022-0493](https://pkg.go.dev/vuln/GO-2022-0493). (#3235) - -## [0.32.2] Metric SDK (Alpha) - 2022-10-11 - -### Added - -- Added an example of using metric views to customize instruments. (#3177) -- Add default User-Agent header to OTLP exporter requests (`go.opentelemetry.io/otel/exporters/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlpmetric/otlpmetrichttp`). (#3261) - -### Changed - -- Flush pending measurements with the `PeriodicReader` in the `go.opentelemetry.io/otel/sdk/metric` when `ForceFlush` or `Shutdown` are called. (#3220) -- Update histogram default bounds to match the requirements of the latest specification. (#3222) -- Encode the HTTP status code in the OpenTracing bridge (`go.opentelemetry.io/otel/bridge/opentracing`) as an integer. (#3265) - -### Fixed - -- Use default view if instrument does not match any registered view of a reader. (#3224, #3237) -- Return the same instrument every time a user makes the exact same instrument creation call. (#3229, #3251) -- Return the existing instrument when a view transforms a creation call to match an existing instrument. (#3240, #3251) -- Log a warning when a conflicting instrument (e.g. description, unit, data-type) is created instead of returning an error. (#3251) -- The OpenCensus bridge no longer sends empty batches of metrics. (#3263) - -## [0.32.1] Metric SDK (Alpha) - 2022-09-22 - -### Changed - -- The Prometheus exporter sanitizes OpenTelemetry instrument names when exporting. - Invalid characters are replaced with `_`. (#3212) - -### Added - -- The metric portion of the OpenCensus bridge (`go.opentelemetry.io/otel/bridge/opencensus`) has been reintroduced. (#3192) -- The OpenCensus bridge example (`go.opentelemetry.io/otel/example/opencensus`) has been reintroduced. (#3206) - -### Fixed - -- Updated go.mods to point to valid versions of the sdk. (#3216) -- Set the `MeterProvider` resource on all exported metric data. (#3218) - -## [0.32.0] Revised Metric SDK (Alpha) - 2022-09-18 - -### Changed - -- The metric SDK in `go.opentelemetry.io/otel/sdk/metric` is completely refactored to comply with the OpenTelemetry specification. - Please see the package documentation for how the new SDK is initialized and configured. (#3175) -- Update the minimum supported go version to go1.18. Removes support for go1.17 (#3179) - -### Removed - -- The metric portion of the OpenCensus bridge (`go.opentelemetry.io/otel/bridge/opencensus`) has been removed. - A new bridge compliant with the revised metric SDK will be added back in a future release. (#3175) -- The `go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest` package is removed, see the new metric SDK. (#3175) -- The `go.opentelemetry.io/otel/sdk/metric/aggregator/histogram` package is removed, see the new metric SDK. (#3175) -- The `go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue` package is removed, see the new metric SDK. (#3175) -- The `go.opentelemetry.io/otel/sdk/metric/aggregator/sum` package is removed, see the new metric SDK. (#3175) -- The `go.opentelemetry.io/otel/sdk/metric/aggregator` package is removed, see the new metric SDK. (#3175) -- The `go.opentelemetry.io/otel/sdk/metric/controller/basic` package is removed, see the new metric SDK. (#3175) -- The `go.opentelemetry.io/otel/sdk/metric/controller/controllertest` package is removed, see the new metric SDK. (#3175) -- The `go.opentelemetry.io/otel/sdk/metric/controller/time` package is removed, see the new metric SDK. (#3175) -- The `go.opentelemetry.io/otel/sdk/metric/export/aggregation` package is removed, see the new metric SDK. (#3175) -- The `go.opentelemetry.io/otel/sdk/metric/export` package is removed, see the new metric SDK. (#3175) -- The `go.opentelemetry.io/otel/sdk/metric/metrictest` package is removed. - A replacement package that supports the new metric SDK will be added back in a future release. (#3175) -- The `go.opentelemetry.io/otel/sdk/metric/number` package is removed, see the new metric SDK. (#3175) -- The `go.opentelemetry.io/otel/sdk/metric/processor/basic` package is removed, see the new metric SDK. (#3175) -- The `go.opentelemetry.io/otel/sdk/metric/processor/processortest` package is removed, see the new metric SDK. (#3175) -- The `go.opentelemetry.io/otel/sdk/metric/processor/reducer` package is removed, see the new metric SDK. (#3175) -- The `go.opentelemetry.io/otel/sdk/metric/registry` package is removed, see the new metric SDK. (#3175) -- The `go.opentelemetry.io/otel/sdk/metric/sdkapi` package is removed, see the new metric SDK. (#3175) -- The `go.opentelemetry.io/otel/sdk/metric/selector/simple` package is removed, see the new metric SDK. (#3175) -- The `"go.opentelemetry.io/otel/sdk/metric".ErrUninitializedInstrument` variable was removed. (#3175) -- The `"go.opentelemetry.io/otel/sdk/metric".ErrBadInstrument` variable was removed. (#3175) -- The `"go.opentelemetry.io/otel/sdk/metric".Accumulator` type was removed, see the `MeterProvider`in the new metric SDK. (#3175) -- The `"go.opentelemetry.io/otel/sdk/metric".NewAccumulator` function was removed, see `NewMeterProvider`in the new metric SDK. (#3175) -- The deprecated `"go.opentelemetry.io/otel/sdk/metric".AtomicFieldOffsets` function was removed. (#3175) - -## [1.10.0] - 2022-09-09 - -### Added - -- Support Go 1.19. (#3077) - Include compatibility testing and document support. (#3077) -- Support the OTLP ExportTracePartialSuccess response; these are passed to the registered error handler. (#3106) -- Upgrade go.opentelemetry.io/proto/otlp from v0.18.0 to v0.19.0 (#3107) - -### Changed - -- Fix misidentification of OpenTelemetry `SpanKind` in OpenTracing bridge (`go.opentelemetry.io/otel/bridge/opentracing`). (#3096) -- Attempting to start a span with a nil `context` will no longer cause a panic. (#3110) -- All exporters will be shutdown even if one reports an error (#3091) -- Ensure valid UTF-8 when truncating over-length attribute values. (#3156) - -## [1.9.0/0.0.3] - 2022-08-01 - -### Added - -- Add support for Schema Files format 1.1.x (metric "split" transform) with the new `go.opentelemetry.io/otel/schema/v1.1` package. (#2999) -- Add the `go.opentelemetry.io/otel/semconv/v1.11.0` package. - The package contains semantic conventions from the `v1.11.0` version of the OpenTelemetry specification. (#3009) -- Add the `go.opentelemetry.io/otel/semconv/v1.12.0` package. - The package contains semantic conventions from the `v1.12.0` version of the OpenTelemetry specification. (#3010) -- Add the `http.method` attribute to HTTP server metric from all `go.opentelemetry.io/otel/semconv/*` packages. (#3018) - -### Fixed - -- Invalid warning for context setup being deferred in `go.opentelemetry.io/otel/bridge/opentracing` package. (#3029) - -## [1.8.0/0.31.0] - 2022-07-08 - -### Added - -- Add support for `opentracing.TextMap` format in the `Inject` and `Extract` methods -of the `"go.opentelemetry.io/otel/bridge/opentracing".BridgeTracer` type. (#2911) - -### Changed - -- The `crosslink` make target has been updated to use the `go.opentelemetry.io/build-tools/crosslink` package. (#2886) -- In the `go.opentelemetry.io/otel/sdk/instrumentation` package rename `Library` to `Scope` and alias `Library` as `Scope` (#2976) -- Move metric no-op implementation form `nonrecording` to `metric` package. (#2866) - -### Removed - -- Support for go1.16. Support is now only for go1.17 and go1.18 (#2917) - -### Deprecated - -- The `Library` struct in the `go.opentelemetry.io/otel/sdk/instrumentation` package is deprecated. - Use the equivalent `Scope` struct instead. (#2977) -- The `ReadOnlySpan.InstrumentationLibrary` method from the `go.opentelemetry.io/otel/sdk/trace` package is deprecated. - Use the equivalent `ReadOnlySpan.InstrumentationScope` method instead. (#2977) - -## [1.7.0/0.30.0] - 2022-04-28 - -### Added - -- Add the `go.opentelemetry.io/otel/semconv/v1.8.0` package. - The package contains semantic conventions from the `v1.8.0` version of the OpenTelemetry specification. (#2763) -- Add the `go.opentelemetry.io/otel/semconv/v1.9.0` package. - The package contains semantic conventions from the `v1.9.0` version of the OpenTelemetry specification. (#2792) -- Add the `go.opentelemetry.io/otel/semconv/v1.10.0` package. - The package contains semantic conventions from the `v1.10.0` version of the OpenTelemetry specification. (#2842) -- Added an in-memory exporter to metrictest to aid testing with a full SDK. (#2776) - -### Fixed - -- Globally delegated instruments are unwrapped before delegating asynchronous callbacks. (#2784) -- Remove import of `testing` package in non-tests builds of the `go.opentelemetry.io/otel` package. (#2786) - -### Changed - -- The `WithLabelEncoder` option from the `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` package is renamed to `WithAttributeEncoder`. (#2790) -- The `LabelFilterSelector` interface from `go.opentelemetry.io/otel/sdk/metric/processor/reducer` is renamed to `AttributeFilterSelector`. - The method included in the renamed interface also changed from `LabelFilterFor` to `AttributeFilterFor`. (#2790) -- The `Metadata.Labels` method from the `go.opentelemetry.io/otel/sdk/metric/export` package is renamed to `Metadata.Attributes`. - Consequentially, the `Record` type from the same package also has had the embedded method renamed. (#2790) - -### Deprecated - -- The `Iterator.Label` method in the `go.opentelemetry.io/otel/attribute` package is deprecated. - Use the equivalent `Iterator.Attribute` method instead. (#2790) -- The `Iterator.IndexedLabel` method in the `go.opentelemetry.io/otel/attribute` package is deprecated. - Use the equivalent `Iterator.IndexedAttribute` method instead. (#2790) -- The `MergeIterator.Label` method in the `go.opentelemetry.io/otel/attribute` package is deprecated. - Use the equivalent `MergeIterator.Attribute` method instead. (#2790) - -### Removed - -- Removed the `Batch` type from the `go.opentelemetry.io/otel/sdk/metric/metrictest` package. (#2864) -- Removed the `Measurement` type from the `go.opentelemetry.io/otel/sdk/metric/metrictest` package. (#2864) - -## [0.29.0] - 2022-04-11 - -### Added - -- The metrics global package was added back into several test files. (#2764) -- The `Meter` function is added back to the `go.opentelemetry.io/otel/metric/global` package. - This function is a convenience function equivalent to calling `global.MeterProvider().Meter(...)`. (#2750) - -### Removed - -- Removed module the `go.opentelemetry.io/otel/sdk/export/metric`. - Use the `go.opentelemetry.io/otel/sdk/metric` module instead. (#2720) - -### Changed - -- Don't panic anymore when setting a global MeterProvider to itself. (#2749) -- Upgrade `go.opentelemetry.io/proto/otlp` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` from `v0.12.1` to `v0.15.0`. - This replaces the use of the now deprecated `InstrumentationLibrary` and `InstrumentationLibraryMetrics` types and fields in the proto library with the equivalent `InstrumentationScope` and `ScopeMetrics`. (#2748) - -## [1.6.3] - 2022-04-07 - -### Fixed - -- Allow non-comparable global `MeterProvider`, `TracerProvider`, and `TextMapPropagator` types to be set. (#2772, #2773) - -## [1.6.2] - 2022-04-06 - -### Changed - -- Don't panic anymore when setting a global TracerProvider or TextMapPropagator to itself. (#2749) -- Upgrade `go.opentelemetry.io/proto/otlp` in `go.opentelemetry.io/otel/exporters/otlp/otlptrace` from `v0.12.1` to `v0.15.0`. - This replaces the use of the now deprecated `InstrumentationLibrary` and `InstrumentationLibrarySpans` types and fields in the proto library with the equivalent `InstrumentationScope` and `ScopeSpans`. (#2748) - -## [1.6.1] - 2022-03-28 - -### Fixed - -- The `go.opentelemetry.io/otel/schema/*` packages now use the correct schema URL for their `SchemaURL` constant. - Instead of using `"https://opentelemetry.io/schemas/v"` they now use the correct URL without a `v` prefix, `"https://opentelemetry.io/schemas/"`. (#2743, #2744) - -### Security - -- Upgrade `go.opentelemetry.io/proto/otlp` from `v0.12.0` to `v0.12.1`. - This includes an indirect upgrade of `github.com/grpc-ecosystem/grpc-gateway` which resolves [a vulnerability](https://nvd.nist.gov/vuln/detail/CVE-2019-11254) from `gopkg.in/yaml.v2` in version `v2.2.3`. (#2724, #2728) - -## [1.6.0/0.28.0] - 2022-03-23 - -### ⚠️ Notice ⚠️ - -This update is a breaking change of the unstable Metrics API. -Code instrumented with the `go.opentelemetry.io/otel/metric` will need to be modified. - -### Added - -- Add metrics exponential histogram support. - New mapping functions have been made available in `sdk/metric/aggregator/exponential/mapping` for other OpenTelemetry projects to take dependencies on. (#2502) -- Add Go 1.18 to our compatibility tests. (#2679) -- Allow configuring the Sampler with the `OTEL_TRACES_SAMPLER` and `OTEL_TRACES_SAMPLER_ARG` environment variables. (#2305, #2517) -- Add the `metric/global` for obtaining and setting the global `MeterProvider`. (#2660) - -### Changed - -- The metrics API has been significantly changed to match the revised OpenTelemetry specification. - High-level changes include: - - - Synchronous and asynchronous instruments are now handled by independent `InstrumentProvider`s. - These `InstrumentProvider`s are managed with a `Meter`. - - Synchronous and asynchronous instruments are grouped into their own packages based on value types. - - Asynchronous callbacks can now be registered with a `Meter`. - - Be sure to check out the metric module documentation for more information on how to use the revised API. (#2587, #2660) - -### Fixed - -- Fallback to general attribute limits when span specific ones are not set in the environment. (#2675, #2677) - -## [1.5.0] - 2022-03-16 - -### Added - -- Log the Exporters configuration in the TracerProviders message. (#2578) -- Added support to configure the span limits with environment variables. - The following environment variables are supported. (#2606, #2637) - - `OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT` - - `OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT` - - `OTEL_SPAN_EVENT_COUNT_LIMIT` - - `OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT` - - `OTEL_SPAN_LINK_COUNT_LIMIT` - - `OTEL_LINK_ATTRIBUTE_COUNT_LIMIT` - - If the provided environment variables are invalid (negative), the default values would be used. -- Rename the `gc` runtime name to `go` (#2560) -- Add resource container ID detection. (#2418) -- Add span attribute value length limit. - The new `AttributeValueLengthLimit` field is added to the `"go.opentelemetry.io/otel/sdk/trace".SpanLimits` type to configure this limit for a `TracerProvider`. - The default limit for this resource is "unlimited". (#2637) -- Add the `WithRawSpanLimits` option to `go.opentelemetry.io/otel/sdk/trace`. - This option replaces the `WithSpanLimits` option. - Zero or negative values will not be changed to the default value like `WithSpanLimits` does. - Setting a limit to zero will effectively disable the related resource it limits and setting to a negative value will mean that resource is unlimited. - Consequentially, limits should be constructed using `NewSpanLimits` and updated accordingly. (#2637) - -### Changed - -- Drop oldest tracestate `Member` when capacity is reached. (#2592) -- Add event and link drop counts to the exported data from the `oltptrace` exporter. (#2601) -- Unify path cleaning functionally in the `otlpmetric` and `otlptrace` configuration. (#2639) -- Change the debug message from the `sdk/trace.BatchSpanProcessor` to reflect the count is cumulative. (#2640) -- Introduce new internal `envconfig` package for OTLP exporters. (#2608) -- If `http.Request.Host` is empty, fall back to use `URL.Host` when populating `http.host` in the `semconv` packages. (#2661) - -### Fixed - -- Remove the OTLP trace exporter limit of SpanEvents when exporting. (#2616) -- Default to port `4318` instead of `4317` for the `otlpmetrichttp` and `otlptracehttp` client. (#2614, #2625) -- Unlimited span limits are now supported (negative values). (#2636, #2637) - -### Deprecated - -- Deprecated `"go.opentelemetry.io/otel/sdk/trace".WithSpanLimits`. - Use `WithRawSpanLimits` instead. - That option allows setting unlimited and zero limits, this option does not. - This option will be kept until the next major version incremented release. (#2637) - -## [1.4.1] - 2022-02-16 - -### Fixed - -- Fix race condition in reading the dropped spans number for the `BatchSpanProcessor`. (#2615) - -## [1.4.0] - 2022-02-11 - -### Added - -- Use `OTEL_EXPORTER_ZIPKIN_ENDPOINT` environment variable to specify zipkin collector endpoint. (#2490) -- Log the configuration of `TracerProvider`s, and `Tracer`s for debugging. - To enable use a logger with Verbosity (V level) `>=1`. (#2500) -- Added support to configure the batch span-processor with environment variables. - The following environment variables are used. (#2515) - - `OTEL_BSP_SCHEDULE_DELAY` - - `OTEL_BSP_EXPORT_TIMEOUT` - - `OTEL_BSP_MAX_QUEUE_SIZE`. - - `OTEL_BSP_MAX_EXPORT_BATCH_SIZE` - -### Changed - -- Zipkin exporter exports `Resource` attributes in the `Tags` field. (#2589) - -### Deprecated - -- Deprecate module the `go.opentelemetry.io/otel/sdk/export/metric`. - Use the `go.opentelemetry.io/otel/sdk/metric` module instead. (#2382) -- Deprecate `"go.opentelemetry.io/otel/sdk/metric".AtomicFieldOffsets`. (#2445) - -### Fixed - -- Fixed the instrument kind for noop async instruments to correctly report an implementation. (#2461) -- Fix UDP packets overflowing with Jaeger payloads. (#2489, #2512) -- Change the `otlpmetric.Client` interface's `UploadMetrics` method to accept a single `ResourceMetrics` instead of a slice of them. (#2491) -- Specify explicit buckets in Prometheus example, fixing issue where example only has `+inf` bucket. (#2419, #2493) -- W3C baggage will now decode urlescaped values. (#2529) -- Baggage members are now only validated once, when calling `NewMember` and not also when adding it to the baggage itself. (#2522) -- The order attributes are dropped from spans in the `go.opentelemetry.io/otel/sdk/trace` package when capacity is reached is fixed to be in compliance with the OpenTelemetry specification. - Instead of dropping the least-recently-used attribute, the last added attribute is dropped. - This drop order still only applies to attributes with unique keys not already contained in the span. - If an attribute is added with a key already contained in the span, that attribute is updated to the new value being added. (#2576) - -### Removed - -- Updated `go.opentelemetry.io/proto/otlp` from `v0.11.0` to `v0.12.0`. This version removes a number of deprecated methods. (#2546) - - [`Metric.GetIntGauge()`](https://pkg.go.dev/go.opentelemetry.io/proto/otlp@v0.11.0/metrics/v1#Metric.GetIntGauge) - - [`Metric.GetIntHistogram()`](https://pkg.go.dev/go.opentelemetry.io/proto/otlp@v0.11.0/metrics/v1#Metric.GetIntHistogram) - - [`Metric.GetIntSum()`](https://pkg.go.dev/go.opentelemetry.io/proto/otlp@v0.11.0/metrics/v1#Metric.GetIntSum) - -## [1.3.0] - 2021-12-10 - -### ⚠️ Notice ⚠️ - -We have updated the project minimum supported Go version to 1.16 - -### Added - -- Added an internal Logger. - This can be used by the SDK and API to provide users with feedback of the internal state. - To enable verbose logs configure the logger which will print V(1) logs. For debugging information configure to print V(5) logs. (#2343) -- Add the `WithRetry` `Option` and the `RetryConfig` type to the `go.opentelemetry.io/otel/exporter/otel/otlpmetric/otlpmetrichttp` package to specify retry behavior consistently. (#2425) -- Add `SpanStatusFromHTTPStatusCodeAndSpanKind` to all `semconv` packages to return a span status code similar to `SpanStatusFromHTTPStatusCode`, but exclude `4XX` HTTP errors as span errors if the span is of server kind. (#2296) - -### Changed - -- The `"go.opentelemetry.io/otel/exporter/otel/otlptrace/otlptracegrpc".Client` now uses the underlying gRPC `ClientConn` to handle name resolution, TCP connection establishment (with retries and backoff) and TLS handshakes, and handling errors on established connections by re-resolving the name and reconnecting. (#2329) -- The `"go.opentelemetry.io/otel/exporter/otel/otlpmetric/otlpmetricgrpc".Client` now uses the underlying gRPC `ClientConn` to handle name resolution, TCP connection establishment (with retries and backoff) and TLS handshakes, and handling errors on established connections by re-resolving the name and reconnecting. (#2425) -- The `"go.opentelemetry.io/otel/exporter/otel/otlpmetric/otlpmetricgrpc".RetrySettings` type is renamed to `RetryConfig`. (#2425) -- The `go.opentelemetry.io/otel/exporter/otel/*` gRPC exporters now default to using the host's root CA set if none are provided by the user and `WithInsecure` is not specified. (#2432) -- Change `resource.Default` to be evaluated the first time it is called, rather than on import. This allows the caller the option to update `OTEL_RESOURCE_ATTRIBUTES` first, such as with `os.Setenv`. (#2371) - -### Fixed - -- The `go.opentelemetry.io/otel/exporter/otel/*` exporters are updated to handle per-signal and universal endpoints according to the OpenTelemetry specification. - Any per-signal endpoint set via an `OTEL_EXPORTER_OTLP__ENDPOINT` environment variable is now used without modification of the path. - When `OTEL_EXPORTER_OTLP_ENDPOINT` is set, if it contains a path, that path is used as a base path which per-signal paths are appended to. (#2433) -- Basic metric controller updated to use sync.Map to avoid blocking calls (#2381) -- The `go.opentelemetry.io/otel/exporter/jaeger` correctly sets the `otel.status_code` value to be a string of `ERROR` or `OK` instead of an integer code. (#2439, #2440) - -### Deprecated - -- Deprecated the `"go.opentelemetry.io/otel/exporter/otel/otlpmetric/otlpmetrichttp".WithMaxAttempts` `Option`, use the new `WithRetry` `Option` instead. (#2425) -- Deprecated the `"go.opentelemetry.io/otel/exporter/otel/otlpmetric/otlpmetrichttp".WithBackoff` `Option`, use the new `WithRetry` `Option` instead. (#2425) - -### Removed - -- Remove the metric Processor's ability to convert cumulative to delta aggregation temporality. (#2350) -- Remove the metric Bound Instruments interface and implementations. (#2399) -- Remove the metric MinMaxSumCount kind aggregation and the corresponding OTLP export path. (#2423) -- Metric SDK removes the "exact" aggregator for histogram instruments, as it performed a non-standard aggregation for OTLP export (creating repeated Gauge points) and worked its way into a number of confusing examples. (#2348) - -## [1.2.0] - 2021-11-12 - -### Changed - -- Metric SDK `export.ExportKind`, `export.ExportKindSelector` types have been renamed to `aggregation.Temporality` and `aggregation.TemporalitySelector` respectively to keep in line with current specification and protocol along with built-in selectors (e.g., `aggregation.CumulativeTemporalitySelector`, ...). (#2274) -- The Metric `Exporter` interface now requires a `TemporalitySelector` method instead of an `ExportKindSelector`. (#2274) -- Metrics API cleanup. The `metric/sdkapi` package has been created to relocate the API-to-SDK interface: - - The following interface types simply moved from `metric` to `metric/sdkapi`: `Descriptor`, `MeterImpl`, `InstrumentImpl`, `SyncImpl`, `BoundSyncImpl`, `AsyncImpl`, `AsyncRunner`, `AsyncSingleRunner`, and `AsyncBatchRunner` - - The following struct types moved and are replaced with type aliases, since they are exposed to the user: `Observation`, `Measurement`. - - The No-op implementations of sync and async instruments are no longer exported, new functions `sdkapi.NewNoopAsyncInstrument()` and `sdkapi.NewNoopSyncInstrument()` are provided instead. (#2271) -- Update the SDK `BatchSpanProcessor` to export all queued spans when `ForceFlush` is called. (#2080, #2335) - -### Added - -- Add the `"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc".WithGRPCConn` option so the exporter can reuse an existing gRPC connection. (#2002) -- Added a new `schema` module to help parse Schema Files in OTEP 0152 format. (#2267) -- Added a new `MapCarrier` to the `go.opentelemetry.io/otel/propagation` package to hold propagated cross-cutting concerns as a `map[string]string` held in memory. (#2334) - -## [1.1.0] - 2021-10-27 - -### Added - -- Add the `"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc".WithGRPCConn` option so the exporter can reuse an existing gRPC connection. (#2002) -- Add the `go.opentelemetry.io/otel/semconv/v1.7.0` package. - The package contains semantic conventions from the `v1.7.0` version of the OpenTelemetry specification. (#2320) -- Add the `go.opentelemetry.io/otel/semconv/v1.6.1` package. - The package contains semantic conventions from the `v1.6.1` version of the OpenTelemetry specification. (#2321) -- Add the `go.opentelemetry.io/otel/semconv/v1.5.0` package. - The package contains semantic conventions from the `v1.5.0` version of the OpenTelemetry specification. (#2322) - - When upgrading from the `semconv/v1.4.0` package note the following name changes: - - `K8SReplicasetUIDKey` -> `K8SReplicaSetUIDKey` - - `K8SReplicasetNameKey` -> `K8SReplicaSetNameKey` - - `K8SStatefulsetUIDKey` -> `K8SStatefulSetUIDKey` - - `k8SStatefulsetNameKey` -> `K8SStatefulSetNameKey` - - `K8SDaemonsetUIDKey` -> `K8SDaemonSetUIDKey` - - `K8SDaemonsetNameKey` -> `K8SDaemonSetNameKey` - -### Changed - -- Links added to a span will be dropped by the SDK if they contain an invalid span context (#2275). - -### Fixed - -- The `"go.opentelemetry.io/otel/semconv/v1.4.0".HTTPServerAttributesFromHTTPRequest` now correctly only sets the HTTP client IP attribute even if the connection was routed with proxies and there are multiple addresses in the `X-Forwarded-For` header. (#2282, #2284) -- The `"go.opentelemetry.io/otel/semconv/v1.4.0".NetAttributesFromHTTPRequest` function correctly handles IPv6 addresses as IP addresses and sets the correct net peer IP instead of the net peer hostname attribute. (#2283, #2285) -- The simple span processor shutdown method deterministically returns the exporter error status if it simultaneously finishes when the deadline is reached. (#2290, #2289) - -## [1.0.1] - 2021-10-01 - -### Fixed - -- json stdout exporter no longer crashes due to concurrency bug. (#2265) - -## [Metrics 0.24.0] - 2021-10-01 - -### Changed - -- NoopMeterProvider is now private and NewNoopMeterProvider must be used to obtain a noopMeterProvider. (#2237) -- The Metric SDK `Export()` function takes a new two-level reader interface for iterating over results one instrumentation library at a time. (#2197) - - The former `"go.opentelemetry.io/otel/sdk/export/metric".CheckpointSet` is renamed `Reader`. - - The new interface is named `"go.opentelemetry.io/otel/sdk/export/metric".InstrumentationLibraryReader`. - -## [1.0.0] - 2021-09-20 - -This is the first stable release for the project. -This release includes an API and SDK for the tracing signal that will comply with the stability guarantees defined by the projects [versioning policy](./VERSIONING.md). - -### Added - -- OTLP trace exporter now sets the `SchemaURL` field in the exported telemetry if the Tracer has `WithSchemaURL` option. (#2242) - -### Fixed - -- Slice-valued attributes can correctly be used as map keys. (#2223) - -### Removed - -- Removed the `"go.opentelemetry.io/otel/exporters/zipkin".WithSDKOptions` function. (#2248) -- Removed the deprecated package `go.opentelemetry.io/otel/oteltest`. (#2234) -- Removed the deprecated package `go.opentelemetry.io/otel/bridge/opencensus/utils`. (#2233) -- Removed deprecated functions, types, and methods from `go.opentelemetry.io/otel/attribute` package. - Use the typed functions and methods added to the package instead. (#2235) - - The `Key.Array` method is removed. - - The `Array` function is removed. - - The `Any` function is removed. - - The `ArrayValue` function is removed. - - The `AsArray` function is removed. - -## [1.0.0-RC3] - 2021-09-02 - -### Added - -- Added `ErrorHandlerFunc` to use a function as an `"go.opentelemetry.io/otel".ErrorHandler`. (#2149) -- Added `"go.opentelemetry.io/otel/trace".WithStackTrace` option to add a stack trace when using `span.RecordError` or when panic is handled in `span.End`. (#2163) -- Added typed slice attribute types and functionality to the `go.opentelemetry.io/otel/attribute` package to replace the existing array type and functions. (#2162) - - `BoolSlice`, `IntSlice`, `Int64Slice`, `Float64Slice`, and `StringSlice` replace the use of the `Array` function in the package. -- Added the `go.opentelemetry.io/otel/example/fib` example package. - Included is an example application that computes Fibonacci numbers. (#2203) - -### Changed - -- Metric instruments have been renamed to match the (feature-frozen) metric API specification: - - ValueRecorder becomes Histogram - - ValueObserver becomes Gauge - - SumObserver becomes CounterObserver - - UpDownSumObserver becomes UpDownCounterObserver - The API exported from this project is still considered experimental. (#2202) -- Metric SDK/API implementation type `InstrumentKind` moves into `sdkapi` sub-package. (#2091) -- The Metrics SDK export record no longer contains a Resource pointer, the SDK `"go.opentelemetry.io/otel/sdk/trace/export/metric".Exporter.Export()` function for push-based exporters now takes a single Resource argument, pull-based exporters use `"go.opentelemetry.io/otel/sdk/metric/controller/basic".Controller.Resource()`. (#2120) -- The JSON output of the `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` is harmonized now such that the output is "plain" JSON objects after each other of the form `{ ... } { ... } { ... }`. Earlier the JSON objects describing a span were wrapped in a slice for each `Exporter.ExportSpans` call, like `[ { ... } ][ { ... } { ... } ]`. Outputting JSON object directly after each other is consistent with JSON loggers, and a bit easier to parse and read. (#2196) -- Update the `NewTracerConfig`, `NewSpanStartConfig`, `NewSpanEndConfig`, and `NewEventConfig` function in the `go.opentelemetry.io/otel/trace` package to return their respective configurations as structs instead of pointers to the struct. (#2212) - -### Deprecated - -- The `go.opentelemetry.io/otel/bridge/opencensus/utils` package is deprecated. - All functionality from this package now exists in the `go.opentelemetry.io/otel/bridge/opencensus` package. - The functions from that package should be used instead. (#2166) -- The `"go.opentelemetry.io/otel/attribute".Array` function and the related `ARRAY` value type is deprecated. - Use the typed `*Slice` functions and types added to the package instead. (#2162) -- The `"go.opentelemetry.io/otel/attribute".Any` function is deprecated. - Use the typed functions instead. (#2181) -- The `go.opentelemetry.io/otel/oteltest` package is deprecated. - The `"go.opentelemetry.io/otel/sdk/trace/tracetest".SpanRecorder` can be registered with the default SDK (`go.opentelemetry.io/otel/sdk/trace`) as a `SpanProcessor` and used as a replacement for this deprecated package. (#2188) - -### Removed - -- Removed metrics test package `go.opentelemetry.io/otel/sdk/export/metric/metrictest`. (#2105) - -### Fixed - -- The `fromEnv` detector no longer throws an error when `OTEL_RESOURCE_ATTRIBUTES` environment variable is not set or empty. (#2138) -- Setting the global `ErrorHandler` with `"go.opentelemetry.io/otel".SetErrorHandler` multiple times is now supported. (#2160, #2140) -- The `"go.opentelemetry.io/otel/attribute".Any` function now supports `int32` values. (#2169) -- Multiple calls to `"go.opentelemetry.io/otel/sdk/metric/controller/basic".WithResource()` are handled correctly, and when no resources are provided `"go.opentelemetry.io/otel/sdk/resource".Default()` is used. (#2120) -- The `WithoutTimestamps` option for the `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` exporter causes the exporter to correctly omit timestamps. (#2195) -- Fixed typos in resources.go. (#2201) - -## [1.0.0-RC2] - 2021-07-26 - -### Added - -- Added `WithOSDescription` resource configuration option to set OS (Operating System) description resource attribute (`os.description`). (#1840) -- Added `WithOS` resource configuration option to set all OS (Operating System) resource attributes at once. (#1840) -- Added the `WithRetry` option to the `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` package. - This option is a replacement for the removed `WithMaxAttempts` and `WithBackoff` options. (#2095) -- Added API `LinkFromContext` to return Link which encapsulates SpanContext from provided context and also encapsulates attributes. (#2115) -- Added a new `Link` type under the SDK `otel/sdk/trace` package that counts the number of attributes that were dropped for surpassing the `AttributePerLinkCountLimit` configured in the Span's `SpanLimits`. - This new type replaces the equal-named API `Link` type found in the `otel/trace` package for most usages within the SDK. - For example, instances of this type are now returned by the `Links()` function of `ReadOnlySpan`s provided in places like the `OnEnd` function of `SpanProcessor` implementations. (#2118) -- Added the `SpanRecorder` type to the `go.opentelemetry.io/otel/skd/trace/tracetest` package. - This type can be used with the default SDK as a `SpanProcessor` during testing. (#2132) - -### Changed - -- The `SpanModels` function is now exported from the `go.opentelemetry.io/otel/exporters/zipkin` package to convert OpenTelemetry spans into Zipkin model spans. (#2027) -- Rename the `"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc".RetrySettings` to `RetryConfig`. (#2095) - -### Deprecated - -- The `TextMapCarrier` and `TextMapPropagator` from the `go.opentelemetry.io/otel/oteltest` package and their associated creation functions (`TextMapCarrier`, `NewTextMapPropagator`) are deprecated. (#2114) -- The `Harness` type from the `go.opentelemetry.io/otel/oteltest` package and its associated creation function, `NewHarness` are deprecated and will be removed in the next release. (#2123) -- The `TraceStateFromKeyValues` function from the `go.opentelemetry.io/otel/oteltest` package is deprecated. - Use the `trace.ParseTraceState` function instead. (#2122) - -### Removed - -- Removed the deprecated package `go.opentelemetry.io/otel/exporters/trace/jaeger`. (#2020) -- Removed the deprecated package `go.opentelemetry.io/otel/exporters/trace/zipkin`. (#2020) -- Removed the `"go.opentelemetry.io/otel/sdk/resource".WithBuiltinDetectors` function. - The explicit `With*` options for every built-in detector should be used instead. (#2026 #2097) -- Removed the `WithMaxAttempts` and `WithBackoff` options from the `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` package. - The retry logic of the package has been updated to match the `otlptracegrpc` package and accordingly a `WithRetry` option is added that should be used instead. (#2095) -- Removed `DroppedAttributeCount` field from `otel/trace.Link` struct. (#2118) - -### Fixed - -- When using WithNewRoot, don't use the parent context for making sampling decisions. (#2032) -- `oteltest.Tracer` now creates a valid `SpanContext` when using `WithNewRoot`. (#2073) -- OS type detector now sets the correct `dragonflybsd` value for DragonFly BSD. (#2092) -- The OTel span status is correctly transformed into the OTLP status in the `go.opentelemetry.io/otel/exporters/otlp/otlptrace` package. - This fix will by default set the status to `Unset` if it is not explicitly set to `Ok` or `Error`. (#2099 #2102) -- The `Inject` method for the `"go.opentelemetry.io/otel/propagation".TraceContext` type no longer injects empty `tracestate` values. (#2108) -- Use `6831` as default Jaeger agent port instead of `6832`. (#2131) - -## [Experimental Metrics v0.22.0] - 2021-07-19 - -### Added - -- Adds HTTP support for OTLP metrics exporter. (#2022) - -### Removed - -- Removed the deprecated package `go.opentelemetry.io/otel/exporters/metric/prometheus`. (#2020) - -## [1.0.0-RC1] / 0.21.0 - 2021-06-18 - -With this release we are introducing a split in module versions. The tracing API and SDK are entering the `v1.0.0` Release Candidate phase with `v1.0.0-RC1` -while the experimental metrics API and SDK continue with `v0.x` releases at `v0.21.0`. Modules at major version 1 or greater will not depend on modules -with major version 0. - -### Added - -- Adds `otlpgrpc.WithRetry`option for configuring the retry policy for transient errors on the otlp/gRPC exporter. (#1832) - - The following status codes are defined as transient errors: - | gRPC Status Code | Description | - | ---------------- | ----------- | - | 1 | Cancelled | - | 4 | Deadline Exceeded | - | 8 | Resource Exhausted | - | 10 | Aborted | - | 10 | Out of Range | - | 14 | Unavailable | - | 15 | Data Loss | -- Added `Status` type to the `go.opentelemetry.io/otel/sdk/trace` package to represent the status of a span. (#1874) -- Added `SpanStub` type and its associated functions to the `go.opentelemetry.io/otel/sdk/trace/tracetest` package. - This type can be used as a testing replacement for the `SpanSnapshot` that was removed from the `go.opentelemetry.io/otel/sdk/trace` package. (#1873) -- Adds support for scheme in `OTEL_EXPORTER_OTLP_ENDPOINT` according to the spec. (#1886) -- Adds `trace.WithSchemaURL` option for configuring the tracer with a Schema URL. (#1889) -- Added an example of using OpenTelemetry Go as a trace context forwarder. (#1912) -- `ParseTraceState` is added to the `go.opentelemetry.io/otel/trace` package. - It can be used to decode a `TraceState` from a `tracestate` header string value. (#1937) -- Added `Len` method to the `TraceState` type in the `go.opentelemetry.io/otel/trace` package. - This method returns the number of list-members the `TraceState` holds. (#1937) -- Creates package `go.opentelemetry.io/otel/exporters/otlp/otlptrace` that defines a trace exporter that uses a `otlptrace.Client` to send data. - Creates package `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc` implementing a gRPC `otlptrace.Client` and offers convenience functions, `NewExportPipeline` and `InstallNewPipeline`, to setup and install a `otlptrace.Exporter` in tracing .(#1922) -- Added `Baggage`, `Member`, and `Property` types to the `go.opentelemetry.io/otel/baggage` package along with their related functions. (#1967) -- Added `ContextWithBaggage`, `ContextWithoutBaggage`, and `FromContext` functions to the `go.opentelemetry.io/otel/baggage` package. - These functions replace the `Set`, `Value`, `ContextWithValue`, `ContextWithoutValue`, and `ContextWithEmpty` functions from that package and directly work with the new `Baggage` type. (#1967) -- The `OTEL_SERVICE_NAME` environment variable is the preferred source for `service.name`, used by the environment resource detector if a service name is present both there and in `OTEL_RESOURCE_ATTRIBUTES`. (#1969) -- Creates package `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` implementing an HTTP `otlptrace.Client` and offers convenience functions, `NewExportPipeline` and `InstallNewPipeline`, to setup and install a `otlptrace.Exporter` in tracing. (#1963) -- Changes `go.opentelemetry.io/otel/sdk/resource.NewWithAttributes` to require a schema URL. The old function is still available as `resource.NewSchemaless`. This is a breaking change. (#1938) -- Several builtin resource detectors now correctly populate the schema URL. (#1938) -- Creates package `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` that defines a metrics exporter that uses a `otlpmetric.Client` to send data. -- Creates package `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` implementing a gRPC `otlpmetric.Client` and offers convenience functions, `New` and `NewUnstarted`, to create an `otlpmetric.Exporter`.(#1991) -- Added `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` exporter. (#2005) -- Added `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` exporter. (#2005) -- Added a `TracerProvider()` method to the `"go.opentelemetry.io/otel/trace".Span` interface. This can be used to obtain a `TracerProvider` from a given span that utilizes the same trace processing pipeline. (#2009) - -### Changed - -- Make `NewSplitDriver` from `go.opentelemetry.io/otel/exporters/otlp` take variadic arguments instead of a `SplitConfig` item. - `NewSplitDriver` now automatically implements an internal `noopDriver` for `SplitConfig` fields that are not initialized. (#1798) -- `resource.New()` now creates a Resource without builtin detectors. Previous behavior is now achieved by using `WithBuiltinDetectors` Option. (#1810) -- Move the `Event` type from the `go.opentelemetry.io/otel` package to the `go.opentelemetry.io/otel/sdk/trace` package. (#1846) -- CI builds validate against last two versions of Go, dropping 1.14 and adding 1.16. (#1865) -- BatchSpanProcessor now report export failures when calling `ForceFlush()` method. (#1860) -- `Set.Encoded(Encoder)` no longer caches the result of an encoding. (#1855) -- Renamed `CloudZoneKey` to `CloudAvailabilityZoneKey` in Resource semantic conventions according to spec. (#1871) -- The `StatusCode` and `StatusMessage` methods of the `ReadOnlySpan` interface and the `Span` produced by the `go.opentelemetry.io/otel/sdk/trace` package have been replaced with a single `Status` method. - This method returns the status of a span using the new `Status` type. (#1874) -- Updated `ExportSpans` method of the`SpanExporter` interface type to accept `ReadOnlySpan`s instead of the removed `SpanSnapshot`. - This brings the export interface into compliance with the specification in that it now accepts an explicitly immutable type instead of just an implied one. (#1873) -- Unembed `SpanContext` in `Link`. (#1877) -- Generate Semantic conventions from the specification YAML. (#1891) -- Spans created by the global `Tracer` obtained from `go.opentelemetry.io/otel`, prior to a functioning `TracerProvider` being set, now propagate the span context from their parent if one exists. (#1901) -- The `"go.opentelemetry.io/otel".Tracer` function now accepts tracer options. (#1902) -- Move the `go.opentelemetry.io/otel/unit` package to `go.opentelemetry.io/otel/metric/unit`. (#1903) -- Changed `go.opentelemetry.io/otel/trace.TracerConfig` to conform to the [Contributing guidelines](CONTRIBUTING.md#config.) (#1921) -- Changed `go.opentelemetry.io/otel/trace.SpanConfig` to conform to the [Contributing guidelines](CONTRIBUTING.md#config). (#1921) -- Changed `span.End()` now only accepts Options that are allowed at `End()`. (#1921) -- Changed `go.opentelemetry.io/otel/metric.InstrumentConfig` to conform to the [Contributing guidelines](CONTRIBUTING.md#config). (#1921) -- Changed `go.opentelemetry.io/otel/metric.MeterConfig` to conform to the [Contributing guidelines](CONTRIBUTING.md#config). (#1921) -- Refactored option types according to the contribution style guide. (#1882) -- Move the `go.opentelemetry.io/otel/trace.TraceStateFromKeyValues` function to the `go.opentelemetry.io/otel/oteltest` package. - This function is preserved for testing purposes where it may be useful to create a `TraceState` from `attribute.KeyValue`s, but it is not intended for production use. - The new `ParseTraceState` function should be used to create a `TraceState`. (#1931) -- Updated `MarshalJSON` method of the `go.opentelemetry.io/otel/trace.TraceState` type to marshal the type into the string representation of the `TraceState`. (#1931) -- The `TraceState.Delete` method from the `go.opentelemetry.io/otel/trace` package no longer returns an error in addition to a `TraceState`. (#1931) -- Updated `Get` method of the `TraceState` type from the `go.opentelemetry.io/otel/trace` package to accept a `string` instead of an `attribute.Key` type. (#1931) -- Updated `Insert` method of the `TraceState` type from the `go.opentelemetry.io/otel/trace` package to accept a pair of `string`s instead of an `attribute.KeyValue` type. (#1931) -- Updated `Delete` method of the `TraceState` type from the `go.opentelemetry.io/otel/trace` package to accept a `string` instead of an `attribute.Key` type. (#1931) -- Renamed `NewExporter` to `New` in the `go.opentelemetry.io/otel/exporters/stdout` package. (#1985) -- Renamed `NewExporter` to `New` in the `go.opentelemetry.io/otel/exporters/metric/prometheus` package. (#1985) -- Renamed `NewExporter` to `New` in the `go.opentelemetry.io/otel/exporters/trace/jaeger` package. (#1985) -- Renamed `NewExporter` to `New` in the `go.opentelemetry.io/otel/exporters/trace/zipkin` package. (#1985) -- Renamed `NewExporter` to `New` in the `go.opentelemetry.io/otel/exporters/otlp` package. (#1985) -- Renamed `NewUnstartedExporter` to `NewUnstarted` in the `go.opentelemetry.io/otel/exporters/otlp` package. (#1985) -- The `go.opentelemetry.io/otel/semconv` package has been moved to `go.opentelemetry.io/otel/semconv/v1.4.0` to allow for multiple [telemetry schema](https://github.com/open-telemetry/oteps/blob/main/text/0152-telemetry-schemas.md) versions to be used concurrently. (#1987) -- Metrics test helpers in `go.opentelemetry.io/otel/oteltest` have been moved to `go.opentelemetry.io/otel/metric/metrictest`. (#1988) - -### Deprecated - -- The `go.opentelemetry.io/otel/exporters/metric/prometheus` is deprecated, use `go.opentelemetry.io/otel/exporters/prometheus` instead. (#1993) -- The `go.opentelemetry.io/otel/exporters/trace/jaeger` is deprecated, use `go.opentelemetry.io/otel/exporters/jaeger` instead. (#1993) -- The `go.opentelemetry.io/otel/exporters/trace/zipkin` is deprecated, use `go.opentelemetry.io/otel/exporters/zipkin` instead. (#1993) - -### Removed - -- Removed `resource.WithoutBuiltin()`. Use `resource.New()`. (#1810) -- Unexported types `resource.FromEnv`, `resource.Host`, and `resource.TelemetrySDK`, Use the corresponding `With*()` to use individually. (#1810) -- Removed the `Tracer` and `IsRecording` method from the `ReadOnlySpan` in the `go.opentelemetry.io/otel/sdk/trace`. - The `Tracer` method is not a required to be included in this interface and given the mutable nature of the tracer that is associated with a span, this method is not appropriate. - The `IsRecording` method returns if the span is recording or not. - A read-only span value does not need to know if updates to it will be recorded or not. - By definition, it cannot be updated so there is no point in communicating if an update is recorded. (#1873) -- Removed the `SpanSnapshot` type from the `go.opentelemetry.io/otel/sdk/trace` package. - The use of this type has been replaced with the use of the explicitly immutable `ReadOnlySpan` type. - When a concrete representation of a read-only span is needed for testing, the newly added `SpanStub` in the `go.opentelemetry.io/otel/sdk/trace/tracetest` package should be used. (#1873) -- Removed the `Tracer` method from the `Span` interface in the `go.opentelemetry.io/otel/trace` package. - Using the same tracer that created a span introduces the error where an instrumentation library's `Tracer` is used by other code instead of their own. - The `"go.opentelemetry.io/otel".Tracer` function or a `TracerProvider` should be used to acquire a library specific `Tracer` instead. (#1900) - - The `TracerProvider()` method on the `Span` interface may also be used to obtain a `TracerProvider` using the same trace processing pipeline. (#2009) -- The `http.url` attribute generated by `HTTPClientAttributesFromHTTPRequest` will no longer include username or password information. (#1919) -- Removed `IsEmpty` method of the `TraceState` type in the `go.opentelemetry.io/otel/trace` package in favor of using the added `TraceState.Len` method. (#1931) -- Removed `Set`, `Value`, `ContextWithValue`, `ContextWithoutValue`, and `ContextWithEmpty` functions in the `go.opentelemetry.io/otel/baggage` package. - Handling of baggage is now done using the added `Baggage` type and related context functions (`ContextWithBaggage`, `ContextWithoutBaggage`, and `FromContext`) in that package. (#1967) -- The `InstallNewPipeline` and `NewExportPipeline` creation functions in all the exporters (prometheus, otlp, stdout, jaeger, and zipkin) have been removed. - These functions were deemed premature attempts to provide convenience that did not achieve this aim. (#1985) -- The `go.opentelemetry.io/otel/exporters/otlp` exporter has been removed. Use `go.opentelemetry.io/otel/exporters/otlp/otlptrace` instead. (#1990) -- The `go.opentelemetry.io/otel/exporters/stdout` exporter has been removed. Use `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` or `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` instead. (#2005) - -### Fixed - -- Only report errors from the `"go.opentelemetry.io/otel/sdk/resource".Environment` function when they are not `nil`. (#1850, #1851) -- The `Shutdown` method of the simple `SpanProcessor` in the `go.opentelemetry.io/otel/sdk/trace` package now honors the context deadline or cancellation. (#1616, #1856) -- BatchSpanProcessor now drops span batches that failed to be exported. (#1860) -- Use `http://localhost:14268/api/traces` as default Jaeger collector endpoint instead of `http://localhost:14250`. (#1898) -- Allow trailing and leading whitespace in the parsing of a `tracestate` header. (#1931) -- Add logic to determine if the channel is closed to fix Jaeger exporter test panic with close closed channel. (#1870, #1973) -- Avoid transport security when OTLP endpoint is a Unix socket. (#2001) - -### Security - -## [0.20.0] - 2021-04-23 - -### Added - -- The OTLP exporter now has two new convenience functions, `NewExportPipeline` and `InstallNewPipeline`, setup and install the exporter in tracing and metrics pipelines. (#1373) -- Adds semantic conventions for exceptions. (#1492) -- Added Jaeger Environment variables: `OTEL_EXPORTER_JAEGER_AGENT_HOST`, `OTEL_EXPORTER_JAEGER_AGENT_PORT` - These environment variables can be used to override Jaeger agent hostname and port (#1752) -- Option `ExportTimeout` was added to batch span processor. (#1755) -- `trace.TraceFlags` is now a defined type over `byte` and `WithSampled(bool) TraceFlags` and `IsSampled() bool` methods have been added to it. (#1770) -- The `Event` and `Link` struct types from the `go.opentelemetry.io/otel` package now include a `DroppedAttributeCount` field to record the number of attributes that were not recorded due to configured limits being reached. (#1771) -- The Jaeger exporter now reports dropped attributes for a Span event in the exported log. (#1771) -- Adds test to check BatchSpanProcessor ignores `OnEnd` and `ForceFlush` post `Shutdown`. (#1772) -- Extract resource attributes from the `OTEL_RESOURCE_ATTRIBUTES` environment variable and merge them with the `resource.Default` resource as well as resources provided to the `TracerProvider` and metric `Controller`. (#1785) -- Added `WithOSType` resource configuration option to set OS (Operating System) type resource attribute (`os.type`). (#1788) -- Added `WithProcess*` resource configuration options to set Process resource attributes. (#1788) - - `process.pid` - - `process.executable.name` - - `process.executable.path` - - `process.command_args` - - `process.owner` - - `process.runtime.name` - - `process.runtime.version` - - `process.runtime.description` -- Adds `k8s.node.name` and `k8s.node.uid` attribute keys to the `semconv` package. (#1789) -- Added support for configuring OTLP/HTTP and OTLP/gRPC Endpoints, TLS Certificates, Headers, Compression and Timeout via Environment Variables. (#1758, #1769 and #1811) - - `OTEL_EXPORTER_OTLP_ENDPOINT` - - `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` - - `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT` - - `OTEL_EXPORTER_OTLP_HEADERS` - - `OTEL_EXPORTER_OTLP_TRACES_HEADERS` - - `OTEL_EXPORTER_OTLP_METRICS_HEADERS` - - `OTEL_EXPORTER_OTLP_COMPRESSION` - - `OTEL_EXPORTER_OTLP_TRACES_COMPRESSION` - - `OTEL_EXPORTER_OTLP_METRICS_COMPRESSION` - - `OTEL_EXPORTER_OTLP_TIMEOUT` - - `OTEL_EXPORTER_OTLP_TRACES_TIMEOUT` - - `OTEL_EXPORTER_OTLP_METRICS_TIMEOUT` - - `OTEL_EXPORTER_OTLP_CERTIFICATE` - - `OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE` - - `OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE` -- Adds `otlpgrpc.WithTimeout` option for configuring timeout to the otlp/gRPC exporter. (#1821) -- Adds `jaeger.WithMaxPacketSize` option for configuring maximum UDP packet size used when connecting to the Jaeger agent. (#1853) - -### Fixed - -- The `Span.IsRecording` implementation from `go.opentelemetry.io/otel/sdk/trace` always returns false when not being sampled. (#1750) -- The Jaeger exporter now correctly sets tags for the Span status code and message. - This means it uses the correct tag keys (`"otel.status_code"`, `"otel.status_description"`) and does not set the status message as a tag unless it is set on the span. (#1761) -- The Jaeger exporter now correctly records Span event's names using the `"event"` key for a tag. - Additionally, this tag is overridden, as specified in the OTel specification, if the event contains an attribute with that key. (#1768) -- Zipkin Exporter: Ensure mapping between OTel and Zipkin span data complies with the specification. (#1688) -- Fixed typo for default service name in Jaeger Exporter. (#1797) -- Fix flaky OTLP for the reconnnection of the client connection. (#1527, #1814) -- Fix Jaeger exporter dropping of span batches that exceed the UDP packet size limit. - Instead, the exporter now splits the batch into smaller sendable batches. (#1828) - -### Changed - -- Span `RecordError` now records an `exception` event to comply with the semantic convention specification. (#1492) -- Jaeger exporter was updated to use thrift v0.14.1. (#1712) -- Migrate from using internally built and maintained version of the OTLP to the one hosted at `go.opentelemetry.io/proto/otlp`. (#1713) -- Migrate from using `github.com/gogo/protobuf` to `google.golang.org/protobuf` to match `go.opentelemetry.io/proto/otlp`. (#1713) -- The storage of a local or remote Span in a `context.Context` using its SpanContext is unified to store just the current Span. - The Span's SpanContext can now self-identify as being remote or not. - This means that `"go.opentelemetry.io/otel/trace".ContextWithRemoteSpanContext` will now overwrite any existing current Span, not just existing remote Spans, and make it the current Span in a `context.Context`. (#1731) -- Improve OTLP/gRPC exporter connection errors. (#1737) -- Information about a parent span context in a `"go.opentelemetry.io/otel/export/trace".SpanSnapshot` is unified in a new `Parent` field. - The existing `ParentSpanID` and `HasRemoteParent` fields are removed in favor of this. (#1748) -- The `ParentContext` field of the `"go.opentelemetry.io/otel/sdk/trace".SamplingParameters` is updated to hold a `context.Context` containing the parent span. - This changes it to make `SamplingParameters` conform with the OpenTelemetry specification. (#1749) -- Updated Jaeger Environment Variables: `JAEGER_ENDPOINT`, `JAEGER_USER`, `JAEGER_PASSWORD` - to `OTEL_EXPORTER_JAEGER_ENDPOINT`, `OTEL_EXPORTER_JAEGER_USER`, `OTEL_EXPORTER_JAEGER_PASSWORD` in compliance with OTel specification. (#1752) -- Modify `BatchSpanProcessor.ForceFlush` to abort after timeout/cancellation. (#1757) -- The `DroppedAttributeCount` field of the `Span` in the `go.opentelemetry.io/otel` package now only represents the number of attributes dropped for the span itself. - It no longer is a conglomerate of itself, events, and link attributes that have been dropped. (#1771) -- Make `ExportSpans` in Jaeger Exporter honor context deadline. (#1773) -- Modify Zipkin Exporter default service name, use default resource's serviceName instead of empty. (#1777) -- The `go.opentelemetry.io/otel/sdk/export/trace` package is merged into the `go.opentelemetry.io/otel/sdk/trace` package. (#1778) -- The prometheus.InstallNewPipeline example is moved from comment to example test (#1796) -- The convenience functions for the stdout exporter have been updated to return the `TracerProvider` implementation and enable the shutdown of the exporter. (#1800) -- Replace the flush function returned from the Jaeger exporter's convenience creation functions (`InstallNewPipeline` and `NewExportPipeline`) with the `TracerProvider` implementation they create. - This enables the caller to shutdown and flush using the related `TracerProvider` methods. (#1822) -- Updated the Jaeger exporter to have a default endpoint, `http://localhost:14250`, for the collector. (#1824) -- Changed the function `WithCollectorEndpoint` in the Jaeger exporter to no longer accept an endpoint as an argument. - The endpoint can be passed with the `CollectorEndpointOption` using the `WithEndpoint` function or by setting the `OTEL_EXPORTER_JAEGER_ENDPOINT` environment variable value appropriately. (#1824) -- The Jaeger exporter no longer batches exported spans itself, instead it relies on the SDK's `BatchSpanProcessor` for this functionality. (#1830) -- The Jaeger exporter creation functions (`NewRawExporter`, `NewExportPipeline`, and `InstallNewPipeline`) no longer accept the removed `Option` type as a variadic argument. (#1830) - -### Removed - -- Removed Jaeger Environment variables: `JAEGER_SERVICE_NAME`, `JAEGER_DISABLED`, `JAEGER_TAGS` - These environment variables will no longer be used to override values of the Jaeger exporter (#1752) -- No longer set the links for a `Span` in `go.opentelemetry.io/otel/sdk/trace` that is configured to be a new root. - This is unspecified behavior that the OpenTelemetry community plans to standardize in the future. - To prevent backwards incompatible changes when it is specified, these links are removed. (#1726) -- Setting error status while recording error with Span from oteltest package. (#1729) -- The concept of a remote and local Span stored in a context is unified to just the current Span. - Because of this `"go.opentelemetry.io/otel/trace".RemoteSpanContextFromContext` is removed as it is no longer needed. - Instead, `"go.opentelemetry.io/otel/trace".SpanContextFromContex` can be used to return the current Span. - If needed, that Span's `SpanContext.IsRemote()` can then be used to determine if it is remote or not. (#1731) -- The `HasRemoteParent` field of the `"go.opentelemetry.io/otel/sdk/trace".SamplingParameters` is removed. - This field is redundant to the information returned from the `Remote` method of the `SpanContext` held in the `ParentContext` field. (#1749) -- The `trace.FlagsDebug` and `trace.FlagsDeferred` constants have been removed and will be localized to the B3 propagator. (#1770) -- Remove `Process` configuration, `WithProcessFromEnv` and `ProcessFromEnv`, and type from the Jaeger exporter package. - The information that could be configured in the `Process` struct should be configured in a `Resource` instead. (#1776, #1804) -- Remove the `WithDisabled` option from the Jaeger exporter. - To disable the exporter unregister it from the `TracerProvider` or use a no-operation `TracerProvider`. (#1806) -- Removed the functions `CollectorEndpointFromEnv` and `WithCollectorEndpointOptionFromEnv` from the Jaeger exporter. - These functions for retrieving specific environment variable values are redundant of other internal functions and - are not intended for end user use. (#1824) -- Removed the Jaeger exporter `WithSDKOptions` `Option`. - This option was used to set SDK options for the exporter creation convenience functions. - These functions are provided as a way to easily setup or install the exporter with what are deemed reasonable SDK settings for common use cases. - If the SDK needs to be configured differently, the `NewRawExporter` function and direct setup of the SDK with the desired settings should be used. (#1825) -- The `WithBufferMaxCount` and `WithBatchMaxCount` `Option`s from the Jaeger exporter are removed. - The exporter no longer batches exports, instead relying on the SDK's `BatchSpanProcessor` for this functionality. (#1830) -- The Jaeger exporter `Option` type is removed. - The type is no longer used by the exporter to configure anything. - All the previous configurations these options provided were duplicates of SDK configuration. - They have been removed in favor of using the SDK configuration and focuses the exporter configuration to be only about the endpoints it will send telemetry to. (#1830) - -## [0.19.0] - 2021-03-18 - -### Added - -- Added `Marshaler` config option to `otlphttp` to enable otlp over json or protobufs. (#1586) -- A `ForceFlush` method to the `"go.opentelemetry.io/otel/sdk/trace".TracerProvider` to flush all registered `SpanProcessor`s. (#1608) -- Added `WithSampler` and `WithSpanLimits` to tracer provider. (#1633, #1702) -- `"go.opentelemetry.io/otel/trace".SpanContext` now has a `remote` property, and `IsRemote()` predicate, that is true when the `SpanContext` has been extracted from remote context data. (#1701) -- A `Valid` method to the `"go.opentelemetry.io/otel/attribute".KeyValue` type. (#1703) - -### Changed - -- `trace.SpanContext` is now immutable and has no exported fields. (#1573) - - `trace.NewSpanContext()` can be used in conjunction with the `trace.SpanContextConfig` struct to initialize a new `SpanContext` where all values are known. -- Update the `ForceFlush` method signature to the `"go.opentelemetry.io/otel/sdk/trace".SpanProcessor` to accept a `context.Context` and return an error. (#1608) -- Update the `Shutdown` method to the `"go.opentelemetry.io/otel/sdk/trace".TracerProvider` return an error on shutdown failure. (#1608) -- The SimpleSpanProcessor will now shut down the enclosed `SpanExporter` and gracefully ignore subsequent calls to `OnEnd` after `Shutdown` is called. (#1612) -- `"go.opentelemetry.io/sdk/metric/controller.basic".WithPusher` is replaced with `WithExporter` to provide consistent naming across project. (#1656) -- Added non-empty string check for trace `Attribute` keys. (#1659) -- Add `description` to SpanStatus only when `StatusCode` is set to error. (#1662) -- Jaeger exporter falls back to `resource.Default`'s `service.name` if the exported Span does not have one. (#1673) -- Jaeger exporter populates Jaeger's Span Process from Resource. (#1673) -- Renamed the `LabelSet` method of `"go.opentelemetry.io/otel/sdk/resource".Resource` to `Set`. (#1692) -- Changed `WithSDK` to `WithSDKOptions` to accept variadic arguments of `TracerProviderOption` type in `go.opentelemetry.io/otel/exporters/trace/jaeger` package. (#1693) -- Changed `WithSDK` to `WithSDKOptions` to accept variadic arguments of `TracerProviderOption` type in `go.opentelemetry.io/otel/exporters/trace/zipkin` package. (#1693) - -### Removed - -- Removed `serviceName` parameter from Zipkin exporter and uses resource instead. (#1549) -- Removed `WithConfig` from tracer provider to avoid overriding configuration. (#1633) -- Removed the exported `SimpleSpanProcessor` and `BatchSpanProcessor` structs. - These are now returned as a SpanProcessor interface from their respective constructors. (#1638) -- Removed `WithRecord()` from `trace.SpanOption` when creating a span. (#1660) -- Removed setting status to `Error` while recording an error as a span event in `RecordError`. (#1663) -- Removed `jaeger.WithProcess` configuration option. (#1673) -- Removed `ApplyConfig` method from `"go.opentelemetry.io/otel/sdk/trace".TracerProvider` and the now unneeded `Config` struct. (#1693) - -### Fixed - -- Jaeger Exporter: Ensure mapping between OTEL and Jaeger span data complies with the specification. (#1626) -- `SamplingResult.TraceState` is correctly propagated to a newly created span's `SpanContext`. (#1655) -- The `otel-collector` example now correctly flushes metric events prior to shutting down the exporter. (#1678) -- Do not set span status message in `SpanStatusFromHTTPStatusCode` if it can be inferred from `http.status_code`. (#1681) -- Synchronization issues in global trace delegate implementation. (#1686) -- Reduced excess memory usage by global `TracerProvider`. (#1687) - -## [0.18.0] - 2021-03-03 - -### Added - -- Added `resource.Default()` for use with meter and tracer providers. (#1507) -- `AttributePerEventCountLimit` and `AttributePerLinkCountLimit` for `SpanLimits`. (#1535) -- Added `Keys()` method to `propagation.TextMapCarrier` and `propagation.HeaderCarrier` to adapt `http.Header` to this interface. (#1544) -- Added `code` attributes to `go.opentelemetry.io/otel/semconv` package. (#1558) -- Compatibility testing suite in the CI system for the following systems. (#1567) - | OS | Go Version | Architecture | - | ------- | ---------- | ------------ | - | Ubuntu | 1.15 | amd64 | - | Ubuntu | 1.14 | amd64 | - | Ubuntu | 1.15 | 386 | - | Ubuntu | 1.14 | 386 | - | MacOS | 1.15 | amd64 | - | MacOS | 1.14 | amd64 | - | Windows | 1.15 | amd64 | - | Windows | 1.14 | amd64 | - | Windows | 1.15 | 386 | - | Windows | 1.14 | 386 | - -### Changed - -- Replaced interface `oteltest.SpanRecorder` with its existing implementation - `StandardSpanRecorder`. (#1542) -- Default span limit values to 128. (#1535) -- Rename `MaxEventsPerSpan`, `MaxAttributesPerSpan` and `MaxLinksPerSpan` to `EventCountLimit`, `AttributeCountLimit` and `LinkCountLimit`, and move these fields into `SpanLimits`. (#1535) -- Renamed the `otel/label` package to `otel/attribute`. (#1541) -- Vendor the Jaeger exporter's dependency on Apache Thrift. (#1551) -- Parallelize the CI linting and testing. (#1567) -- Stagger timestamps in exact aggregator tests. (#1569) -- Changed all examples to use `WithBatchTimeout(5 * time.Second)` rather than `WithBatchTimeout(5)`. (#1621) -- Prevent end-users from implementing some interfaces (#1575) - - ``` - "otel/exporters/otlp/otlphttp".Option - "otel/exporters/stdout".Option - "otel/oteltest".Option - "otel/trace".TracerOption - "otel/trace".SpanOption - "otel/trace".EventOption - "otel/trace".LifeCycleOption - "otel/trace".InstrumentationOption - "otel/sdk/resource".Option - "otel/sdk/trace".ParentBasedSamplerOption - "otel/sdk/trace".ReadOnlySpan - "otel/sdk/trace".ReadWriteSpan - ``` - -### Removed - -- Removed attempt to resample spans upon changing the span name with `span.SetName()`. (#1545) -- The `test-benchmark` is no longer a dependency of the `precommit` make target. (#1567) -- Removed the `test-386` make target. - This was replaced with a full compatibility testing suite (i.e. multi OS/arch) in the CI system. (#1567) - -### Fixed - -- The sequential timing check of timestamps in the stdout exporter are now setup explicitly to be sequential (#1571). (#1572) -- Windows build of Jaeger tests now compiles with OS specific functions (#1576). (#1577) -- The sequential timing check of timestamps of go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue are now setup explicitly to be sequential (#1578). (#1579) -- Validate tracestate header keys with vendors according to the W3C TraceContext specification (#1475). (#1581) -- The OTLP exporter includes related labels for translations of a GaugeArray (#1563). (#1570) - -## [0.17.0] - 2021-02-12 - -### Changed - -- Rename project default branch from `master` to `main`. (#1505) -- Reverse order in which `Resource` attributes are merged, per change in spec. (#1501) -- Add tooling to maintain "replace" directives in go.mod files automatically. (#1528) -- Create new modules: otel/metric, otel/trace, otel/oteltest, otel/sdk/export/metric, otel/sdk/metric (#1528) -- Move metric-related public global APIs from otel to otel/metric/global. (#1528) - -## Fixed - -- Fixed otlpgrpc reconnection issue. -- The example code in the README.md of `go.opentelemetry.io/otel/exporters/otlp` is moved to a compiled example test and used the new `WithAddress` instead of `WithEndpoint`. (#1513) -- The otel-collector example now uses the default OTLP receiver port of the collector. - -## [0.16.0] - 2021-01-13 - -### Added - -- Add the `ReadOnlySpan` and `ReadWriteSpan` interfaces to provide better control for accessing span data. (#1360) -- `NewGRPCDriver` function returns a `ProtocolDriver` that maintains a single gRPC connection to the collector. (#1369) -- Added documentation about the project's versioning policy. (#1388) -- Added `NewSplitDriver` for OTLP exporter that allows sending traces and metrics to different endpoints. (#1418) -- Added codeql workflow to GitHub Actions (#1428) -- Added Gosec workflow to GitHub Actions (#1429) -- Add new HTTP driver for OTLP exporter in `exporters/otlp/otlphttp`. Currently it only supports the binary protobuf payloads. (#1420) -- Add an OpenCensus exporter bridge. (#1444) - -### Changed - -- Rename `internal/testing` to `internal/internaltest`. (#1449) -- Rename `export.SpanData` to `export.SpanSnapshot` and use it only for exporting spans. (#1360) -- Store the parent's full `SpanContext` rather than just its span ID in the `span` struct. (#1360) -- Improve span duration accuracy. (#1360) -- Migrated CI/CD from CircleCI to GitHub Actions (#1382) -- Remove duplicate checkout from GitHub Actions workflow (#1407) -- Metric `array` aggregator renamed `exact` to match its `aggregation.Kind` (#1412) -- Metric `exact` aggregator includes per-point timestamps (#1412) -- Metric stdout exporter uses MinMaxSumCount aggregator for ValueRecorder instruments (#1412) -- `NewExporter` from `exporters/otlp` now takes a `ProtocolDriver` as a parameter. (#1369) -- Many OTLP Exporter options became gRPC ProtocolDriver options. (#1369) -- Unify endpoint API that related to OTel exporter. (#1401) -- Optimize metric histogram aggregator to re-use its slice of buckets. (#1435) -- Metric aggregator Count() and histogram Bucket.Counts are consistently `uint64`. (1430) -- Histogram aggregator accepts functional options, uses default boundaries if none given. (#1434) -- `SamplingResult` now passed a `Tracestate` from the parent `SpanContext` (#1432) -- Moved gRPC driver for OTLP exporter to `exporters/otlp/otlpgrpc`. (#1420) -- The `TraceContext` propagator now correctly propagates `TraceState` through the `SpanContext`. (#1447) -- Metric Push and Pull Controller components are combined into a single "basic" Controller: - - `WithExporter()` and `Start()` to configure Push behavior - - `Start()` is optional; use `Collect()` and `ForEach()` for Pull behavior - - `Start()` and `Stop()` accept Context. (#1378) -- The `Event` type is moved from the `otel/sdk/export/trace` package to the `otel/trace` API package. (#1452) - -### Removed - -- Remove `errUninitializedSpan` as its only usage is now obsolete. (#1360) -- Remove Metric export functionality related to quantiles and summary data points: this is not specified (#1412) -- Remove DDSketch metric aggregator; our intention is to re-introduce this as an option of the histogram aggregator after [new OTLP histogram data types](https://github.com/open-telemetry/opentelemetry-proto/pull/226) are released (#1412) - -### Fixed - -- `BatchSpanProcessor.Shutdown()` will now shutdown underlying `export.SpanExporter`. (#1443) - -## [0.15.0] - 2020-12-10 - -### Added - -- The `WithIDGenerator` `TracerProviderOption` is added to the `go.opentelemetry.io/otel/trace` package to configure an `IDGenerator` for the `TracerProvider`. (#1363) - -### Changed - -- The Zipkin exporter now uses the Span status code to determine. (#1328) -- `NewExporter` and `Start` functions in `go.opentelemetry.io/otel/exporters/otlp` now receive `context.Context` as a first parameter. (#1357) -- Move the OpenCensus example into `example` directory. (#1359) -- Moved the SDK's `internal.IDGenerator` interface in to the `sdk/trace` package to enable support for externally-defined ID generators. (#1363) -- Bump `github.com/google/go-cmp` from 0.5.3 to 0.5.4 (#1374) -- Bump `github.com/golangci/golangci-lint` in `/internal/tools` (#1375) - -### Fixed - -- Metric SDK `SumObserver` and `UpDownSumObserver` instruments correctness fixes. (#1381) - -## [0.14.0] - 2020-11-19 - -### Added - -- An `EventOption` and the related `NewEventConfig` function are added to the `go.opentelemetry.io/otel` package to configure Span events. (#1254) -- A `TextMapPropagator` and associated `TextMapCarrier` are added to the `go.opentelemetry.io/otel/oteltest` package to test `TextMap` type propagators and their use. (#1259) -- `SpanContextFromContext` returns `SpanContext` from context. (#1255) -- `TraceState` has been added to `SpanContext`. (#1340) -- `DeploymentEnvironmentKey` added to `go.opentelemetry.io/otel/semconv` package. (#1323) -- Add an OpenCensus to OpenTelemetry tracing bridge. (#1305) -- Add a parent context argument to `SpanProcessor.OnStart` to follow the specification. (#1333) -- Add missing tests for `sdk/trace/attributes_map.go`. (#1337) - -### Changed - -- Move the `go.opentelemetry.io/otel/api/trace` package into `go.opentelemetry.io/otel/trace` with the following changes. (#1229) (#1307) - - `ID` has been renamed to `TraceID`. - - `IDFromHex` has been renamed to `TraceIDFromHex`. - - `EmptySpanContext` is removed. -- Move the `go.opentelemetry.io/otel/api/trace/tracetest` package into `go.opentelemetry.io/otel/oteltest`. (#1229) -- OTLP Exporter updates: - - supports OTLP v0.6.0 (#1230, #1354) - - supports configurable aggregation temporality (default: Cumulative, optional: Stateless). (#1296) -- The Sampler is now called on local child spans. (#1233) -- The `Kind` type from the `go.opentelemetry.io/otel/api/metric` package was renamed to `InstrumentKind` to more specifically describe what it is and avoid semantic ambiguity. (#1240) -- The `MetricKind` method of the `Descriptor` type in the `go.opentelemetry.io/otel/api/metric` package was renamed to `Descriptor.InstrumentKind`. - This matches the returned type and fixes misuse of the term metric. (#1240) -- Move test harness from the `go.opentelemetry.io/otel/api/apitest` package into `go.opentelemetry.io/otel/oteltest`. (#1241) -- Move the `go.opentelemetry.io/otel/api/metric/metrictest` package into `go.opentelemetry.io/oteltest` as part of #964. (#1252) -- Move the `go.opentelemetry.io/otel/api/metric` package into `go.opentelemetry.io/otel/metric` as part of #1303. (#1321) -- Move the `go.opentelemetry.io/otel/api/metric/registry` package into `go.opentelemetry.io/otel/metric/registry` as a part of #1303. (#1316) -- Move the `Number` type (together with related functions) from `go.opentelemetry.io/otel/api/metric` package into `go.opentelemetry.io/otel/metric/number` as a part of #1303. (#1316) -- The function signature of the Span `AddEvent` method in `go.opentelemetry.io/otel` is updated to no longer take an unused context and instead take a required name and a variable number of `EventOption`s. (#1254) -- The function signature of the Span `RecordError` method in `go.opentelemetry.io/otel` is updated to no longer take an unused context and instead take a required error value and a variable number of `EventOption`s. (#1254) -- Move the `go.opentelemetry.io/otel/api/global` package to `go.opentelemetry.io/otel`. (#1262) (#1330) -- Move the `Version` function from `go.opentelemetry.io/otel/sdk` to `go.opentelemetry.io/otel`. (#1330) -- Rename correlation context header from `"otcorrelations"` to `"baggage"` to match the OpenTelemetry specification. (#1267) -- Fix `Code.UnmarshalJSON` to work with valid JSON only. (#1276) -- The `resource.New()` method changes signature to support builtin attributes and functional options, including `telemetry.sdk.*` and - `host.name` semantic conventions; the former method is renamed `resource.NewWithAttributes`. (#1235) -- The Prometheus exporter now exports non-monotonic counters (i.e. `UpDownCounter`s) as gauges. (#1210) -- Correct the `Span.End` method documentation in the `otel` API to state updates are not allowed on a span after it has ended. (#1310) -- Updated span collection limits for attribute, event and link counts to 1000 (#1318) -- Renamed `semconv.HTTPUrlKey` to `semconv.HTTPURLKey`. (#1338) - -### Removed - -- The `ErrInvalidHexID`, `ErrInvalidTraceIDLength`, `ErrInvalidSpanIDLength`, `ErrInvalidSpanIDLength`, or `ErrNilSpanID` from the `go.opentelemetry.io/otel` package are unexported now. (#1243) -- The `AddEventWithTimestamp` method on the `Span` interface in `go.opentelemetry.io/otel` is removed due to its redundancy. - It is replaced by using the `AddEvent` method with a `WithTimestamp` option. (#1254) -- The `MockSpan` and `MockTracer` types are removed from `go.opentelemetry.io/otel/oteltest`. - `Tracer` and `Span` from the same module should be used in their place instead. (#1306) -- `WorkerCount` option is removed from `go.opentelemetry.io/otel/exporters/otlp`. (#1350) -- Remove the following labels types: INT32, UINT32, UINT64 and FLOAT32. (#1314) - -### Fixed - -- Rename `MergeItererator` to `MergeIterator` in the `go.opentelemetry.io/otel/label` package. (#1244) -- The `go.opentelemetry.io/otel/api/global` packages global TextMapPropagator now delegates functionality to a globally set delegate for all previously returned propagators. (#1258) -- Fix condition in `label.Any`. (#1299) -- Fix global `TracerProvider` to pass options to its configured provider. (#1329) -- Fix missing handler for `ExactKind` aggregator in OTLP metrics transformer (#1309) - -## [0.13.0] - 2020-10-08 - -### Added - -- OTLP Metric exporter supports Histogram aggregation. (#1209) -- The `Code` struct from the `go.opentelemetry.io/otel/codes` package now supports JSON marshaling and unmarshaling as well as implements the `Stringer` interface. (#1214) -- A Baggage API to implement the OpenTelemetry specification. (#1217) -- Add Shutdown method to sdk/trace/provider, shutdown processors in the order they were registered. (#1227) - -### Changed - -- Set default propagator to no-op propagator. (#1184) -- The `HTTPSupplier`, `HTTPExtractor`, `HTTPInjector`, and `HTTPPropagator` from the `go.opentelemetry.io/otel/api/propagation` package were replaced with unified `TextMapCarrier` and `TextMapPropagator` in the `go.opentelemetry.io/otel/propagation` package. (#1212) (#1325) -- The `New` function from the `go.opentelemetry.io/otel/api/propagation` package was replaced with `NewCompositeTextMapPropagator` in the `go.opentelemetry.io/otel` package. (#1212) -- The status codes of the `go.opentelemetry.io/otel/codes` package have been updated to match the latest OpenTelemetry specification. - They now are `Unset`, `Error`, and `Ok`. - They no longer track the gRPC codes. (#1214) -- The `StatusCode` field of the `SpanData` struct in the `go.opentelemetry.io/otel/sdk/export/trace` package now uses the codes package from this package instead of the gRPC project. (#1214) -- Move the `go.opentelemetry.io/otel/api/baggage` package into `go.opentelemetry.io/otel/baggage`. (#1217) (#1325) -- A `Shutdown` method of `SpanProcessor` and all its implementations receives a context and returns an error. (#1264) - -### Fixed - -- Copies of data from arrays and slices passed to `go.opentelemetry.io/otel/label.ArrayValue()` are now used in the returned `Value` instead of using the mutable data itself. (#1226) - -### Removed - -- The `ExtractHTTP` and `InjectHTTP` functions from the `go.opentelemetry.io/otel/api/propagation` package were removed. (#1212) -- The `Propagators` interface from the `go.opentelemetry.io/otel/api/propagation` package was removed to conform to the OpenTelemetry specification. - The explicit `TextMapPropagator` type can be used in its place as this is the `Propagator` type the specification defines. (#1212) -- The `SetAttribute` method of the `Span` from the `go.opentelemetry.io/otel/api/trace` package was removed given its redundancy with the `SetAttributes` method. (#1216) -- The internal implementation of Baggage storage is removed in favor of using the new Baggage API functionality. (#1217) -- Remove duplicate hostname key `HostHostNameKey` in Resource semantic conventions. (#1219) -- Nested array/slice support has been removed. (#1226) - -## [0.12.0] - 2020-09-24 - -### Added - -- A `SpanConfigure` function in `go.opentelemetry.io/otel/api/trace` to create a new `SpanConfig` from `SpanOption`s. (#1108) -- In the `go.opentelemetry.io/otel/api/trace` package, `NewTracerConfig` was added to construct new `TracerConfig`s. - This addition was made to conform with our project option conventions. (#1155) -- Instrumentation library information was added to the Zipkin exporter. (#1119) -- The `SpanProcessor` interface now has a `ForceFlush()` method. (#1166) -- More semantic conventions for k8s as resource attributes. (#1167) - -### Changed - -- Add reconnecting udp connection type to Jaeger exporter. - This change adds a new optional implementation of the udp conn interface used to detect changes to an agent's host dns record. - It then adopts the new destination address to ensure the exporter doesn't get stuck. This change was ported from jaegertracing/jaeger-client-go#520. (#1063) -- Replace `StartOption` and `EndOption` in `go.opentelemetry.io/otel/api/trace` with `SpanOption`. - This change is matched by replacing the `StartConfig` and `EndConfig` with a unified `SpanConfig`. (#1108) -- Replace the `LinkedTo` span option in `go.opentelemetry.io/otel/api/trace` with `WithLinks`. - This is be more consistent with our other option patterns, i.e. passing the item to be configured directly instead of its component parts, and provides a cleaner function signature. (#1108) -- The `go.opentelemetry.io/otel/api/trace` `TracerOption` was changed to an interface to conform to project option conventions. (#1109) -- Move the `B3` and `TraceContext` from within the `go.opentelemetry.io/otel/api/trace` package to their own `go.opentelemetry.io/otel/propagators` package. - This removal of the propagators is reflective of the OpenTelemetry specification for these propagators as well as cleans up the `go.opentelemetry.io/otel/api/trace` API. (#1118) -- Rename Jaeger tags used for instrumentation library information to reflect changes in OpenTelemetry specification. (#1119) -- Rename `ProbabilitySampler` to `TraceIDRatioBased` and change semantics to ignore parent span sampling status. (#1115) -- Move `tools` package under `internal`. (#1141) -- Move `go.opentelemetry.io/otel/api/correlation` package to `go.opentelemetry.io/otel/api/baggage`. (#1142) - The `correlation.CorrelationContext` propagator has been renamed `baggage.Baggage`. Other exported functions and types are unchanged. -- Rename `ParentOrElse` sampler to `ParentBased` and allow setting samplers depending on parent span. (#1153) -- In the `go.opentelemetry.io/otel/api/trace` package, `SpanConfigure` was renamed to `NewSpanConfig`. (#1155) -- Change `dependabot.yml` to add a `Skip Changelog` label to dependabot-sourced PRs. (#1161) -- The [configuration style guide](https://github.com/open-telemetry/opentelemetry-go/blob/master/CONTRIBUTING.md#config) has been updated to - recommend the use of `newConfig()` instead of `configure()`. (#1163) -- The `otlp.Config` type has been unexported and changed to `otlp.config`, along with its initializer. (#1163) -- Ensure exported interface types include parameter names and update the - Style Guide to reflect this styling rule. (#1172) -- Don't consider unset environment variable for resource detection to be an error. (#1170) -- Rename `go.opentelemetry.io/otel/api/metric.ConfigureInstrument` to `NewInstrumentConfig` and - `go.opentelemetry.io/otel/api/metric.ConfigureMeter` to `NewMeterConfig`. -- ValueObserver instruments use LastValue aggregator by default. (#1165) -- OTLP Metric exporter supports LastValue aggregation. (#1165) -- Move the `go.opentelemetry.io/otel/api/unit` package to `go.opentelemetry.io/otel/unit`. (#1185) -- Rename `Provider` to `MeterProvider` in the `go.opentelemetry.io/otel/api/metric` package. (#1190) -- Rename `NoopProvider` to `NoopMeterProvider` in the `go.opentelemetry.io/otel/api/metric` package. (#1190) -- Rename `NewProvider` to `NewMeterProvider` in the `go.opentelemetry.io/otel/api/metric/metrictest` package. (#1190) -- Rename `Provider` to `MeterProvider` in the `go.opentelemetry.io/otel/api/metric/registry` package. (#1190) -- Rename `NewProvider` to `NewMeterProvider` in the `go.opentelemetry.io/otel/api/metri/registryc` package. (#1190) -- Rename `Provider` to `TracerProvider` in the `go.opentelemetry.io/otel/api/trace` package. (#1190) -- Rename `NoopProvider` to `NoopTracerProvider` in the `go.opentelemetry.io/otel/api/trace` package. (#1190) -- Rename `Provider` to `TracerProvider` in the `go.opentelemetry.io/otel/api/trace/tracetest` package. (#1190) -- Rename `NewProvider` to `NewTracerProvider` in the `go.opentelemetry.io/otel/api/trace/tracetest` package. (#1190) -- Rename `WrapperProvider` to `WrapperTracerProvider` in the `go.opentelemetry.io/otel/bridge/opentracing` package. (#1190) -- Rename `NewWrapperProvider` to `NewWrapperTracerProvider` in the `go.opentelemetry.io/otel/bridge/opentracing` package. (#1190) -- Rename `Provider` method of the pull controller to `MeterProvider` in the `go.opentelemetry.io/otel/sdk/metric/controller/pull` package. (#1190) -- Rename `Provider` method of the push controller to `MeterProvider` in the `go.opentelemetry.io/otel/sdk/metric/controller/push` package. (#1190) -- Rename `ProviderOptions` to `TracerProviderConfig` in the `go.opentelemetry.io/otel/sdk/trace` package. (#1190) -- Rename `ProviderOption` to `TracerProviderOption` in the `go.opentelemetry.io/otel/sdk/trace` package. (#1190) -- Rename `Provider` to `TracerProvider` in the `go.opentelemetry.io/otel/sdk/trace` package. (#1190) -- Rename `NewProvider` to `NewTracerProvider` in the `go.opentelemetry.io/otel/sdk/trace` package. (#1190) -- Renamed `SamplingDecision` values to comply with OpenTelemetry specification change. (#1192) -- Renamed Zipkin attribute names from `ot.status_code & ot.status_description` to `otel.status_code & otel.status_description`. (#1201) -- The default SDK now invokes registered `SpanProcessor`s in the order they were registered with the `TracerProvider`. (#1195) -- Add test of spans being processed by the `SpanProcessor`s in the order they were registered. (#1203) - -### Removed - -- Remove the B3 propagator from `go.opentelemetry.io/otel/propagators`. It is now located in the - `go.opentelemetry.io/contrib/propagators/` module. (#1191) -- Remove the semantic convention for HTTP status text, `HTTPStatusTextKey` from package `go.opentelemetry.io/otel/semconv`. (#1194) - -### Fixed - -- Zipkin example no longer mentions `ParentSampler`, corrected to `ParentBased`. (#1171) -- Fix missing shutdown processor in otel-collector example. (#1186) -- Fix missing shutdown processor in basic and namedtracer examples. (#1197) - -## [0.11.0] - 2020-08-24 - -### Added - -- Support for exporting array-valued attributes via OTLP. (#992) -- `Noop` and `InMemory` `SpanBatcher` implementations to help with testing integrations. (#994) -- Support for filtering metric label sets. (#1047) -- A dimensionality-reducing metric Processor. (#1057) -- Integration tests for more OTel Collector Attribute types. (#1062) -- A new `WithSpanProcessor` `ProviderOption` is added to the `go.opentelemetry.io/otel/sdk/trace` package to create a `Provider` and automatically register the `SpanProcessor`. (#1078) - -### Changed - -- Rename `sdk/metric/processor/test` to `sdk/metric/processor/processortest`. (#1049) -- Rename `sdk/metric/controller/test` to `sdk/metric/controller/controllertest`. (#1049) -- Rename `api/testharness` to `api/apitest`. (#1049) -- Rename `api/trace/testtrace` to `api/trace/tracetest`. (#1049) -- Change Metric Processor to merge multiple observations. (#1024) -- The `go.opentelemetry.io/otel/bridge/opentracing` bridge package has been made into its own module. - This removes the package dependencies of this bridge from the rest of the OpenTelemetry based project. (#1038) -- Renamed `go.opentelemetry.io/otel/api/standard` package to `go.opentelemetry.io/otel/semconv` to avoid the ambiguous and generic name `standard` and better describe the package as containing OpenTelemetry semantic conventions. (#1016) -- The environment variable used for resource detection has been changed from `OTEL_RESOURCE_LABELS` to `OTEL_RESOURCE_ATTRIBUTES` (#1042) -- Replace `WithSyncer` with `WithBatcher` in examples. (#1044) -- Replace the `google.golang.org/grpc/codes` dependency in the API with an equivalent `go.opentelemetry.io/otel/codes` package. (#1046) -- Merge the `go.opentelemetry.io/otel/api/label` and `go.opentelemetry.io/otel/api/kv` into the new `go.opentelemetry.io/otel/label` package. (#1060) -- Unify Callback Function Naming. - Rename `*Callback` with `*Func`. (#1061) -- CI builds validate against last two versions of Go, dropping 1.13 and adding 1.15. (#1064) -- The `go.opentelemetry.io/otel/sdk/export/trace` interfaces `SpanSyncer` and `SpanBatcher` have been replaced with a specification compliant `Exporter` interface. - This interface still supports the export of `SpanData`, but only as a slice. - Implementation are also required now to return any error from `ExportSpans` if one occurs as well as implement a `Shutdown` method for exporter clean-up. (#1078) -- The `go.opentelemetry.io/otel/sdk/trace` `NewBatchSpanProcessor` function no longer returns an error. - If a `nil` exporter is passed as an argument to this function, instead of it returning an error, it now returns a `BatchSpanProcessor` that handles the export of `SpanData` by not taking any action. (#1078) -- The `go.opentelemetry.io/otel/sdk/trace` `NewProvider` function to create a `Provider` no longer returns an error, instead only a `*Provider`. - This change is related to `NewBatchSpanProcessor` not returning an error which was the only error this function would return. (#1078) - -### Removed - -- Duplicate, unused API sampler interface. (#999) - Use the [`Sampler` interface](https://github.com/open-telemetry/opentelemetry-go/blob/v0.11.0/sdk/trace/sampling.go) provided by the SDK instead. -- The `grpctrace` instrumentation was moved to the `go.opentelemetry.io/contrib` repository and out of this repository. - This move includes moving the `grpc` example to the `go.opentelemetry.io/contrib` as well. (#1027) -- The `WithSpan` method of the `Tracer` interface. - The functionality this method provided was limited compared to what a user can provide themselves. - It was removed with the understanding that if there is sufficient user need it can be added back based on actual user usage. (#1043) -- The `RegisterSpanProcessor` and `UnregisterSpanProcessor` functions. - These were holdovers from an approach prior to the TracerProvider design. They were not used anymore. (#1077) -- The `oterror` package. (#1026) -- The `othttp` and `httptrace` instrumentations were moved to `go.opentelemetry.io/contrib`. (#1032) - -### Fixed - -- The `semconv.HTTPServerMetricAttributesFromHTTPRequest()` function no longer generates the high-cardinality `http.request.content.length` label. (#1031) -- Correct instrumentation version tag in Jaeger exporter. (#1037) -- The SDK span will now set an error event if the `End` method is called during a panic (i.e. it was deferred). (#1043) -- Move internally generated protobuf code from the `go.opentelemetry.io/otel` to the OTLP exporter to reduce dependency overhead. (#1050) -- The `otel-collector` example referenced outdated collector processors. (#1006) - -## [0.10.0] - 2020-07-29 - -This release migrates the default OpenTelemetry SDK into its own Go module, decoupling the SDK from the API and reducing dependencies for instrumentation packages. - -### Added - -- The Zipkin exporter now has `NewExportPipeline` and `InstallNewPipeline` constructor functions to match the common pattern. - These function build a new exporter with default SDK options and register the exporter with the `global` package respectively. (#944) -- Add propagator option for gRPC instrumentation. (#986) -- The `testtrace` package now tracks the `trace.SpanKind` for each span. (#987) - -### Changed - -- Replace the `RegisterGlobal` `Option` in the Jaeger exporter with an `InstallNewPipeline` constructor function. - This matches the other exporter constructor patterns and will register a new exporter after building it with default configuration. (#944) -- The trace (`go.opentelemetry.io/otel/exporters/trace/stdout`) and metric (`go.opentelemetry.io/otel/exporters/metric/stdout`) `stdout` exporters are now merged into a single exporter at `go.opentelemetry.io/otel/exporters/stdout`. - This new exporter was made into its own Go module to follow the pattern of all exporters and decouple it from the `go.opentelemetry.io/otel` module. (#956, #963) -- Move the `go.opentelemetry.io/otel/exporters/test` test package to `go.opentelemetry.io/otel/sdk/export/metric/metrictest`. (#962) -- The `go.opentelemetry.io/otel/api/kv/value` package was merged into the parent `go.opentelemetry.io/otel/api/kv` package. (#968) - - `value.Bool` was replaced with `kv.BoolValue`. - - `value.Int64` was replaced with `kv.Int64Value`. - - `value.Uint64` was replaced with `kv.Uint64Value`. - - `value.Float64` was replaced with `kv.Float64Value`. - - `value.Int32` was replaced with `kv.Int32Value`. - - `value.Uint32` was replaced with `kv.Uint32Value`. - - `value.Float32` was replaced with `kv.Float32Value`. - - `value.String` was replaced with `kv.StringValue`. - - `value.Int` was replaced with `kv.IntValue`. - - `value.Uint` was replaced with `kv.UintValue`. - - `value.Array` was replaced with `kv.ArrayValue`. -- Rename `Infer` to `Any` in the `go.opentelemetry.io/otel/api/kv` package. (#972) -- Change `othttp` to use the `httpsnoop` package to wrap the `ResponseWriter` so that optional interfaces (`http.Hijacker`, `http.Flusher`, etc.) that are implemented by the original `ResponseWriter`are also implemented by the wrapped `ResponseWriter`. (#979) -- Rename `go.opentelemetry.io/otel/sdk/metric/aggregator/test` package to `go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest`. (#980) -- Make the SDK into its own Go module called `go.opentelemetry.io/otel/sdk`. (#985) -- Changed the default trace `Sampler` from `AlwaysOn` to `ParentOrElse(AlwaysOn)`. (#989) - -### Removed - -- The `IndexedAttribute` function from the `go.opentelemetry.io/otel/api/label` package was removed in favor of `IndexedLabel` which it was synonymous with. (#970) - -### Fixed - -- Bump github.com/golangci/golangci-lint from 1.28.3 to 1.29.0 in /tools. (#953) -- Bump github.com/google/go-cmp from 0.5.0 to 0.5.1. (#957) -- Use `global.Handle` for span export errors in the OTLP exporter. (#946) -- Correct Go language formatting in the README documentation. (#961) -- Remove default SDK dependencies from the `go.opentelemetry.io/otel/api` package. (#977) -- Remove default SDK dependencies from the `go.opentelemetry.io/otel/instrumentation` package. (#983) -- Move documented examples for `go.opentelemetry.io/otel/instrumentation/grpctrace` interceptors into Go example tests. (#984) - -## [0.9.0] - 2020-07-20 - -### Added - -- A new Resource Detector interface is included to allow resources to be automatically detected and included. (#939) -- A Detector to automatically detect resources from an environment variable. (#939) -- Github action to generate protobuf Go bindings locally in `internal/opentelemetry-proto-gen`. (#938) -- OTLP .proto files from `open-telemetry/opentelemetry-proto` imported as a git submodule under `internal/opentelemetry-proto`. - References to `github.com/open-telemetry/opentelemetry-proto` changed to `go.opentelemetry.io/otel/internal/opentelemetry-proto-gen`. (#942) - -### Changed - -- Non-nil value `struct`s for key-value pairs will be marshalled using JSON rather than `Sprintf`. (#948) - -### Removed - -- Removed dependency on `github.com/open-telemetry/opentelemetry-collector`. (#943) - -## [0.8.0] - 2020-07-09 - -### Added - -- The `B3Encoding` type to represent the B3 encoding(s) the B3 propagator can inject. - A value for HTTP supported encodings (Multiple Header: `MultipleHeader`, Single Header: `SingleHeader`) are included. (#882) -- The `FlagsDeferred` trace flag to indicate if the trace sampling decision has been deferred. (#882) -- The `FlagsDebug` trace flag to indicate if the trace is a debug trace. (#882) -- Add `peer.service` semantic attribute. (#898) -- Add database-specific semantic attributes. (#899) -- Add semantic convention for `faas.coldstart` and `container.id`. (#909) -- Add http content size semantic conventions. (#905) -- Include `http.request_content_length` in HTTP request basic attributes. (#905) -- Add semantic conventions for operating system process resource attribute keys. (#919) -- The Jaeger exporter now has a `WithBatchMaxCount` option to specify the maximum number of spans sent in a batch. (#931) - -### Changed - -- Update `CONTRIBUTING.md` to ask for updates to `CHANGELOG.md` with each pull request. (#879) -- Use lowercase header names for B3 Multiple Headers. (#881) -- The B3 propagator `SingleHeader` field has been replaced with `InjectEncoding`. - This new field can be set to combinations of the `B3Encoding` bitmasks and will inject trace information in these encodings. - If no encoding is set, the propagator will default to `MultipleHeader` encoding. (#882) -- The B3 propagator now extracts from either HTTP encoding of B3 (Single Header or Multiple Header) based on what is contained in the header. - Preference is given to Single Header encoding with Multiple Header being the fallback if Single Header is not found or is invalid. - This behavior change is made to dynamically support all correctly encoded traces received instead of having to guess the expected encoding prior to receiving. (#882) -- Extend semantic conventions for RPC. (#900) -- To match constant naming conventions in the `api/standard` package, the `FaaS*` key names are appended with a suffix of `Key`. (#920) - - `"api/standard".FaaSName` -> `FaaSNameKey` - - `"api/standard".FaaSID` -> `FaaSIDKey` - - `"api/standard".FaaSVersion` -> `FaaSVersionKey` - - `"api/standard".FaaSInstance` -> `FaaSInstanceKey` - -### Removed - -- The `FlagsUnused` trace flag is removed. - The purpose of this flag was to act as the inverse of `FlagsSampled`, the inverse of `FlagsSampled` is used instead. (#882) -- The B3 header constants (`B3SingleHeader`, `B3DebugFlagHeader`, `B3TraceIDHeader`, `B3SpanIDHeader`, `B3SampledHeader`, `B3ParentSpanIDHeader`) are removed. - If B3 header keys are needed [the authoritative OpenZipkin package constants](https://pkg.go.dev/github.com/openzipkin/zipkin-go@v0.2.2/propagation/b3?tab=doc#pkg-constants) should be used instead. (#882) - -### Fixed - -- The B3 Single Header name is now correctly `b3` instead of the previous `X-B3`. (#881) -- The B3 propagator now correctly supports sampling only values (`b3: 0`, `b3: 1`, or `b3: d`) for a Single B3 Header. (#882) -- The B3 propagator now propagates the debug flag. - This removes the behavior of changing the debug flag into a set sampling bit. - Instead, this now follow the B3 specification and omits the `X-B3-Sampling` header. (#882) -- The B3 propagator now tracks "unset" sampling state (meaning "defer the decision") and does not set the `X-B3-Sampling` header when injecting. (#882) -- Bump github.com/itchyny/gojq from 0.10.3 to 0.10.4 in /tools. (#883) -- Bump github.com/opentracing/opentracing-go from v1.1.1-0.20190913142402-a7454ce5950e to v1.2.0. (#885) -- The tracing time conversion for OTLP spans is now correctly set to `UnixNano`. (#896) -- Ensure span status is not set to `Unknown` when no HTTP status code is provided as it is assumed to be `200 OK`. (#908) -- Ensure `httptrace.clientTracer` closes `http.headers` span. (#912) -- Prometheus exporter will not apply stale updates or forget inactive metrics. (#903) -- Add test for api.standard `HTTPClientAttributesFromHTTPRequest`. (#905) -- Bump github.com/golangci/golangci-lint from 1.27.0 to 1.28.1 in /tools. (#901, #913) -- Update otel-colector example to use the v0.5.0 collector. (#915) -- The `grpctrace` instrumentation uses a span name conforming to the OpenTelemetry semantic conventions (does not contain a leading slash (`/`)). (#922) -- The `grpctrace` instrumentation includes an `rpc.method` attribute now set to the gRPC method name. (#900, #922) -- The `grpctrace` instrumentation `rpc.service` attribute now contains the package name if one exists. - This is in accordance with OpenTelemetry semantic conventions. (#922) -- Correlation Context extractor will no longer insert an empty map into the returned context when no valid values are extracted. (#923) -- Bump google.golang.org/api from 0.28.0 to 0.29.0 in /exporters/trace/jaeger. (#925) -- Bump github.com/itchyny/gojq from 0.10.4 to 0.11.0 in /tools. (#926) -- Bump github.com/golangci/golangci-lint from 1.28.1 to 1.28.2 in /tools. (#930) - -## [0.7.0] - 2020-06-26 - -This release implements the v0.5.0 version of the OpenTelemetry specification. - -### Added - -- The othttp instrumentation now includes default metrics. (#861) -- This CHANGELOG file to track all changes in the project going forward. -- Support for array type attributes. (#798) -- Apply transitive dependabot go.mod dependency updates as part of a new automatic Github workflow. (#844) -- Timestamps are now passed to exporters for each export. (#835) -- Add new `Accumulation` type to metric SDK to transport telemetry from `Accumulator`s to `Processor`s. - This replaces the prior `Record` `struct` use for this purpose. (#835) -- New dependabot integration to automate package upgrades. (#814) -- `Meter` and `Tracer` implementations accept instrumentation version version as an optional argument. - This instrumentation version is passed on to exporters. (#811) (#805) (#802) -- The OTLP exporter includes the instrumentation version in telemetry it exports. (#811) -- Environment variables for Jaeger exporter are supported. (#796) -- New `aggregation.Kind` in the export metric API. (#808) -- New example that uses OTLP and the collector. (#790) -- Handle errors in the span `SetName` during span initialization. (#791) -- Default service config to enable retries for retry-able failed requests in the OTLP exporter and an option to override this default. (#777) -- New `go.opentelemetry.io/otel/api/oterror` package to uniformly support error handling and definitions for the project. (#778) -- New `global` default implementation of the `go.opentelemetry.io/otel/api/oterror.Handler` interface to be used to handle errors prior to an user defined `Handler`. - There is also functionality for the user to register their `Handler` as well as a convenience function `Handle` to handle an error with this global `Handler`(#778) -- Options to specify propagators for httptrace and grpctrace instrumentation. (#784) -- The required `application/json` header for the Zipkin exporter is included in all exports. (#774) -- Integrate HTTP semantics helpers from the contrib repository into the `api/standard` package. #769 - -### Changed - -- Rename `Integrator` to `Processor` in the metric SDK. (#863) -- Rename `AggregationSelector` to `AggregatorSelector`. (#859) -- Rename `SynchronizedCopy` to `SynchronizedMove`. (#858) -- Rename `simple` integrator to `basic` integrator. (#857) -- Merge otlp collector examples. (#841) -- Change the metric SDK to support cumulative, delta, and pass-through exporters directly. - With these changes, cumulative and delta specific exporters are able to request the correct kind of aggregation from the SDK. (#840) -- The `Aggregator.Checkpoint` API is renamed to `SynchronizedCopy` and adds an argument, a different `Aggregator` into which the copy is stored. (#812) -- The `export.Aggregator` contract is that `Update()` and `SynchronizedCopy()` are synchronized with each other. - All the aggregation interfaces (`Sum`, `LastValue`, ...) are not meant to be synchronized, as the caller is expected to synchronize aggregators at a higher level after the `Accumulator`. - Some of the `Aggregators` used unnecessary locking and that has been cleaned up. (#812) -- Use of `metric.Number` was replaced by `int64` now that we use `sync.Mutex` in the `MinMaxSumCount` and `Histogram` `Aggregators`. (#812) -- Replace `AlwaysParentSample` with `ParentSample(fallback)` to match the OpenTelemetry v0.5.0 specification. (#810) -- Rename `sdk/export/metric/aggregator` to `sdk/export/metric/aggregation`. #808 -- Send configured headers with every request in the OTLP exporter, instead of just on connection creation. (#806) -- Update error handling for any one off error handlers, replacing, instead, with the `global.Handle` function. (#791) -- Rename `plugin` directory to `instrumentation` to match the OpenTelemetry specification. (#779) -- Makes the argument order to Histogram and DDSketch `New()` consistent. (#781) - -### Removed - -- `Uint64NumberKind` and related functions from the API. (#864) -- Context arguments from `Aggregator.Checkpoint` and `Integrator.Process` as they were unused. (#803) -- `SpanID` is no longer included in parameters for sampling decision to match the OpenTelemetry specification. (#775) - -### Fixed - -- Upgrade OTLP exporter to opentelemetry-proto matching the opentelemetry-collector v0.4.0 release. (#866) -- Allow changes to `go.sum` and `go.mod` when running dependabot tidy-up. (#871) -- Bump github.com/stretchr/testify from 1.4.0 to 1.6.1. (#824) -- Bump github.com/prometheus/client_golang from 1.7.0 to 1.7.1 in /exporters/metric/prometheus. (#867) -- Bump google.golang.org/grpc from 1.29.1 to 1.30.0 in /exporters/trace/jaeger. (#853) -- Bump google.golang.org/grpc from 1.29.1 to 1.30.0 in /exporters/trace/zipkin. (#854) -- Bumps github.com/golang/protobuf from 1.3.2 to 1.4.2 (#848) -- Bump github.com/stretchr/testify from 1.4.0 to 1.6.1 in /exporters/otlp (#817) -- Bump github.com/golangci/golangci-lint from 1.25.1 to 1.27.0 in /tools (#828) -- Bump github.com/prometheus/client_golang from 1.5.0 to 1.7.0 in /exporters/metric/prometheus (#838) -- Bump github.com/stretchr/testify from 1.4.0 to 1.6.1 in /exporters/trace/jaeger (#829) -- Bump github.com/benbjohnson/clock from 1.0.0 to 1.0.3 (#815) -- Bump github.com/stretchr/testify from 1.4.0 to 1.6.1 in /exporters/trace/zipkin (#823) -- Bump github.com/itchyny/gojq from 0.10.1 to 0.10.3 in /tools (#830) -- Bump github.com/stretchr/testify from 1.4.0 to 1.6.1 in /exporters/metric/prometheus (#822) -- Bump google.golang.org/grpc from 1.27.1 to 1.29.1 in /exporters/trace/zipkin (#820) -- Bump google.golang.org/grpc from 1.27.1 to 1.29.1 in /exporters/trace/jaeger (#831) -- Bump github.com/google/go-cmp from 0.4.0 to 0.5.0 (#836) -- Bump github.com/google/go-cmp from 0.4.0 to 0.5.0 in /exporters/trace/jaeger (#837) -- Bump github.com/google/go-cmp from 0.4.0 to 0.5.0 in /exporters/otlp (#839) -- Bump google.golang.org/api from 0.20.0 to 0.28.0 in /exporters/trace/jaeger (#843) -- Set span status from HTTP status code in the othttp instrumentation. (#832) -- Fixed typo in push controller comment. (#834) -- The `Aggregator` testing has been updated and cleaned. (#812) -- `metric.Number(0)` expressions are replaced by `0` where possible. (#812) -- Fixed `global` `handler_test.go` test failure. #804 -- Fixed `BatchSpanProcessor.Shutdown` to wait until all spans are processed. (#766) -- Fixed OTLP example's accidental early close of exporter. (#807) -- Ensure zipkin exporter reads and closes response body. (#788) -- Update instrumentation to use `api/standard` keys instead of custom keys. (#782) -- Clean up tools and RELEASING documentation. (#762) - -## [0.6.0] - 2020-05-21 - -### Added - -- Support for `Resource`s in the prometheus exporter. (#757) -- New pull controller. (#751) -- New `UpDownSumObserver` instrument. (#750) -- OpenTelemetry collector demo. (#711) -- New `SumObserver` instrument. (#747) -- New `UpDownCounter` instrument. (#745) -- New timeout `Option` and configuration function `WithTimeout` to the push controller. (#742) -- New `api/standards` package to implement semantic conventions and standard key-value generation. (#731) - -### Changed - -- Rename `Register*` functions in the metric API to `New*` for all `Observer` instruments. (#761) -- Use `[]float64` for histogram boundaries, not `[]metric.Number`. (#758) -- Change OTLP example to use exporter as a trace `Syncer` instead of as an unneeded `Batcher`. (#756) -- Replace `WithResourceAttributes()` with `WithResource()` in the trace SDK. (#754) -- The prometheus exporter now uses the new pull controller. (#751) -- Rename `ScheduleDelayMillis` to `BatchTimeout` in the trace `BatchSpanProcessor`.(#752) -- Support use of synchronous instruments in asynchronous callbacks (#725) -- Move `Resource` from the `Export` method parameter into the metric export `Record`. (#739) -- Rename `Observer` instrument to `ValueObserver`. (#734) -- The push controller now has a method (`Provider()`) to return a `metric.Provider` instead of the old `Meter` method that acted as a `metric.Provider`. (#738) -- Replace `Measure` instrument by `ValueRecorder` instrument. (#732) -- Rename correlation context header from `"Correlation-Context"` to `"otcorrelations"` to match the OpenTelemetry specification. (#727) - -### Fixed - -- Ensure gRPC `ClientStream` override methods do not panic in grpctrace package. (#755) -- Disable parts of `BatchSpanProcessor` test until a fix is found. (#743) -- Fix `string` case in `kv` `Infer` function. (#746) -- Fix panic in grpctrace client interceptors. (#740) -- Refactor the `api/metrics` push controller and add `CheckpointSet` synchronization. (#737) -- Rewrite span batch process queue batching logic. (#719) -- Remove the push controller named Meter map. (#738) -- Fix Histogram aggregator initial state (fix #735). (#736) -- Ensure golang alpine image is running `golang-1.14` for examples. (#733) -- Added test for grpctrace `UnaryInterceptorClient`. (#695) -- Rearrange `api/metric` code layout. (#724) - -## [0.5.0] - 2020-05-13 - -### Added - -- Batch `Observer` callback support. (#717) -- Alias `api` types to root package of project. (#696) -- Create basic `othttp.Transport` for simple client instrumentation. (#678) -- `SetAttribute(string, interface{})` to the trace API. (#674) -- Jaeger exporter option that allows user to specify custom http client. (#671) -- `Stringer` and `Infer` methods to `key`s. (#662) - -### Changed - -- Rename `NewKey` in the `kv` package to just `Key`. (#721) -- Move `core` and `key` to `kv` package. (#720) -- Make the metric API `Meter` a `struct` so the abstract `MeterImpl` can be passed and simplify implementation. (#709) -- Rename SDK `Batcher` to `Integrator` to match draft OpenTelemetry SDK specification. (#710) -- Rename SDK `Ungrouped` integrator to `simple.Integrator` to match draft OpenTelemetry SDK specification. (#710) -- Rename SDK `SDK` `struct` to `Accumulator` to match draft OpenTelemetry SDK specification. (#710) -- Move `Number` from `core` to `api/metric` package. (#706) -- Move `SpanContext` from `core` to `trace` package. (#692) -- Change traceparent header from `Traceparent` to `traceparent` to implement the W3C specification. (#681) - -### Fixed - -- Update tooling to run generators in all submodules. (#705) -- gRPC interceptor regexp to match methods without a service name. (#683) -- Use a `const` for padding 64-bit B3 trace IDs. (#701) -- Update `mockZipkin` listen address from `:0` to `127.0.0.1:0`. (#700) -- Left-pad 64-bit B3 trace IDs with zero. (#698) -- Propagate at least the first W3C tracestate header. (#694) -- Remove internal `StateLocker` implementation. (#688) -- Increase instance size CI system uses. (#690) -- Add a `key` benchmark and use reflection in `key.Infer()`. (#679) -- Fix internal `global` test by using `global.Meter` with `RecordBatch()`. (#680) -- Reimplement histogram using mutex instead of `StateLocker`. (#669) -- Switch `MinMaxSumCount` to a mutex lock implementation instead of `StateLocker`. (#667) -- Update documentation to not include any references to `WithKeys`. (#672) -- Correct misspelling. (#668) -- Fix clobbering of the span context if extraction fails. (#656) -- Bump `golangci-lint` and work around the corrupting bug. (#666) (#670) - -## [0.4.3] - 2020-04-24 - -### Added - -- `Dockerfile` and `docker-compose.yml` to run example code. (#635) -- New `grpctrace` package that provides gRPC client and server interceptors for both unary and stream connections. (#621) -- New `api/label` package, providing common label set implementation. (#651) -- Support for JSON marshaling of `Resources`. (#654) -- `TraceID` and `SpanID` implementations for `Stringer` interface. (#642) -- `RemoteAddrKey` in the othttp plugin to include the HTTP client address in top-level spans. (#627) -- `WithSpanFormatter` option to the othttp plugin. (#617) -- Updated README to include section for compatible libraries and include reference to the contrib repository. (#612) -- The prometheus exporter now supports exporting histograms. (#601) -- A `String` method to the `Resource` to return a hashable identifier for a now unique resource. (#613) -- An `Iter` method to the `Resource` to return an array `AttributeIterator`. (#613) -- An `Equal` method to the `Resource` test the equivalence of resources. (#613) -- An iterable structure (`AttributeIterator`) for `Resource` attributes. - -### Changed - -- zipkin export's `NewExporter` now requires a `serviceName` argument to ensure this needed values is provided. (#644) -- Pass `Resources` through the metrics export pipeline. (#659) - -### Removed - -- `WithKeys` option from the metric API. (#639) - -### Fixed - -- Use the `label.Set.Equivalent` value instead of an encoding in the batcher. (#658) -- Correct typo `trace.Exporter` to `trace.SpanSyncer` in comments. (#653) -- Use type names for return values in jaeger exporter. (#648) -- Increase the visibility of the `api/key` package by updating comments and fixing usages locally. (#650) -- `Checkpoint` only after `Update`; Keep records in the `sync.Map` longer. (#647) -- Do not cache `reflect.ValueOf()` in metric Labels. (#649) -- Batch metrics exported from the OTLP exporter based on `Resource` and labels. (#626) -- Add error wrapping to the prometheus exporter. (#631) -- Update the OTLP exporter batching of traces to use a unique `string` representation of an associated `Resource` as the batching key. (#623) -- Update OTLP `SpanData` transform to only include the `ParentSpanID` if one exists. (#614) -- Update `Resource` internal representation to uniquely and reliably identify resources. (#613) -- Check return value from `CheckpointSet.ForEach` in prometheus exporter. (#622) -- Ensure spans created by httptrace client tracer reflect operation structure. (#618) -- Create a new recorder rather than reuse when multiple observations in same epoch for asynchronous instruments. #610 -- The default port the OTLP exporter uses to connect to the OpenTelemetry collector is updated to match the one the collector listens on by default. (#611) - -## [0.4.2] - 2020-03-31 - -### Fixed - -- Fix `pre_release.sh` to update version in `sdk/opentelemetry.go`. (#607) -- Fix time conversion from internal to OTLP in OTLP exporter. (#606) - -## [0.4.1] - 2020-03-31 - -### Fixed - -- Update `tag.sh` to create signed tags. (#604) - -## [0.4.0] - 2020-03-30 - -### Added - -- New API package `api/metric/registry` that exposes a `MeterImpl` wrapper for use by SDKs to generate unique instruments. (#580) -- Script to verify examples after a new release. (#579) - -### Removed - -- The dogstatsd exporter due to lack of support. - This additionally removes support for statsd. (#591) -- `LabelSet` from the metric API. - This is replaced by a `[]core.KeyValue` slice. (#595) -- `Labels` from the metric API's `Meter` interface. (#595) - -### Changed - -- The metric `export.Labels` became an interface which the SDK implements and the `export` package provides a simple, immutable implementation of this interface intended for testing purposes. (#574) -- Renamed `internal/metric.Meter` to `MeterImpl`. (#580) -- Renamed `api/global/internal.obsImpl` to `asyncImpl`. (#580) - -### Fixed - -- Corrected missing return in mock span. (#582) -- Update License header for all source files to match CNCF guidelines and include a test to ensure it is present. (#586) (#596) -- Update to v0.3.0 of the OTLP in the OTLP exporter. (#588) -- Update pre-release script to be compatible between GNU and BSD based systems. (#592) -- Add a `RecordBatch` benchmark. (#594) -- Moved span transforms of the OTLP exporter to the internal package. (#593) -- Build both go-1.13 and go-1.14 in circleci to test for all supported versions of Go. (#569) -- Removed unneeded allocation on empty labels in OLTP exporter. (#597) -- Update `BatchedSpanProcessor` to process the queue until no data but respect max batch size. (#599) -- Update project documentation godoc.org links to pkg.go.dev. (#602) - -## [0.3.0] - 2020-03-21 - -This is a first official beta release, which provides almost fully complete metrics, tracing, and context propagation functionality. -There is still a possibility of breaking changes. - -### Added - -- Add `Observer` metric instrument. (#474) -- Add global `Propagators` functionality to enable deferred initialization for propagators registered before the first Meter SDK is installed. (#494) -- Simplified export setup pipeline for the jaeger exporter to match other exporters. (#459) -- The zipkin trace exporter. (#495) -- The OTLP exporter to export metric and trace telemetry to the OpenTelemetry collector. (#497) (#544) (#545) -- Add `StatusMessage` field to the trace `Span`. (#524) -- Context propagation in OpenTracing bridge in terms of OpenTelemetry context propagation. (#525) -- The `Resource` type was added to the SDK. (#528) -- The global API now supports a `Tracer` and `Meter` function as shortcuts to getting a global `*Provider` and calling these methods directly. (#538) -- The metric API now defines a generic `MeterImpl` interface to support general purpose `Meter` construction. - Additionally, `SyncImpl` and `AsyncImpl` are added to support general purpose instrument construction. (#560) -- A metric `Kind` is added to represent the `MeasureKind`, `ObserverKind`, and `CounterKind`. (#560) -- Scripts to better automate the release process. (#576) - -### Changed - -- Default to to use `AlwaysSampler` instead of `ProbabilitySampler` to match OpenTelemetry specification. (#506) -- Renamed `AlwaysSampleSampler` to `AlwaysOnSampler` in the trace API. (#511) -- Renamed `NeverSampleSampler` to `AlwaysOffSampler` in the trace API. (#511) -- The `Status` field of the `Span` was changed to `StatusCode` to disambiguate with the added `StatusMessage`. (#524) -- Updated the trace `Sampler` interface conform to the OpenTelemetry specification. (#531) -- Rename metric API `Options` to `Config`. (#541) -- Rename metric `Counter` aggregator to be `Sum`. (#541) -- Unify metric options into `Option` from instrument specific options. (#541) -- The trace API's `TraceProvider` now support `Resource`s. (#545) -- Correct error in zipkin module name. (#548) -- The jaeger trace exporter now supports `Resource`s. (#551) -- Metric SDK now supports `Resource`s. - The `WithResource` option was added to configure a `Resource` on creation and the `Resource` method was added to the metric `Descriptor` to return the associated `Resource`. (#552) -- Replace `ErrNoLastValue` and `ErrEmptyDataSet` by `ErrNoData` in the metric SDK. (#557) -- The stdout trace exporter now supports `Resource`s. (#558) -- The metric `Descriptor` is now included at the API instead of the SDK. (#560) -- Replace `Ordered` with an iterator in `export.Labels`. (#567) - -### Removed - -- The vendor specific Stackdriver. It is now hosted on 3rd party vendor infrastructure. (#452) -- The `Unregister` method for metric observers as it is not in the OpenTelemetry specification. (#560) -- `GetDescriptor` from the metric SDK. (#575) -- The `Gauge` instrument from the metric API. (#537) - -### Fixed - -- Make histogram aggregator checkpoint consistent. (#438) -- Update README with import instructions and how to build and test. (#505) -- The default label encoding was updated to be unique. (#508) -- Use `NewRoot` in the othttp plugin for public endpoints. (#513) -- Fix data race in `BatchedSpanProcessor`. (#518) -- Skip test-386 for Mac OS 10.15.x (Catalina and upwards). #521 -- Use a variable-size array to represent ordered labels in maps. (#523) -- Update the OTLP protobuf and update changed import path. (#532) -- Use `StateLocker` implementation in `MinMaxSumCount`. (#546) -- Eliminate goroutine leak in histogram stress test. (#547) -- Update OTLP exporter with latest protobuf. (#550) -- Add filters to the othttp plugin. (#556) -- Provide an implementation of the `Header*` filters that do not depend on Go 1.14. (#565) -- Encode labels once during checkpoint. - The checkpoint function is executed in a single thread so we can do the encoding lazily before passing the encoded version of labels to the exporter. - This is a cheap and quick way to avoid encoding the labels on every collection interval. (#572) -- Run coverage over all packages in `COVERAGE_MOD_DIR`. (#573) - -## [0.2.3] - 2020-03-04 - -### Added - -- `RecordError` method on `Span`s in the trace API to Simplify adding error events to spans. (#473) -- Configurable push frequency for exporters setup pipeline. (#504) - -### Changed - -- Rename the `exporter` directory to `exporters`. - The `go.opentelemetry.io/otel/exporter/trace/jaeger` package was mistakenly released with a `v1.0.0` tag instead of `v0.1.0`. - This resulted in all subsequent releases not becoming the default latest. - A consequence of this was that all `go get`s pulled in the incompatible `v0.1.0` release of that package when pulling in more recent packages from other otel packages. - Renaming the `exporter` directory to `exporters` fixes this issue by renaming the package and therefore clearing any existing dependency tags. - Consequentially, this action also renames *all* exporter packages. (#502) - -### Removed - -- The `CorrelationContextHeader` constant in the `correlation` package is no longer exported. (#503) - -## [0.2.2] - 2020-02-27 - -### Added - -- `HTTPSupplier` interface in the propagation API to specify methods to retrieve and store a single value for a key to be associated with a carrier. (#467) -- `HTTPExtractor` interface in the propagation API to extract information from an `HTTPSupplier` into a context. (#467) -- `HTTPInjector` interface in the propagation API to inject information into an `HTTPSupplier.` (#467) -- `Config` and configuring `Option` to the propagator API. (#467) -- `Propagators` interface in the propagation API to contain the set of injectors and extractors for all supported carrier formats. (#467) -- `HTTPPropagator` interface in the propagation API to inject and extract from an `HTTPSupplier.` (#467) -- `WithInjectors` and `WithExtractors` functions to the propagator API to configure injectors and extractors to use. (#467) -- `ExtractHTTP` and `InjectHTTP` functions to apply configured HTTP extractors and injectors to a passed context. (#467) -- Histogram aggregator. (#433) -- `DefaultPropagator` function and have it return `trace.TraceContext` as the default context propagator. (#456) -- `AlwaysParentSample` sampler to the trace API. (#455) -- `WithNewRoot` option function to the trace API to specify the created span should be considered a root span. (#451) - -### Changed - -- Renamed `WithMap` to `ContextWithMap` in the correlation package. (#481) -- Renamed `FromContext` to `MapFromContext` in the correlation package. (#481) -- Move correlation context propagation to correlation package. (#479) -- Do not default to putting remote span context into links. (#480) -- `Tracer.WithSpan` updated to accept `StartOptions`. (#472) -- Renamed `MetricKind` to `Kind` to not stutter in the type usage. (#432) -- Renamed the `export` package to `metric` to match directory structure. (#432) -- Rename the `api/distributedcontext` package to `api/correlation`. (#444) -- Rename the `api/propagators` package to `api/propagation`. (#444) -- Move the propagators from the `propagators` package into the `trace` API package. (#444) -- Update `Float64Gauge`, `Int64Gauge`, `Float64Counter`, `Int64Counter`, `Float64Measure`, and `Int64Measure` metric methods to use value receivers instead of pointers. (#462) -- Moved all dependencies of tools package to a tools directory. (#466) - -### Removed - -- Binary propagators. (#467) -- NOOP propagator. (#467) - -### Fixed - -- Upgraded `github.com/golangci/golangci-lint` from `v1.21.0` to `v1.23.6` in `tools/`. (#492) -- Fix a possible nil-dereference crash (#478) -- Correct comments for `InstallNewPipeline` in the stdout exporter. (#483) -- Correct comments for `InstallNewPipeline` in the dogstatsd exporter. (#484) -- Correct comments for `InstallNewPipeline` in the prometheus exporter. (#482) -- Initialize `onError` based on `Config` in prometheus exporter. (#486) -- Correct module name in prometheus exporter README. (#475) -- Removed tracer name prefix from span names. (#430) -- Fix `aggregator_test.go` import package comment. (#431) -- Improved detail in stdout exporter. (#436) -- Fix a dependency issue (generate target should depend on stringer, not lint target) in Makefile. (#442) -- Reorders the Makefile targets within `precommit` target so we generate files and build the code before doing linting, so we can get much nicer errors about syntax errors from the compiler. (#442) -- Reword function documentation in gRPC plugin. (#446) -- Send the `span.kind` tag to Jaeger from the jaeger exporter. (#441) -- Fix `metadataSupplier` in the jaeger exporter to overwrite the header if existing instead of appending to it. (#441) -- Upgraded to Go 1.13 in CI. (#465) -- Correct opentelemetry.io URL in trace SDK documentation. (#464) -- Refactored reference counting logic in SDK determination of stale records. (#468) -- Add call to `runtime.Gosched` in instrument `acquireHandle` logic to not block the collector. (#469) - -## [0.2.1.1] - 2020-01-13 - -### Fixed - -- Use stateful batcher on Prometheus exporter fixing regression introduced in #395. (#428) - -## [0.2.1] - 2020-01-08 - -### Added - -- Global meter forwarding implementation. - This enables deferred initialization for metric instruments registered before the first Meter SDK is installed. (#392) -- Global trace forwarding implementation. - This enables deferred initialization for tracers registered before the first Trace SDK is installed. (#406) -- Standardize export pipeline creation in all exporters. (#395) -- A testing, organization, and comments for 64-bit field alignment. (#418) -- Script to tag all modules in the project. (#414) - -### Changed - -- Renamed `propagation` package to `propagators`. (#362) -- Renamed `B3Propagator` propagator to `B3`. (#362) -- Renamed `TextFormatPropagator` propagator to `TextFormat`. (#362) -- Renamed `BinaryPropagator` propagator to `Binary`. (#362) -- Renamed `BinaryFormatPropagator` propagator to `BinaryFormat`. (#362) -- Renamed `NoopTextFormatPropagator` propagator to `NoopTextFormat`. (#362) -- Renamed `TraceContextPropagator` propagator to `TraceContext`. (#362) -- Renamed `SpanOption` to `StartOption` in the trace API. (#369) -- Renamed `StartOptions` to `StartConfig` in the trace API. (#369) -- Renamed `EndOptions` to `EndConfig` in the trace API. (#369) -- `Number` now has a pointer receiver for its methods. (#375) -- Renamed `CurrentSpan` to `SpanFromContext` in the trace API. (#379) -- Renamed `SetCurrentSpan` to `ContextWithSpan` in the trace API. (#379) -- Renamed `Message` in Event to `Name` in the trace API. (#389) -- Prometheus exporter no longer aggregates metrics, instead it only exports them. (#385) -- Renamed `HandleImpl` to `BoundInstrumentImpl` in the metric API. (#400) -- Renamed `Float64CounterHandle` to `Float64CounterBoundInstrument` in the metric API. (#400) -- Renamed `Int64CounterHandle` to `Int64CounterBoundInstrument` in the metric API. (#400) -- Renamed `Float64GaugeHandle` to `Float64GaugeBoundInstrument` in the metric API. (#400) -- Renamed `Int64GaugeHandle` to `Int64GaugeBoundInstrument` in the metric API. (#400) -- Renamed `Float64MeasureHandle` to `Float64MeasureBoundInstrument` in the metric API. (#400) -- Renamed `Int64MeasureHandle` to `Int64MeasureBoundInstrument` in the metric API. (#400) -- Renamed `Release` method for bound instruments in the metric API to `Unbind`. (#400) -- Renamed `AcquireHandle` method for bound instruments in the metric API to `Bind`. (#400) -- Renamed the `File` option in the stdout exporter to `Writer`. (#404) -- Renamed all `Options` to `Config` for all metric exports where this wasn't already the case. - -### Fixed - -- Aggregator import path corrected. (#421) -- Correct links in README. (#368) -- The README was updated to match latest code changes in its examples. (#374) -- Don't capitalize error statements. (#375) -- Fix ignored errors. (#375) -- Fix ambiguous variable naming. (#375) -- Removed unnecessary type casting. (#375) -- Use named parameters. (#375) -- Updated release schedule. (#378) -- Correct http-stackdriver example module name. (#394) -- Removed the `http.request` span in `httptrace` package. (#397) -- Add comments in the metrics SDK (#399) -- Initialize checkpoint when creating ddsketch aggregator to prevent panic when merging into a empty one. (#402) (#403) -- Add documentation of compatible exporters in the README. (#405) -- Typo fix. (#408) -- Simplify span check logic in SDK tracer implementation. (#419) - -## [0.2.0] - 2019-12-03 - -### Added - -- Unary gRPC tracing example. (#351) -- Prometheus exporter. (#334) -- Dogstatsd metrics exporter. (#326) - -### Changed - -- Rename `MaxSumCount` aggregation to `MinMaxSumCount` and add the `Min` interface for this aggregation. (#352) -- Rename `GetMeter` to `Meter`. (#357) -- Rename `HTTPTraceContextPropagator` to `TraceContextPropagator`. (#355) -- Rename `HTTPB3Propagator` to `B3Propagator`. (#355) -- Rename `HTTPTraceContextPropagator` to `TraceContextPropagator`. (#355) -- Move `/global` package to `/api/global`. (#356) -- Rename `GetTracer` to `Tracer`. (#347) - -### Removed - -- `SetAttribute` from the `Span` interface in the trace API. (#361) -- `AddLink` from the `Span` interface in the trace API. (#349) -- `Link` from the `Span` interface in the trace API. (#349) - -### Fixed - -- Exclude example directories from coverage report. (#365) -- Lint make target now implements automatic fixes with `golangci-lint` before a second run to report the remaining issues. (#360) -- Drop `GO111MODULE` environment variable in Makefile as Go 1.13 is the project specified minimum version and this is environment variable is not needed for that version of Go. (#359) -- Run the race checker for all test. (#354) -- Redundant commands in the Makefile are removed. (#354) -- Split the `generate` and `lint` targets of the Makefile. (#354) -- Renames `circle-ci` target to more generic `ci` in Makefile. (#354) -- Add example Prometheus binary to gitignore. (#358) -- Support negative numbers with the `MaxSumCount`. (#335) -- Resolve race conditions in `push_test.go` identified in #339. (#340) -- Use `/usr/bin/env bash` as a shebang in scripts rather than `/bin/bash`. (#336) -- Trace benchmark now tests both `AlwaysSample` and `NeverSample`. - Previously it was testing `AlwaysSample` twice. (#325) -- Trace benchmark now uses a `[]byte` for `TraceID` to fix failing test. (#325) -- Added a trace benchmark to test variadic functions in `setAttribute` vs `setAttributes` (#325) -- The `defaultkeys` batcher was only using the encoded label set as its map key while building a checkpoint. - This allowed distinct label sets through, but any metrics sharing a label set could be overwritten or merged incorrectly. - This was corrected. (#333) - -## [0.1.2] - 2019-11-18 - -### Fixed - -- Optimized the `simplelru` map for attributes to reduce the number of allocations. (#328) -- Removed unnecessary unslicing of parameters that are already a slice. (#324) - -## [0.1.1] - 2019-11-18 - -This release contains a Metrics SDK with stdout exporter and supports basic aggregations such as counter, gauges, array, maxsumcount, and ddsketch. - -### Added - -- Metrics stdout export pipeline. (#265) -- Array aggregation for raw measure metrics. (#282) -- The core.Value now have a `MarshalJSON` method. (#281) - -### Removed - -- `WithService`, `WithResources`, and `WithComponent` methods of tracers. (#314) -- Prefix slash in `Tracer.Start()` for the Jaeger example. (#292) - -### Changed - -- Allocation in LabelSet construction to reduce GC overhead. (#318) -- `trace.WithAttributes` to append values instead of replacing (#315) -- Use a formula for tolerance in sampling tests. (#298) -- Move export types into trace and metric-specific sub-directories. (#289) -- `SpanKind` back to being based on an `int` type. (#288) - -### Fixed - -- URL to OpenTelemetry website in README. (#323) -- Name of othttp default tracer. (#321) -- `ExportSpans` for the stackdriver exporter now handles `nil` context. (#294) -- CI modules cache to correctly restore/save from/to the cache. (#316) -- Fix metric SDK race condition between `LoadOrStore` and the assignment `rec.recorder = i.meter.exporter.AggregatorFor(rec)`. (#293) -- README now reflects the new code structure introduced with these changes. (#291) -- Make the basic example work. (#279) - -## [0.1.0] - 2019-11-04 - -This is the first release of open-telemetry go library. -It contains api and sdk for trace and meter. - -### Added - -- Initial OpenTelemetry trace and metric API prototypes. -- Initial OpenTelemetry trace, metric, and export SDK packages. -- A wireframe bridge to support compatibility with OpenTracing. -- Example code for a basic, http-stackdriver, http, jaeger, and named tracer setup. -- Exporters for Jaeger, Stackdriver, and stdout. -- Propagators for binary, B3, and trace-context protocols. -- Project information and guidelines in the form of a README and CONTRIBUTING. -- Tools to build the project and a Makefile to automate the process. -- Apache-2.0 license. -- CircleCI build CI manifest files. -- CODEOWNERS file to track owners of this project. - -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.24.0...HEAD -[1.24.0/0.46.0/0.0.1-alpha]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.24.0 -[1.23.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.1 -[1.23.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.0 -[1.23.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.0-rc.1 -[1.22.0/0.45.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.22.0 -[1.21.0/0.44.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.21.0 -[1.20.0/0.43.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.20.0 -[1.19.0/0.42.0/0.0.7]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.19.0 -[1.19.0-rc.1/0.42.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.19.0-rc.1 -[1.18.0/0.41.0/0.0.6]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.18.0 -[1.17.0/0.40.0/0.0.5]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.17.0 -[1.16.0/0.39.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.16.0 -[1.16.0-rc.1/0.39.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.16.0-rc.1 -[1.15.1/0.38.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.1 -[1.15.0/0.38.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0 -[1.15.0-rc.2/0.38.0-rc.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0-rc.2 -[1.15.0-rc.1/0.38.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0-rc.1 -[1.14.0/0.37.0/0.0.4]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.14.0 -[1.13.0/0.36.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.13.0 -[1.12.0/0.35.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.12.0 -[1.11.2/0.34.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.2 -[1.11.1/0.33.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.1 -[1.11.0/0.32.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.0 -[0.32.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.2 -[0.32.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.1 -[0.32.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.0 -[1.10.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.10.0 -[1.9.0/0.0.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.9.0 -[1.8.0/0.31.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.8.0 -[1.7.0/0.30.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.7.0 -[0.29.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/metric/v0.29.0 -[1.6.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.3 -[1.6.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.2 -[1.6.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.1 -[1.6.0/0.28.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.0 -[1.5.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.5.0 -[1.4.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.4.1 -[1.4.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.4.0 -[1.3.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.3.0 -[1.2.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.2.0 -[1.1.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.1.0 -[1.0.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.0.1 -[Metrics 0.24.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/metric/v0.24.0 -[1.0.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.0.0 -[1.0.0-RC3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.0.0-RC3 -[1.0.0-RC2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.0.0-RC2 -[Experimental Metrics v0.22.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/metric/v0.22.0 -[1.0.0-RC1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.0.0-RC1 -[0.20.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.20.0 -[0.19.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.19.0 -[0.18.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.18.0 -[0.17.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.17.0 -[0.16.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.16.0 -[0.15.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.15.0 -[0.14.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.14.0 -[0.13.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.13.0 -[0.12.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.12.0 -[0.11.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.11.0 -[0.10.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.10.0 -[0.9.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.9.0 -[0.8.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.8.0 -[0.7.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.7.0 -[0.6.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.6.0 -[0.5.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.5.0 -[0.4.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.4.3 -[0.4.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.4.2 -[0.4.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.4.1 -[0.4.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.4.0 -[0.3.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.3.0 -[0.2.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.2.3 -[0.2.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.2.2 -[0.2.1.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.2.1.1 -[0.2.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.2.1 -[0.2.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.2.0 -[0.1.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.2 -[0.1.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.1 -[0.1.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.0 - -[Go 1.22]: https://go.dev/doc/go1.22 -[Go 1.21]: https://go.dev/doc/go1.21 -[Go 1.20]: https://go.dev/doc/go1.20 -[Go 1.19]: https://go.dev/doc/go1.19 -[Go 1.18]: https://go.dev/doc/go1.18 - -[metric API]:https://pkg.go.dev/go.opentelemetry.io/otel/metric -[metric SDK]:https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric -[trace API]:https://pkg.go.dev/go.opentelemetry.io/otel/trace diff --git a/vendor/go.opentelemetry.io/otel/CODEOWNERS b/vendor/go.opentelemetry.io/otel/CODEOWNERS deleted file mode 100644 index 31d336d9..00000000 --- a/vendor/go.opentelemetry.io/otel/CODEOWNERS +++ /dev/null @@ -1,17 +0,0 @@ -##################################################### -# -# List of approvers for this repository -# -##################################################### -# -# Learn about membership in OpenTelemetry community: -# https://github.com/open-telemetry/community/blob/main/community-membership.md -# -# -# Learn about CODEOWNERS file format: -# https://help.github.com/en/articles/about-code-owners -# - -* @MrAlias @Aneurysm9 @evantorrie @XSAM @dashpole @MadVikingGod @pellared @hanyuancheung @dmathieu - -CODEOWNERS @MrAlias @MadVikingGod @pellared @dashpole \ No newline at end of file diff --git a/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md b/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md deleted file mode 100644 index c9f2bac5..00000000 --- a/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md +++ /dev/null @@ -1,645 +0,0 @@ -# Contributing to opentelemetry-go - -The Go special interest group (SIG) meets regularly. See the -OpenTelemetry -[community](https://github.com/open-telemetry/community#golang-sdk) -repo for information on this and other language SIGs. - -See the [public meeting -notes](https://docs.google.com/document/d/1E5e7Ld0NuU1iVvf-42tOBpu2VBBLYnh73GJuITGJTTU/edit) -for a summary description of past meetings. To request edit access, -join the meeting or get in touch on -[Slack](https://cloud-native.slack.com/archives/C01NPAXACKT). - -## Development - -You can view and edit the source code by cloning this repository: - -```sh -git clone https://github.com/open-telemetry/opentelemetry-go.git -``` - -Run `make test` to run the tests instead of `go test`. - -There are some generated files checked into the repo. To make sure -that the generated files are up-to-date, run `make` (or `make -precommit` - the `precommit` target is the default). - -The `precommit` target also fixes the formatting of the code and -checks the status of the go module files. - -Additionally, there is a `codespell` target that checks for common -typos in the code. It is not run by default, but you can run it -manually with `make codespell`. It will set up a virtual environment -in `venv` and install `codespell` there. - -If after running `make precommit` the output of `git status` contains -`nothing to commit, working tree clean` then it means that everything -is up-to-date and properly formatted. - -## Pull Requests - -### How to Send Pull Requests - -Everyone is welcome to contribute code to `opentelemetry-go` via -GitHub pull requests (PRs). - -To create a new PR, fork the project in GitHub and clone the upstream -repo: - -```sh -go get -d go.opentelemetry.io/otel -``` - -(This may print some warning about "build constraints exclude all Go -files", just ignore it.) - -This will put the project in `${GOPATH}/src/go.opentelemetry.io/otel`. You -can alternatively use `git` directly with: - -```sh -git clone https://github.com/open-telemetry/opentelemetry-go -``` - -(Note that `git clone` is *not* using the `go.opentelemetry.io/otel` name - -that name is a kind of a redirector to GitHub that `go get` can -understand, but `git` does not.) - -This would put the project in the `opentelemetry-go` directory in -current working directory. - -Enter the newly created directory and add your fork as a new remote: - -```sh -git remote add git@github.com:/opentelemetry-go -``` - -Check out a new branch, make modifications, run linters and tests, update -`CHANGELOG.md`, and push the branch to your fork: - -```sh -git checkout -b -# edit files -# update changelog -make precommit -git add -p -git commit -git push -``` - -Open a pull request against the main `opentelemetry-go` repo. Be sure to add the pull -request ID to the entry you added to `CHANGELOG.md`. - -Avoid rebasing and force-pushing to your branch to facilitate reviewing the pull request. -Rewriting Git history makes it difficult to keep track of iterations during code review. -All pull requests are squashed to a single commit upon merge to `main`. - -### How to Receive Comments - -* If the PR is not ready for review, please put `[WIP]` in the title, - tag it as `work-in-progress`, or mark it as - [`draft`](https://github.blog/2019-02-14-introducing-draft-pull-requests/). -* Make sure CLA is signed and CI is clear. - -### How to Get PRs Merged - -A PR is considered **ready to merge** when: - -* It has received two qualified approvals[^1]. - - This is not enforced through automation, but needs to be validated by the - maintainer merging. - * The qualified approvals need to be from [Approver]s/[Maintainer]s - affiliated with different companies. Two qualified approvals from - [Approver]s or [Maintainer]s affiliated with the same company counts as a - single qualified approval. - * PRs introducing changes that have already been discussed and consensus - reached only need one qualified approval. The discussion and resolution - needs to be linked to the PR. - * Trivial changes[^2] only need one qualified approval. - -* All feedback has been addressed. - * All PR comments and suggestions are resolved. - * All GitHub Pull Request reviews with a status of "Request changes" have - been addressed. Another review by the objecting reviewer with a different - status can be submitted to clear the original review, or the review can be - dismissed by a [Maintainer] when the issues from the original review have - been addressed. - * Any comments or reviews that cannot be resolved between the PR author and - reviewers can be submitted to the community [Approver]s and [Maintainer]s - during the weekly SIG meeting. If consensus is reached among the - [Approver]s and [Maintainer]s during the SIG meeting the objections to the - PR may be dismissed or resolved or the PR closed by a [Maintainer]. - * Any substantive changes to the PR require existing Approval reviews be - cleared unless the approver explicitly states that their approval persists - across changes. This includes changes resulting from other feedback. - [Approver]s and [Maintainer]s can help in clearing reviews and they should - be consulted if there are any questions. - -* The PR branch is up to date with the base branch it is merging into. - * To ensure this does not block the PR, it should be configured to allow - maintainers to update it. - -* It has been open for review for at least one working day. This gives people - reasonable time to review. - * Trivial changes[^2] do not have to wait for one day and may be merged with - a single [Maintainer]'s approval. - -* All required GitHub workflows have succeeded. -* Urgent fix can take exception as long as it has been actively communicated - among [Maintainer]s. - -Any [Maintainer] can merge the PR once the above criteria have been met. - -[^1]: A qualified approval is a GitHub Pull Request review with "Approve" - status from an OpenTelemetry Go [Approver] or [Maintainer]. -[^2]: Trivial changes include: typo corrections, cosmetic non-substantive - changes, documentation corrections or updates, dependency updates, etc. - -## Design Choices - -As with other OpenTelemetry clients, opentelemetry-go follows the -[OpenTelemetry Specification](https://opentelemetry.io/docs/specs/otel). - -It's especially valuable to read through the [library -guidelines](https://opentelemetry.io/docs/specs/otel/library-guidelines). - -### Focus on Capabilities, Not Structure Compliance - -OpenTelemetry is an evolving specification, one where the desires and -use cases are clear, but the method to satisfy those uses cases are -not. - -As such, Contributions should provide functionality and behavior that -conforms to the specification, but the interface and structure is -flexible. - -It is preferable to have contributions follow the idioms of the -language rather than conform to specific API names or argument -patterns in the spec. - -For a deeper discussion, see -[this](https://github.com/open-telemetry/opentelemetry-specification/issues/165). - -## Documentation - -Each (non-internal, non-test) package must be documented using -[Go Doc Comments](https://go.dev/doc/comment), -preferably in a `doc.go` file. - -Prefer using [Examples](https://pkg.go.dev/testing#hdr-Examples) -instead of putting code snippets in Go doc comments. -In some cases, you can even create [Testable Examples](https://go.dev/blog/examples). - -You can install and run a "local Go Doc site" in the following way: - - ```sh - go install golang.org/x/pkgsite/cmd/pkgsite@latest - pkgsite - ``` - -[`go.opentelemetry.io/otel/metric`](https://pkg.go.dev/go.opentelemetry.io/otel/metric) -is an example of a very well-documented package. - -## Style Guide - -One of the primary goals of this project is that it is actually used by -developers. With this goal in mind the project strives to build -user-friendly and idiomatic Go code adhering to the Go community's best -practices. - -For a non-comprehensive but foundational overview of these best practices -the [Effective Go](https://golang.org/doc/effective_go.html) documentation -is an excellent starting place. - -As a convenience for developers building this project the `make precommit` -will format, lint, validate, and in some cases fix the changes you plan to -submit. This check will need to pass for your changes to be able to be -merged. - -In addition to idiomatic Go, the project has adopted certain standards for -implementations of common patterns. These standards should be followed as a -default, and if they are not followed documentation needs to be included as -to the reasons why. - -### Configuration - -When creating an instantiation function for a complex `type T struct`, it is -useful to allow variable number of options to be applied. However, the strong -type system of Go restricts the function design options. There are a few ways -to solve this problem, but we have landed on the following design. - -#### `config` - -Configuration should be held in a `struct` named `config`, or prefixed with -specific type name this Configuration applies to if there are multiple -`config` in the package. This type must contain configuration options. - -```go -// config contains configuration options for a thing. -type config struct { - // options ... -} -``` - -In general the `config` type will not need to be used externally to the -package and should be unexported. If, however, it is expected that the user -will likely want to build custom options for the configuration, the `config` -should be exported. Please, include in the documentation for the `config` -how the user can extend the configuration. - -It is important that internal `config` are not shared across package boundaries. -Meaning a `config` from one package should not be directly used by another. The -one exception is the API packages. The configs from the base API, eg. -`go.opentelemetry.io/otel/trace.TracerConfig` and -`go.opentelemetry.io/otel/metric.InstrumentConfig`, are intended to be consumed -by the SDK therefore it is expected that these are exported. - -When a config is exported we want to maintain forward and backward -compatibility, to achieve this no fields should be exported but should -instead be accessed by methods. - -Optionally, it is common to include a `newConfig` function (with the same -naming scheme). This function wraps any defaults setting and looping over -all options to create a configured `config`. - -```go -// newConfig returns an appropriately configured config. -func newConfig(options ...Option) config { - // Set default values for config. - config := config{/* […] */} - for _, option := range options { - config = option.apply(config) - } - // Perform any validation here. - return config -} -``` - -If validation of the `config` options is also performed this can return an -error as well that is expected to be handled by the instantiation function -or propagated to the user. - -Given the design goal of not having the user need to work with the `config`, -the `newConfig` function should also be unexported. - -#### `Option` - -To set the value of the options a `config` contains, a corresponding -`Option` interface type should be used. - -```go -type Option interface { - apply(config) config -} -``` - -Having `apply` unexported makes sure that it will not be used externally. -Moreover, the interface becomes sealed so the user cannot easily implement -the interface on its own. - -The `apply` method should return a modified version of the passed config. -This approach, instead of passing a pointer, is used to prevent the config from being allocated to the heap. - -The name of the interface should be prefixed in the same way the -corresponding `config` is (if at all). - -#### Options - -All user configurable options for a `config` must have a related unexported -implementation of the `Option` interface and an exported configuration -function that wraps this implementation. - -The wrapping function name should be prefixed with `With*` (or in the -special case of a boolean options `Without*`) and should have the following -function signature. - -```go -func With*(…) Option { … } -``` - -##### `bool` Options - -```go -type defaultFalseOption bool - -func (o defaultFalseOption) apply(c config) config { - c.Bool = bool(o) - return c -} - -// WithOption sets a T to have an option included. -func WithOption() Option { - return defaultFalseOption(true) -} -``` - -```go -type defaultTrueOption bool - -func (o defaultTrueOption) apply(c config) config { - c.Bool = bool(o) - return c -} - -// WithoutOption sets a T to have Bool option excluded. -func WithoutOption() Option { - return defaultTrueOption(false) -} -``` - -##### Declared Type Options - -```go -type myTypeOption struct { - MyType MyType -} - -func (o myTypeOption) apply(c config) config { - c.MyType = o.MyType - return c -} - -// WithMyType sets T to have include MyType. -func WithMyType(t MyType) Option { - return myTypeOption{t} -} -``` - -##### Functional Options - -```go -type optionFunc func(config) config - -func (fn optionFunc) apply(c config) config { - return fn(c) -} - -// WithMyType sets t as MyType. -func WithMyType(t MyType) Option { - return optionFunc(func(c config) config { - c.MyType = t - return c - }) -} -``` - -#### Instantiation - -Using this configuration pattern to configure instantiation with a `NewT` -function. - -```go -func NewT(options ...Option) T {…} -``` - -Any required parameters can be declared before the variadic `options`. - -#### Dealing with Overlap - -Sometimes there are multiple complex `struct` that share common -configuration and also have distinct configuration. To avoid repeated -portions of `config`s, a common `config` can be used with the union of -options being handled with the `Option` interface. - -For example. - -```go -// config holds options for all animals. -type config struct { - Weight float64 - Color string - MaxAltitude float64 -} - -// DogOption apply Dog specific options. -type DogOption interface { - applyDog(config) config -} - -// BirdOption apply Bird specific options. -type BirdOption interface { - applyBird(config) config -} - -// Option apply options for all animals. -type Option interface { - BirdOption - DogOption -} - -type weightOption float64 - -func (o weightOption) applyDog(c config) config { - c.Weight = float64(o) - return c -} - -func (o weightOption) applyBird(c config) config { - c.Weight = float64(o) - return c -} - -func WithWeight(w float64) Option { return weightOption(w) } - -type furColorOption string - -func (o furColorOption) applyDog(c config) config { - c.Color = string(o) - return c -} - -func WithFurColor(c string) DogOption { return furColorOption(c) } - -type maxAltitudeOption float64 - -func (o maxAltitudeOption) applyBird(c config) config { - c.MaxAltitude = float64(o) - return c -} - -func WithMaxAltitude(a float64) BirdOption { return maxAltitudeOption(a) } - -func NewDog(name string, o ...DogOption) Dog {…} -func NewBird(name string, o ...BirdOption) Bird {…} -``` - -### Interfaces - -To allow other developers to better comprehend the code, it is important -to ensure it is sufficiently documented. One simple measure that contributes -to this aim is self-documenting by naming method parameters. Therefore, -where appropriate, methods of every exported interface type should have -their parameters appropriately named. - -#### Interface Stability - -All exported stable interfaces that include the following warning in their -documentation are allowed to be extended with additional methods. - -> Warning: methods may be added to this interface in minor releases. - -These interfaces are defined by the OpenTelemetry specification and will be -updated as the specification evolves. - -Otherwise, stable interfaces MUST NOT be modified. - -#### How to Change Specification Interfaces - -When an API change must be made, we will update the SDK with the new method one -release before the API change. This will allow the SDK one version before the -API change to work seamlessly with the new API. - -If an incompatible version of the SDK is used with the new API the application -will fail to compile. - -#### How Not to Change Specification Interfaces - -We have explored using a v2 of the API to change interfaces and found that there -was no way to introduce a v2 and have it work seamlessly with the v1 of the API. -Problems happened with libraries that upgraded to v2 when an application did not, -and would not produce any telemetry. - -More detail of the approaches considered and their limitations can be found in -the [Use a V2 API to evolve interfaces](https://github.com/open-telemetry/opentelemetry-go/issues/3920) -issue. - -#### How to Change Other Interfaces - -If new functionality is needed for an interface that cannot be changed it MUST -be added by including an additional interface. That added interface can be a -simple interface for the specific functionality that you want to add or it can -be a super-set of the original interface. For example, if you wanted to a -`Close` method to the `Exporter` interface: - -```go -type Exporter interface { - Export() -} -``` - -A new interface, `Closer`, can be added: - -```go -type Closer interface { - Close() -} -``` - -Code that is passed the `Exporter` interface can now check to see if the passed -value also satisfies the new interface. E.g. - -```go -func caller(e Exporter) { - /* ... */ - if c, ok := e.(Closer); ok { - c.Close() - } - /* ... */ -} -``` - -Alternatively, a new type that is the super-set of an `Exporter` can be created. - -```go -type ClosingExporter struct { - Exporter - Close() -} -``` - -This new type can be used similar to the simple interface above in that a -passed `Exporter` type can be asserted to satisfy the `ClosingExporter` type -and the `Close` method called. - -This super-set approach can be useful if there is explicit behavior that needs -to be coupled with the original type and passed as a unified type to a new -function, but, because of this coupling, it also limits the applicability of -the added functionality. If there exist other interfaces where this -functionality should be added, each one will need their own super-set -interfaces and will duplicate the pattern. For this reason, the simple targeted -interface that defines the specific functionality should be preferred. - -### Testing - -The tests should never leak goroutines. - -Use the term `ConcurrentSafe` in the test name when it aims to verify the -absence of race conditions. - -### Internal packages - -The use of internal packages should be scoped to a single module. A sub-module -should never import from a parent internal package. This creates a coupling -between the two modules where a user can upgrade the parent without the child -and if the internal package API has changed it will fail to upgrade[^3]. - -There are two known exceptions to this rule: - -- `go.opentelemetry.io/otel/internal/global` - - This package manages global state for all of opentelemetry-go. It needs to - be a single package in order to ensure the uniqueness of the global state. -- `go.opentelemetry.io/otel/internal/baggage` - - This package provides values in a `context.Context` that need to be - recognized by `go.opentelemetry.io/otel/baggage` and - `go.opentelemetry.io/otel/bridge/opentracing` but remain private. - -If you have duplicate code in multiple modules, make that code into a Go -template stored in `go.opentelemetry.io/otel/internal/shared` and use [gotmpl] -to render the templates in the desired locations. See [#4404] for an example of -this. - -[^3]: https://github.com/open-telemetry/opentelemetry-go/issues/3548 - -### Ignoring context cancellation - -OpenTelemetry API implementations need to ignore the cancellation of the context that are -passed when recording a value (e.g. starting a span, recording a measurement, emitting a log). -Recording methods should not return an error describing the cancellation state of the context -when they complete, nor should they abort any work. - -This rule may not apply if the OpenTelemetry specification defines a timeout mechanism for -the method. In that case the context cancellation can be used for the timeout with the -restriction that this behavior is documented for the method. Otherwise, timeouts -are expected to be handled by the user calling the API, not the implementation. - -Stoppage of the telemetry pipeline is handled by calling the appropriate `Shutdown` method -of a provider. It is assumed the context passed from a user is not used for this purpose. - -Outside of the direct recording of telemetry from the API (e.g. exporting telemetry, -force flushing telemetry, shutting down a signal provider) the context cancellation -should be honored. This means all work done on behalf of the user provided context -should be canceled. - -## Approvers and Maintainers - -### Approvers - -- [Evan Torrie](https://github.com/evantorrie), Verizon Media -- [Sam Xie](https://github.com/XSAM), Cisco/AppDynamics -- [Chester Cheung](https://github.com/hanyuancheung), Tencent -- [Damien Mathieu](https://github.com/dmathieu), Elastic -- [Anthony Mirabella](https://github.com/Aneurysm9), AWS - -### Maintainers - -- [David Ashpole](https://github.com/dashpole), Google -- [Aaron Clawson](https://github.com/MadVikingGod), LightStep -- [Robert Pająk](https://github.com/pellared), Splunk -- [Tyler Yahn](https://github.com/MrAlias), Splunk - -### Emeritus - -- [Liz Fong-Jones](https://github.com/lizthegrey), Honeycomb -- [Gustavo Silva Paiva](https://github.com/paivagustavo), LightStep -- [Josh MacDonald](https://github.com/jmacd), LightStep - -### Become an Approver or a Maintainer - -See the [community membership document in OpenTelemetry community -repo](https://github.com/open-telemetry/community/blob/main/community-membership.md). - -[Approver]: #approvers -[Maintainer]: #maintainers -[gotmpl]: https://pkg.go.dev/go.opentelemetry.io/build-tools/gotmpl -[#4404]: https://github.com/open-telemetry/opentelemetry-go/pull/4404 diff --git a/vendor/go.opentelemetry.io/otel/LICENSE b/vendor/go.opentelemetry.io/otel/LICENSE deleted file mode 100644 index 261eeb9e..00000000 --- a/vendor/go.opentelemetry.io/otel/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. diff --git a/vendor/go.opentelemetry.io/otel/Makefile b/vendor/go.opentelemetry.io/otel/Makefile deleted file mode 100644 index 6de95219..00000000 --- a/vendor/go.opentelemetry.io/otel/Makefile +++ /dev/null @@ -1,318 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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. - -TOOLS_MOD_DIR := ./internal/tools - -ALL_DOCS := $(shell find . -name '*.md' -type f | sort) -ALL_GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort) -OTEL_GO_MOD_DIRS := $(filter-out $(TOOLS_MOD_DIR), $(ALL_GO_MOD_DIRS)) -ALL_COVERAGE_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | grep -E -v '^./example|^$(TOOLS_MOD_DIR)' | sort) - -GO = go -TIMEOUT = 60 - -.DEFAULT_GOAL := precommit - -.PHONY: precommit ci -precommit: generate dependabot-generate license-check misspell go-mod-tidy golangci-lint-fix test-default -ci: generate dependabot-check license-check lint vanity-import-check build test-default check-clean-work-tree test-coverage - -# Tools - -TOOLS = $(CURDIR)/.tools - -$(TOOLS): - @mkdir -p $@ -$(TOOLS)/%: | $(TOOLS) - cd $(TOOLS_MOD_DIR) && \ - $(GO) build -o $@ $(PACKAGE) - -MULTIMOD = $(TOOLS)/multimod -$(TOOLS)/multimod: PACKAGE=go.opentelemetry.io/build-tools/multimod - -SEMCONVGEN = $(TOOLS)/semconvgen -$(TOOLS)/semconvgen: PACKAGE=go.opentelemetry.io/build-tools/semconvgen - -CROSSLINK = $(TOOLS)/crosslink -$(TOOLS)/crosslink: PACKAGE=go.opentelemetry.io/build-tools/crosslink - -SEMCONVKIT = $(TOOLS)/semconvkit -$(TOOLS)/semconvkit: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/semconvkit - -DBOTCONF = $(TOOLS)/dbotconf -$(TOOLS)/dbotconf: PACKAGE=go.opentelemetry.io/build-tools/dbotconf - -GOLANGCI_LINT = $(TOOLS)/golangci-lint -$(TOOLS)/golangci-lint: PACKAGE=github.com/golangci/golangci-lint/cmd/golangci-lint - -MISSPELL = $(TOOLS)/misspell -$(TOOLS)/misspell: PACKAGE=github.com/client9/misspell/cmd/misspell - -GOCOVMERGE = $(TOOLS)/gocovmerge -$(TOOLS)/gocovmerge: PACKAGE=github.com/wadey/gocovmerge - -STRINGER = $(TOOLS)/stringer -$(TOOLS)/stringer: PACKAGE=golang.org/x/tools/cmd/stringer - -PORTO = $(TOOLS)/porto -$(TOOLS)/porto: PACKAGE=github.com/jcchavezs/porto/cmd/porto - -GOJQ = $(TOOLS)/gojq -$(TOOLS)/gojq: PACKAGE=github.com/itchyny/gojq/cmd/gojq - -GOTMPL = $(TOOLS)/gotmpl -$(GOTMPL): PACKAGE=go.opentelemetry.io/build-tools/gotmpl - -GORELEASE = $(TOOLS)/gorelease -$(GORELEASE): PACKAGE=golang.org/x/exp/cmd/gorelease - -GOVULNCHECK = $(TOOLS)/govulncheck -$(TOOLS)/govulncheck: PACKAGE=golang.org/x/vuln/cmd/govulncheck - -.PHONY: tools -tools: $(CROSSLINK) $(DBOTCONF) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(GOJQ) $(SEMCONVGEN) $(MULTIMOD) $(SEMCONVKIT) $(GOTMPL) $(GORELEASE) - -# Virtualized python tools via docker - -# The directory where the virtual environment is created. -VENVDIR := venv - -# The directory where the python tools are installed. -PYTOOLS := $(VENVDIR)/bin - -# The pip executable in the virtual environment. -PIP := $(PYTOOLS)/pip - -# The directory in the docker image where the current directory is mounted. -WORKDIR := /workdir - -# The python image to use for the virtual environment. -PYTHONIMAGE := python:3.11.3-slim-bullseye - -# Run the python image with the current directory mounted. -DOCKERPY := docker run --rm -v "$(CURDIR):$(WORKDIR)" -w $(WORKDIR) $(PYTHONIMAGE) - -# Create a virtual environment for Python tools. -$(PYTOOLS): -# The `--upgrade` flag is needed to ensure that the virtual environment is -# created with the latest pip version. - @$(DOCKERPY) bash -c "python3 -m venv $(VENVDIR) && $(PIP) install --upgrade pip" - -# Install python packages into the virtual environment. -$(PYTOOLS)/%: | $(PYTOOLS) - @$(DOCKERPY) $(PIP) install -r requirements.txt - -CODESPELL = $(PYTOOLS)/codespell -$(CODESPELL): PACKAGE=codespell - -# Generate - -.PHONY: generate -generate: go-generate vanity-import-fix - -.PHONY: go-generate -go-generate: $(OTEL_GO_MOD_DIRS:%=go-generate/%) -go-generate/%: DIR=$* -go-generate/%: | $(STRINGER) $(GOTMPL) - @echo "$(GO) generate $(DIR)/..." \ - && cd $(DIR) \ - && PATH="$(TOOLS):$${PATH}" $(GO) generate ./... - -.PHONY: vanity-import-fix -vanity-import-fix: | $(PORTO) - @$(PORTO) --include-internal -w . - -# Generate go.work file for local development. -.PHONY: go-work -go-work: | $(CROSSLINK) - $(CROSSLINK) work --root=$(shell pwd) - -# Build - -.PHONY: build - -build: $(OTEL_GO_MOD_DIRS:%=build/%) $(OTEL_GO_MOD_DIRS:%=build-tests/%) -build/%: DIR=$* -build/%: - @echo "$(GO) build $(DIR)/..." \ - && cd $(DIR) \ - && $(GO) build ./... - -build-tests/%: DIR=$* -build-tests/%: - @echo "$(GO) build tests $(DIR)/..." \ - && cd $(DIR) \ - && $(GO) list ./... \ - | grep -v third_party \ - | xargs $(GO) test -vet=off -run xxxxxMatchNothingxxxxx >/dev/null - -# Tests - -TEST_TARGETS := test-default test-bench test-short test-verbose test-race -.PHONY: $(TEST_TARGETS) test -test-default test-race: ARGS=-race -test-bench: ARGS=-run=xxxxxMatchNothingxxxxx -test.benchtime=1ms -bench=. -test-short: ARGS=-short -test-verbose: ARGS=-v -race -$(TEST_TARGETS): test -test: $(OTEL_GO_MOD_DIRS:%=test/%) -test/%: DIR=$* -test/%: - @echo "$(GO) test -timeout $(TIMEOUT)s $(ARGS) $(DIR)/..." \ - && cd $(DIR) \ - && $(GO) list ./... \ - | grep -v third_party \ - | xargs $(GO) test -timeout $(TIMEOUT)s $(ARGS) - -COVERAGE_MODE = atomic -COVERAGE_PROFILE = coverage.out -.PHONY: test-coverage -test-coverage: | $(GOCOVMERGE) - @set -e; \ - printf "" > coverage.txt; \ - for dir in $(ALL_COVERAGE_MOD_DIRS); do \ - echo "$(GO) test -coverpkg=go.opentelemetry.io/otel/... -covermode=$(COVERAGE_MODE) -coverprofile="$(COVERAGE_PROFILE)" $${dir}/..."; \ - (cd "$${dir}" && \ - $(GO) list ./... \ - | grep -v third_party \ - | grep -v 'semconv/v.*' \ - | xargs $(GO) test -coverpkg=./... -covermode=$(COVERAGE_MODE) -coverprofile="$(COVERAGE_PROFILE)" && \ - $(GO) tool cover -html=coverage.out -o coverage.html); \ - done; \ - $(GOCOVMERGE) $$(find . -name coverage.out) > coverage.txt - -# Adding a directory will include all benchmarks in that directory if a filter is not specified. -BENCHMARK_TARGETS := sdk/trace -.PHONY: benchmark -benchmark: $(BENCHMARK_TARGETS:%=benchmark/%) -BENCHMARK_FILTER = . -# You can override the filter for a particular directory by adding a rule here. -benchmark/sdk/trace: BENCHMARK_FILTER = SpanWithAttributes_8/AlwaysSample -benchmark/%: - @echo "$(GO) test -timeout $(TIMEOUT)s -run=xxxxxMatchNothingxxxxx -bench=$(BENCHMARK_FILTER) $*..." \ - && cd $* \ - $(foreach filter, $(BENCHMARK_FILTER), && $(GO) test -timeout $(TIMEOUT)s -run=xxxxxMatchNothingxxxxx -bench=$(filter)) - -.PHONY: golangci-lint golangci-lint-fix -golangci-lint-fix: ARGS=--fix -golangci-lint-fix: golangci-lint -golangci-lint: $(OTEL_GO_MOD_DIRS:%=golangci-lint/%) -golangci-lint/%: DIR=$* -golangci-lint/%: | $(GOLANGCI_LINT) - @echo 'golangci-lint $(if $(ARGS),$(ARGS) ,)$(DIR)' \ - && cd $(DIR) \ - && $(GOLANGCI_LINT) run --allow-serial-runners $(ARGS) - -.PHONY: crosslink -crosslink: | $(CROSSLINK) - @echo "Updating intra-repository dependencies in all go modules" \ - && $(CROSSLINK) --root=$(shell pwd) --prune - -.PHONY: go-mod-tidy -go-mod-tidy: $(ALL_GO_MOD_DIRS:%=go-mod-tidy/%) -go-mod-tidy/%: DIR=$* -go-mod-tidy/%: | crosslink - @echo "$(GO) mod tidy in $(DIR)" \ - && cd $(DIR) \ - && $(GO) mod tidy -compat=1.20 - -.PHONY: lint-modules -lint-modules: go-mod-tidy - -.PHONY: lint -lint: misspell lint-modules golangci-lint govulncheck - -.PHONY: vanity-import-check -vanity-import-check: | $(PORTO) - @$(PORTO) --include-internal -l . || ( echo "(run: make vanity-import-fix)"; exit 1 ) - -.PHONY: misspell -misspell: | $(MISSPELL) - @$(MISSPELL) -w $(ALL_DOCS) - -.PHONY: govulncheck -govulncheck: $(OTEL_GO_MOD_DIRS:%=govulncheck/%) -govulncheck/%: DIR=$* -govulncheck/%: | $(GOVULNCHECK) - @echo "govulncheck ./... in $(DIR)" \ - && cd $(DIR) \ - && $(GOVULNCHECK) ./... - -.PHONY: codespell -codespell: | $(CODESPELL) - @$(DOCKERPY) $(CODESPELL) - -.PHONY: license-check -license-check: - @licRes=$$(for f in $$(find . -type f \( -iname '*.go' -o -iname '*.sh' \) ! -path '**/third_party/*' ! -path './.git/*' ) ; do \ - awk '/Copyright The OpenTelemetry Authors|generated|GENERATED/ && NR<=4 { found=1; next } END { if (!found) print FILENAME }' $$f; \ - done); \ - if [ -n "$${licRes}" ]; then \ - echo "license header checking failed:"; echo "$${licRes}"; \ - exit 1; \ - fi - -DEPENDABOT_CONFIG = .github/dependabot.yml -.PHONY: dependabot-check -dependabot-check: | $(DBOTCONF) - @$(DBOTCONF) verify $(DEPENDABOT_CONFIG) || ( echo "(run: make dependabot-generate)"; exit 1 ) - -.PHONY: dependabot-generate -dependabot-generate: | $(DBOTCONF) - @$(DBOTCONF) generate > $(DEPENDABOT_CONFIG) - -.PHONY: check-clean-work-tree -check-clean-work-tree: - @if ! git diff --quiet; then \ - echo; \ - echo 'Working tree is not clean, did you forget to run "make precommit"?'; \ - echo; \ - git status; \ - exit 1; \ - fi - -SEMCONVPKG ?= "semconv/" -.PHONY: semconv-generate -semconv-generate: | $(SEMCONVGEN) $(SEMCONVKIT) - [ "$(TAG)" ] || ( echo "TAG unset: missing opentelemetry semantic-conventions tag"; exit 1 ) - [ "$(OTEL_SEMCONV_REPO)" ] || ( echo "OTEL_SEMCONV_REPO unset: missing path to opentelemetry semantic-conventions repo"; exit 1 ) - $(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=span -p conventionType=trace -f trace.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" - $(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=attribute_group -p conventionType=trace -f attribute_group.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" - $(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=event -p conventionType=event -f event.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" - $(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=resource -p conventionType=resource -f resource.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" - $(SEMCONVKIT) -output "$(SEMCONVPKG)/$(TAG)" -tag "$(TAG)" - -.PHONY: gorelease -gorelease: $(OTEL_GO_MOD_DIRS:%=gorelease/%) -gorelease/%: DIR=$* -gorelease/%:| $(GORELEASE) - @echo "gorelease in $(DIR):" \ - && cd $(DIR) \ - && $(GORELEASE) \ - || echo "" - -.PHONY: prerelease -prerelease: | $(MULTIMOD) - @[ "${MODSET}" ] || ( echo ">> env var MODSET is not set"; exit 1 ) - $(MULTIMOD) verify && $(MULTIMOD) prerelease -m ${MODSET} - -COMMIT ?= "HEAD" -.PHONY: add-tags -add-tags: | $(MULTIMOD) - @[ "${MODSET}" ] || ( echo ">> env var MODSET is not set"; exit 1 ) - $(MULTIMOD) verify && $(MULTIMOD) tag -m ${MODSET} -c ${COMMIT} - -.PHONY: lint-markdown -lint-markdown: - docker run -v "$(CURDIR):$(WORKDIR)" avtodev/markdown-lint:v1 -c $(WORKDIR)/.markdownlint.yaml $(WORKDIR)/**/*.md diff --git a/vendor/go.opentelemetry.io/otel/README.md b/vendor/go.opentelemetry.io/otel/README.md deleted file mode 100644 index 7766259a..00000000 --- a/vendor/go.opentelemetry.io/otel/README.md +++ /dev/null @@ -1,112 +0,0 @@ -# OpenTelemetry-Go - -[![CI](https://github.com/open-telemetry/opentelemetry-go/workflows/ci/badge.svg)](https://github.com/open-telemetry/opentelemetry-go/actions?query=workflow%3Aci+branch%3Amain) -[![codecov.io](https://codecov.io/gh/open-telemetry/opentelemetry-go/coverage.svg?branch=main)](https://app.codecov.io/gh/open-telemetry/opentelemetry-go?branch=main) -[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel)](https://pkg.go.dev/go.opentelemetry.io/otel) -[![Go Report Card](https://goreportcard.com/badge/go.opentelemetry.io/otel)](https://goreportcard.com/report/go.opentelemetry.io/otel) -[![Slack](https://img.shields.io/badge/slack-@cncf/otel--go-brightgreen.svg?logo=slack)](https://cloud-native.slack.com/archives/C01NPAXACKT) - -OpenTelemetry-Go is the [Go](https://golang.org/) implementation of [OpenTelemetry](https://opentelemetry.io/). -It provides a set of APIs to directly measure performance and behavior of your software and send this data to observability platforms. - -## Project Status - -| Signal | Status | -|---------|--------------------| -| Traces | Stable | -| Metrics | Stable | -| Logs | In development[^1] | - -Progress and status specific to this repository is tracked in our -[project boards](https://github.com/open-telemetry/opentelemetry-go/projects) -and -[milestones](https://github.com/open-telemetry/opentelemetry-go/milestones). - -Project versioning information and stability guarantees can be found in the -[versioning documentation](VERSIONING.md). - -[^1]: https://github.com/orgs/open-telemetry/projects/43 - -### Compatibility - -OpenTelemetry-Go ensures compatibility with the current supported versions of -the [Go language](https://golang.org/doc/devel/release#policy): - -> Each major Go release is supported until there are two newer major releases. -> For example, Go 1.5 was supported until the Go 1.7 release, and Go 1.6 was supported until the Go 1.8 release. - -For versions of Go that are no longer supported upstream, opentelemetry-go will -stop ensuring compatibility with these versions in the following manner: - -- A minor release of opentelemetry-go will be made to add support for the new - supported release of Go. -- The following minor release of opentelemetry-go will remove compatibility - testing for the oldest (now archived upstream) version of Go. This, and - future, releases of opentelemetry-go may include features only supported by - the currently supported versions of Go. - -Currently, this project supports the following environments. - -| OS | Go Version | Architecture | -|---------|------------|--------------| -| Ubuntu | 1.22 | amd64 | -| Ubuntu | 1.21 | amd64 | -| Ubuntu | 1.20 | amd64 | -| Ubuntu | 1.22 | 386 | -| Ubuntu | 1.21 | 386 | -| Ubuntu | 1.20 | 386 | -| MacOS | 1.22 | amd64 | -| MacOS | 1.21 | amd64 | -| MacOS | 1.20 | amd64 | -| Windows | 1.22 | amd64 | -| Windows | 1.21 | amd64 | -| Windows | 1.20 | amd64 | -| Windows | 1.22 | 386 | -| Windows | 1.21 | 386 | -| Windows | 1.20 | 386 | - -While this project should work for other systems, no compatibility guarantees -are made for those systems currently. - -## Getting Started - -You can find a getting started guide on [opentelemetry.io](https://opentelemetry.io/docs/languages/go/getting-started/). - -OpenTelemetry's goal is to provide a single set of APIs to capture distributed -traces and metrics from your application and send them to an observability -platform. This project allows you to do just that for applications written in -Go. There are two steps to this process: instrument your application, and -configure an exporter. - -### Instrumentation - -To start capturing distributed traces and metric events from your application -it first needs to be instrumented. The easiest way to do this is by using an -instrumentation library for your code. Be sure to check out [the officially -supported instrumentation -libraries](https://github.com/open-telemetry/opentelemetry-go-contrib/tree/main/instrumentation). - -If you need to extend the telemetry an instrumentation library provides or want -to build your own instrumentation for your application directly you will need -to use the -[Go otel](https://pkg.go.dev/go.opentelemetry.io/otel) -package. The included [examples](./example/) are a good way to see some -practical uses of this process. - -### Export - -Now that your application is instrumented to collect telemetry, it needs an -export pipeline to send that telemetry to an observability platform. - -All officially supported exporters for the OpenTelemetry project are contained in the [exporters directory](./exporters). - -| Exporter | Metrics | Traces | -|---------------------------------------|:-------:|:------:| -| [OTLP](./exporters/otlp/) | ✓ | ✓ | -| [Prometheus](./exporters/prometheus/) | ✓ | | -| [stdout](./exporters/stdout/) | ✓ | ✓ | -| [Zipkin](./exporters/zipkin/) | | ✓ | - -## Contributing - -See the [contributing documentation](CONTRIBUTING.md). diff --git a/vendor/go.opentelemetry.io/otel/RELEASING.md b/vendor/go.opentelemetry.io/otel/RELEASING.md deleted file mode 100644 index d2691d0b..00000000 --- a/vendor/go.opentelemetry.io/otel/RELEASING.md +++ /dev/null @@ -1,139 +0,0 @@ -# Release Process - -## Semantic Convention Generation - -New versions of the [OpenTelemetry Semantic Conventions] mean new versions of the `semconv` package need to be generated. -The `semconv-generate` make target is used for this. - -1. Checkout a local copy of the [OpenTelemetry Semantic Conventions] to the desired release tag. -2. Pull the latest `otel/semconvgen` image: `docker pull otel/semconvgen:latest` -3. Run the `make semconv-generate ...` target from this repository. - -For example, - -```sh -export TAG="v1.21.0" # Change to the release version you are generating. -export OTEL_SEMCONV_REPO="/absolute/path/to/opentelemetry/semantic-conventions" -docker pull otel/semconvgen:latest -make semconv-generate # Uses the exported TAG and OTEL_SEMCONV_REPO. -``` - -This should create a new sub-package of [`semconv`](./semconv). -Ensure things look correct before submitting a pull request to include the addition. - -## Breaking changes validation - -You can run `make gorelease` that runs [gorelease](https://pkg.go.dev/golang.org/x/exp/cmd/gorelease) to ensure that there are no unwanted changes done in the public API. - -You can check/report problems with `gorelease` [here](https://golang.org/issues/26420). - -## Pre-Release - -First, decide which module sets will be released and update their versions -in `versions.yaml`. Commit this change to a new branch. - -Update go.mod for submodules to depend on the new release which will happen in the next step. - -1. Run the `prerelease` make target. It creates a branch - `prerelease__` that will contain all release changes. - - ``` - make prerelease MODSET= - ``` - -2. Verify the changes. - - ``` - git diff ...prerelease__ - ``` - - This should have changed the version for all modules to be ``. - If these changes look correct, merge them into your pre-release branch: - - ```go - git merge prerelease__ - ``` - -3. Update the [Changelog](./CHANGELOG.md). - - Make sure all relevant changes for this release are included and are in language that non-contributors to the project can understand. - To verify this, you can look directly at the commits since the ``. - - ``` - git --no-pager log --pretty=oneline "..HEAD" - ``` - - - Move all the `Unreleased` changes into a new section following the title scheme (`[] - `). - - Update all the appropriate links at the bottom. - -4. Push the changes to upstream and create a Pull Request on GitHub. - Be sure to include the curated changes from the [Changelog](./CHANGELOG.md) in the description. - -## Tag - -Once the Pull Request with all the version changes has been approved and merged it is time to tag the merged commit. - -***IMPORTANT***: It is critical you use the same tag that you used in the Pre-Release step! -Failure to do so will leave things in a broken state. As long as you do not -change `versions.yaml` between pre-release and this step, things should be fine. - -***IMPORTANT***: [There is currently no way to remove an incorrectly tagged version of a Go module](https://github.com/golang/go/issues/34189). -It is critical you make sure the version you push upstream is correct. -[Failure to do so will lead to minor emergencies and tough to work around](https://github.com/open-telemetry/opentelemetry-go/issues/331). - -1. For each module set that will be released, run the `add-tags` make target - using the `` of the commit on the main branch for the merged Pull Request. - - ``` - make add-tags MODSET= COMMIT= - ``` - - It should only be necessary to provide an explicit `COMMIT` value if the - current `HEAD` of your working directory is not the correct commit. - -2. Push tags to the upstream remote (not your fork: `github.com/open-telemetry/opentelemetry-go.git`). - Make sure you push all sub-modules as well. - - ``` - git push upstream - git push upstream - ... - ``` - -## Release - -Finally create a Release for the new `` on GitHub. -The release body should include all the release notes from the Changelog for this release. - -## Verify Examples - -After releasing verify that examples build outside of the repository. - -``` -./verify_examples.sh -``` - -The script copies examples into a different directory removes any `replace` declarations in `go.mod` and builds them. -This ensures they build with the published release, not the local copy. - -## Post-Release - -### Contrib Repository - -Once verified be sure to [make a release for the `contrib` repository](https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/RELEASING.md) that uses this release. - -### Website Documentation - -Update the [Go instrumentation documentation] in the OpenTelemetry website under [content/en/docs/languages/go]. -Importantly, bump any package versions referenced to be the latest one you just released and ensure all code examples still compile and are accurate. - -[OpenTelemetry Semantic Conventions]: https://github.com/open-telemetry/semantic-conventions -[Go instrumentation documentation]: https://opentelemetry.io/docs/languages/go/ -[content/en/docs/languages/go]: https://github.com/open-telemetry/opentelemetry.io/tree/main/content/en/docs/languages/go - -### Demo Repository - -Bump the dependencies in the following Go services: - -- [`accountingservice`](https://github.com/open-telemetry/opentelemetry-demo/tree/main/src/accountingservice) -- [`checkoutservice`](https://github.com/open-telemetry/opentelemetry-demo/tree/main/src/checkoutservice) -- [`productcatalogservice`](https://github.com/open-telemetry/opentelemetry-demo/tree/main/src/productcatalogservice) diff --git a/vendor/go.opentelemetry.io/otel/VERSIONING.md b/vendor/go.opentelemetry.io/otel/VERSIONING.md deleted file mode 100644 index 412f1e36..00000000 --- a/vendor/go.opentelemetry.io/otel/VERSIONING.md +++ /dev/null @@ -1,224 +0,0 @@ -# Versioning - -This document describes the versioning policy for this repository. This policy -is designed so the following goals can be achieved. - -**Users are provided a codebase of value that is stable and secure.** - -## Policy - -* Versioning of this project will be idiomatic of a Go project using [Go - modules](https://github.com/golang/go/wiki/Modules). - * [Semantic import - versioning](https://github.com/golang/go/wiki/Modules#semantic-import-versioning) - will be used. - * Versions will comply with [semver - 2.0](https://semver.org/spec/v2.0.0.html) with the following exceptions. - * New methods may be added to exported API interfaces. All exported - interfaces that fall within this exception will include the following - paragraph in their public documentation. - - > Warning: methods may be added to this interface in minor releases. - - * If a module is version `v2` or higher, the major version of the module - must be included as a `/vN` at the end of the module paths used in - `go.mod` files (e.g., `module go.opentelemetry.io/otel/v2`, `require - go.opentelemetry.io/otel/v2 v2.0.1`) and in the package import path - (e.g., `import "go.opentelemetry.io/otel/v2/trace"`). This includes the - paths used in `go get` commands (e.g., `go get - go.opentelemetry.io/otel/v2@v2.0.1`. Note there is both a `/v2` and a - `@v2.0.1` in that example. One way to think about it is that the module - name now includes the `/v2`, so include `/v2` whenever you are using the - module name). - * If a module is version `v0` or `v1`, do not include the major version in - either the module path or the import path. - * Modules will be used to encapsulate signals and components. - * Experimental modules still under active development will be versioned at - `v0` to imply the stability guarantee defined by - [semver](https://semver.org/spec/v2.0.0.html#spec-item-4). - - > Major version zero (0.y.z) is for initial development. Anything MAY - > change at any time. The public API SHOULD NOT be considered stable. - - * Mature modules for which we guarantee a stable public API will be versioned - with a major version greater than `v0`. - * The decision to make a module stable will be made on a case-by-case - basis by the maintainers of this project. - * Experimental modules will start their versioning at `v0.0.0` and will - increment their minor version when backwards incompatible changes are - released and increment their patch version when backwards compatible - changes are released. - * All stable modules that use the same major version number will use the - same entire version number. - * Stable modules may be released with an incremented minor or patch - version even though that module has not been changed, but rather so - that it will remain at the same version as other stable modules that - did undergo change. - * When an experimental module becomes stable a new stable module version - will be released and will include this now stable module. The new - stable module version will be an increment of the minor version number - and will be applied to all existing stable modules as well as the newly - stable module being released. -* Versioning of the associated [contrib - repository](https://github.com/open-telemetry/opentelemetry-go-contrib) of - this project will be idiomatic of a Go project using [Go - modules](https://github.com/golang/go/wiki/Modules). - * [Semantic import - versioning](https://github.com/golang/go/wiki/Modules#semantic-import-versioning) - will be used. - * Versions will comply with [semver 2.0](https://semver.org/spec/v2.0.0.html). - * If a module is version `v2` or higher, the - major version of the module must be included as a `/vN` at the end of the - module paths used in `go.mod` files (e.g., `module - go.opentelemetry.io/contrib/instrumentation/host/v2`, `require - go.opentelemetry.io/contrib/instrumentation/host/v2 v2.0.1`) and in the - package import path (e.g., `import - "go.opentelemetry.io/contrib/instrumentation/host/v2"`). This includes - the paths used in `go get` commands (e.g., `go get - go.opentelemetry.io/contrib/instrumentation/host/v2@v2.0.1`. Note there - is both a `/v2` and a `@v2.0.1` in that example. One way to think about - it is that the module name now includes the `/v2`, so include `/v2` - whenever you are using the module name). - * If a module is version `v0` or `v1`, do not include the major version - in either the module path or the import path. - * In addition to public APIs, telemetry produced by stable instrumentation - will remain stable and backwards compatible. This is to avoid breaking - alerts and dashboard. - * Modules will be used to encapsulate instrumentation, detectors, exporters, - propagators, and any other independent sets of related components. - * Experimental modules still under active development will be versioned at - `v0` to imply the stability guarantee defined by - [semver](https://semver.org/spec/v2.0.0.html#spec-item-4). - - > Major version zero (0.y.z) is for initial development. Anything MAY - > change at any time. The public API SHOULD NOT be considered stable. - - * Mature modules for which we guarantee a stable public API and telemetry will - be versioned with a major version greater than `v0`. - * Experimental modules will start their versioning at `v0.0.0` and will - increment their minor version when backwards incompatible changes are - released and increment their patch version when backwards compatible - changes are released. - * Stable contrib modules cannot depend on experimental modules from this - project. - * All stable contrib modules of the same major version with this project - will use the same entire version as this project. - * Stable modules may be released with an incremented minor or patch - version even though that module's code has not been changed. Instead - the only change that will have been included is to have updated that - modules dependency on this project's stable APIs. - * When an experimental module in contrib becomes stable a new stable - module version will be released and will include this now stable - module. The new stable module version will be an increment of the minor - version number and will be applied to all existing stable contrib - modules, this project's modules, and the newly stable module being - released. - * Contrib modules will be kept up to date with this project's releases. - * Due to the dependency contrib modules will implicitly have on this - project's modules the release of stable contrib modules to match the - released version number will be staggered after this project's release. - There is no explicit time guarantee for how long after this projects - release the contrib release will be. Effort should be made to keep them - as close in time as possible. - * No additional stable release in this project can be made until the - contrib repository has a matching stable release. - * No release can be made in the contrib repository after this project's - stable release except for a stable release of the contrib repository. -* GitHub releases will be made for all releases. -* Go modules will be made available at Go package mirrors. - -## Example Versioning Lifecycle - -To better understand the implementation of the above policy the following -example is provided. This project is simplified to include only the following -modules and their versions: - -* `otel`: `v0.14.0` -* `otel/trace`: `v0.14.0` -* `otel/metric`: `v0.14.0` -* `otel/baggage`: `v0.14.0` -* `otel/sdk/trace`: `v0.14.0` -* `otel/sdk/metric`: `v0.14.0` - -These modules have been developed to a point where the `otel/trace`, -`otel/baggage`, and `otel/sdk/trace` modules have reached a point that they -should be considered for a stable release. The `otel/metric` and -`otel/sdk/metric` are still under active development and the `otel` module -depends on both `otel/trace` and `otel/metric`. - -The `otel` package is refactored to remove its dependencies on `otel/metric` so -it can be released as stable as well. With that done the following release -candidates are made: - -* `otel`: `v1.0.0-RC1` -* `otel/trace`: `v1.0.0-RC1` -* `otel/baggage`: `v1.0.0-RC1` -* `otel/sdk/trace`: `v1.0.0-RC1` - -The `otel/metric` and `otel/sdk/metric` modules remain at `v0.14.0`. - -A few minor issues are discovered in the `otel/trace` package. These issues are -resolved with some minor, but backwards incompatible, changes and are released -as a second release candidate: - -* `otel`: `v1.0.0-RC2` -* `otel/trace`: `v1.0.0-RC2` -* `otel/baggage`: `v1.0.0-RC2` -* `otel/sdk/trace`: `v1.0.0-RC2` - -Notice that all module version numbers are incremented to adhere to our -versioning policy. - -After these release candidates have been evaluated to satisfaction, they are -released as version `v1.0.0`. - -* `otel`: `v1.0.0` -* `otel/trace`: `v1.0.0` -* `otel/baggage`: `v1.0.0` -* `otel/sdk/trace`: `v1.0.0` - -Since both the `go` utility and the Go module system support [the semantic -versioning definition of -precedence](https://semver.org/spec/v2.0.0.html#spec-item-11), this release -will correctly be interpreted as the successor to the previous release -candidates. - -Active development of this project continues. The `otel/metric` module now has -backwards incompatible changes to its API that need to be released and the -`otel/baggage` module has a minor bug fix that needs to be released. The -following release is made: - -* `otel`: `v1.0.1` -* `otel/trace`: `v1.0.1` -* `otel/metric`: `v0.15.0` -* `otel/baggage`: `v1.0.1` -* `otel/sdk/trace`: `v1.0.1` -* `otel/sdk/metric`: `v0.15.0` - -Notice that, again, all stable module versions are incremented in unison and -the `otel/sdk/metric` package, which depends on the `otel/metric` package, also -bumped its version. This bump of the `otel/sdk/metric` package makes sense -given their coupling, though it is not explicitly required by our versioning -policy. - -As we progress, the `otel/metric` and `otel/sdk/metric` packages have reached a -point where they should be evaluated for stability. The `otel` module is -reintegrated with the `otel/metric` package and the following release is made: - -* `otel`: `v1.1.0-RC1` -* `otel/trace`: `v1.1.0-RC1` -* `otel/metric`: `v1.1.0-RC1` -* `otel/baggage`: `v1.1.0-RC1` -* `otel/sdk/trace`: `v1.1.0-RC1` -* `otel/sdk/metric`: `v1.1.0-RC1` - -All the modules are evaluated and determined to a viable stable release. They -are then released as version `v1.1.0` (the minor version is incremented to -indicate the addition of new signal). - -* `otel`: `v1.1.0` -* `otel/trace`: `v1.1.0` -* `otel/metric`: `v1.1.0` -* `otel/baggage`: `v1.1.0` -* `otel/sdk/trace`: `v1.1.0` -* `otel/sdk/metric`: `v1.1.0` diff --git a/vendor/go.opentelemetry.io/otel/attribute/doc.go b/vendor/go.opentelemetry.io/otel/attribute/doc.go deleted file mode 100644 index dafe7424..00000000 --- a/vendor/go.opentelemetry.io/otel/attribute/doc.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -// Package attribute provides key and value attributes. -package attribute // import "go.opentelemetry.io/otel/attribute" diff --git a/vendor/go.opentelemetry.io/otel/attribute/encoder.go b/vendor/go.opentelemetry.io/otel/attribute/encoder.go deleted file mode 100644 index fe2bc576..00000000 --- a/vendor/go.opentelemetry.io/otel/attribute/encoder.go +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package attribute // import "go.opentelemetry.io/otel/attribute" - -import ( - "bytes" - "sync" - "sync/atomic" -) - -type ( - // Encoder is a mechanism for serializing an attribute set into a specific - // string representation that supports caching, to avoid repeated - // serialization. An example could be an exporter encoding the attribute - // set into a wire representation. - Encoder interface { - // Encode returns the serialized encoding of the attribute set using - // its Iterator. This result may be cached by a attribute.Set. - Encode(iterator Iterator) string - - // ID returns a value that is unique for each class of attribute - // encoder. Attribute encoders allocate these using `NewEncoderID`. - ID() EncoderID - } - - // EncoderID is used to identify distinct Encoder - // implementations, for caching encoded results. - EncoderID struct { - value uint64 - } - - // defaultAttrEncoder uses a sync.Pool of buffers to reduce the number of - // allocations used in encoding attributes. This implementation encodes a - // comma-separated list of key=value, with '/'-escaping of '=', ',', and - // '\'. - defaultAttrEncoder struct { - // pool is a pool of attribute set builders. The buffers in this pool - // grow to a size that most attribute encodings will not allocate new - // memory. - pool sync.Pool // *bytes.Buffer - } -) - -// escapeChar is used to ensure uniqueness of the attribute encoding where -// keys or values contain either '=' or ','. Since there is no parser needed -// for this encoding and its only requirement is to be unique, this choice is -// arbitrary. Users will see these in some exporters (e.g., stdout), so the -// backslash ('\') is used as a conventional choice. -const escapeChar = '\\' - -var ( - _ Encoder = &defaultAttrEncoder{} - - // encoderIDCounter is for generating IDs for other attribute encoders. - encoderIDCounter uint64 - - defaultEncoderOnce sync.Once - defaultEncoderID = NewEncoderID() - defaultEncoderInstance *defaultAttrEncoder -) - -// NewEncoderID returns a unique attribute encoder ID. It should be called -// once per each type of attribute encoder. Preferably in init() or in var -// definition. -func NewEncoderID() EncoderID { - return EncoderID{value: atomic.AddUint64(&encoderIDCounter, 1)} -} - -// DefaultEncoder returns an attribute encoder that encodes attributes in such -// a way that each escaped attribute's key is followed by an equal sign and -// then by an escaped attribute's value. All key-value pairs are separated by -// a comma. -// -// Escaping is done by prepending a backslash before either a backslash, equal -// sign or a comma. -func DefaultEncoder() Encoder { - defaultEncoderOnce.Do(func() { - defaultEncoderInstance = &defaultAttrEncoder{ - pool: sync.Pool{ - New: func() interface{} { - return &bytes.Buffer{} - }, - }, - } - }) - return defaultEncoderInstance -} - -// Encode is a part of an implementation of the AttributeEncoder interface. -func (d *defaultAttrEncoder) Encode(iter Iterator) string { - buf := d.pool.Get().(*bytes.Buffer) - defer d.pool.Put(buf) - buf.Reset() - - for iter.Next() { - i, keyValue := iter.IndexedAttribute() - if i > 0 { - _, _ = buf.WriteRune(',') - } - copyAndEscape(buf, string(keyValue.Key)) - - _, _ = buf.WriteRune('=') - - if keyValue.Value.Type() == STRING { - copyAndEscape(buf, keyValue.Value.AsString()) - } else { - _, _ = buf.WriteString(keyValue.Value.Emit()) - } - } - return buf.String() -} - -// ID is a part of an implementation of the AttributeEncoder interface. -func (*defaultAttrEncoder) ID() EncoderID { - return defaultEncoderID -} - -// copyAndEscape escapes `=`, `,` and its own escape character (`\`), -// making the default encoding unique. -func copyAndEscape(buf *bytes.Buffer, val string) { - for _, ch := range val { - switch ch { - case '=', ',', escapeChar: - _, _ = buf.WriteRune(escapeChar) - } - _, _ = buf.WriteRune(ch) - } -} - -// Valid returns true if this encoder ID was allocated by -// `NewEncoderID`. Invalid encoder IDs will not be cached. -func (id EncoderID) Valid() bool { - return id.value != 0 -} diff --git a/vendor/go.opentelemetry.io/otel/attribute/filter.go b/vendor/go.opentelemetry.io/otel/attribute/filter.go deleted file mode 100644 index 638c213d..00000000 --- a/vendor/go.opentelemetry.io/otel/attribute/filter.go +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package attribute // import "go.opentelemetry.io/otel/attribute" - -// Filter supports removing certain attributes from attribute sets. When -// the filter returns true, the attribute will be kept in the filtered -// attribute set. When the filter returns false, the attribute is excluded -// from the filtered attribute set, and the attribute instead appears in -// the removed list of excluded attributes. -type Filter func(KeyValue) bool - -// NewAllowKeysFilter returns a Filter that only allows attributes with one of -// the provided keys. -// -// If keys is empty a deny-all filter is returned. -func NewAllowKeysFilter(keys ...Key) Filter { - if len(keys) <= 0 { - return func(kv KeyValue) bool { return false } - } - - allowed := make(map[Key]struct{}) - for _, k := range keys { - allowed[k] = struct{}{} - } - return func(kv KeyValue) bool { - _, ok := allowed[kv.Key] - return ok - } -} - -// NewDenyKeysFilter returns a Filter that only allows attributes -// that do not have one of the provided keys. -// -// If keys is empty an allow-all filter is returned. -func NewDenyKeysFilter(keys ...Key) Filter { - if len(keys) <= 0 { - return func(kv KeyValue) bool { return true } - } - - forbid := make(map[Key]struct{}) - for _, k := range keys { - forbid[k] = struct{}{} - } - return func(kv KeyValue) bool { - _, ok := forbid[kv.Key] - return !ok - } -} diff --git a/vendor/go.opentelemetry.io/otel/attribute/iterator.go b/vendor/go.opentelemetry.io/otel/attribute/iterator.go deleted file mode 100644 index 841b271f..00000000 --- a/vendor/go.opentelemetry.io/otel/attribute/iterator.go +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package attribute // import "go.opentelemetry.io/otel/attribute" - -// Iterator allows iterating over the set of attributes in order, sorted by -// key. -type Iterator struct { - storage *Set - idx int -} - -// MergeIterator supports iterating over two sets of attributes while -// eliminating duplicate values from the combined set. The first iterator -// value takes precedence. -type MergeIterator struct { - one oneIterator - two oneIterator - current KeyValue -} - -type oneIterator struct { - iter Iterator - done bool - attr KeyValue -} - -// Next moves the iterator to the next position. Returns false if there are no -// more attributes. -func (i *Iterator) Next() bool { - i.idx++ - return i.idx < i.Len() -} - -// Label returns current KeyValue. Must be called only after Next returns -// true. -// -// Deprecated: Use Attribute instead. -func (i *Iterator) Label() KeyValue { - return i.Attribute() -} - -// Attribute returns the current KeyValue of the Iterator. It must be called -// only after Next returns true. -func (i *Iterator) Attribute() KeyValue { - kv, _ := i.storage.Get(i.idx) - return kv -} - -// IndexedLabel returns current index and attribute. Must be called only -// after Next returns true. -// -// Deprecated: Use IndexedAttribute instead. -func (i *Iterator) IndexedLabel() (int, KeyValue) { - return i.idx, i.Attribute() -} - -// IndexedAttribute returns current index and attribute. Must be called only -// after Next returns true. -func (i *Iterator) IndexedAttribute() (int, KeyValue) { - return i.idx, i.Attribute() -} - -// Len returns a number of attributes in the iterated set. -func (i *Iterator) Len() int { - return i.storage.Len() -} - -// ToSlice is a convenience function that creates a slice of attributes from -// the passed iterator. The iterator is set up to start from the beginning -// before creating the slice. -func (i *Iterator) ToSlice() []KeyValue { - l := i.Len() - if l == 0 { - return nil - } - i.idx = -1 - slice := make([]KeyValue, 0, l) - for i.Next() { - slice = append(slice, i.Attribute()) - } - return slice -} - -// NewMergeIterator returns a MergeIterator for merging two attribute sets. -// Duplicates are resolved by taking the value from the first set. -func NewMergeIterator(s1, s2 *Set) MergeIterator { - mi := MergeIterator{ - one: makeOne(s1.Iter()), - two: makeOne(s2.Iter()), - } - return mi -} - -func makeOne(iter Iterator) oneIterator { - oi := oneIterator{ - iter: iter, - } - oi.advance() - return oi -} - -func (oi *oneIterator) advance() { - if oi.done = !oi.iter.Next(); !oi.done { - oi.attr = oi.iter.Attribute() - } -} - -// Next returns true if there is another attribute available. -func (m *MergeIterator) Next() bool { - if m.one.done && m.two.done { - return false - } - if m.one.done { - m.current = m.two.attr - m.two.advance() - return true - } - if m.two.done { - m.current = m.one.attr - m.one.advance() - return true - } - if m.one.attr.Key == m.two.attr.Key { - m.current = m.one.attr // first iterator attribute value wins - m.one.advance() - m.two.advance() - return true - } - if m.one.attr.Key < m.two.attr.Key { - m.current = m.one.attr - m.one.advance() - return true - } - m.current = m.two.attr - m.two.advance() - return true -} - -// Label returns the current value after Next() returns true. -// -// Deprecated: Use Attribute instead. -func (m *MergeIterator) Label() KeyValue { - return m.current -} - -// Attribute returns the current value after Next() returns true. -func (m *MergeIterator) Attribute() KeyValue { - return m.current -} diff --git a/vendor/go.opentelemetry.io/otel/attribute/key.go b/vendor/go.opentelemetry.io/otel/attribute/key.go deleted file mode 100644 index 0656a04e..00000000 --- a/vendor/go.opentelemetry.io/otel/attribute/key.go +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package attribute // import "go.opentelemetry.io/otel/attribute" - -// Key represents the key part in key-value pairs. It's a string. The -// allowed character set in the key depends on the use of the key. -type Key string - -// Bool creates a KeyValue instance with a BOOL Value. -// -// If creating both a key and value at the same time, use the provided -// convenience function instead -- Bool(name, value). -func (k Key) Bool(v bool) KeyValue { - return KeyValue{ - Key: k, - Value: BoolValue(v), - } -} - -// BoolSlice creates a KeyValue instance with a BOOLSLICE Value. -// -// If creating both a key and value at the same time, use the provided -// convenience function instead -- BoolSlice(name, value). -func (k Key) BoolSlice(v []bool) KeyValue { - return KeyValue{ - Key: k, - Value: BoolSliceValue(v), - } -} - -// Int creates a KeyValue instance with an INT64 Value. -// -// If creating both a key and value at the same time, use the provided -// convenience function instead -- Int(name, value). -func (k Key) Int(v int) KeyValue { - return KeyValue{ - Key: k, - Value: IntValue(v), - } -} - -// IntSlice creates a KeyValue instance with an INT64SLICE Value. -// -// If creating both a key and value at the same time, use the provided -// convenience function instead -- IntSlice(name, value). -func (k Key) IntSlice(v []int) KeyValue { - return KeyValue{ - Key: k, - Value: IntSliceValue(v), - } -} - -// Int64 creates a KeyValue instance with an INT64 Value. -// -// If creating both a key and value at the same time, use the provided -// convenience function instead -- Int64(name, value). -func (k Key) Int64(v int64) KeyValue { - return KeyValue{ - Key: k, - Value: Int64Value(v), - } -} - -// Int64Slice creates a KeyValue instance with an INT64SLICE Value. -// -// If creating both a key and value at the same time, use the provided -// convenience function instead -- Int64Slice(name, value). -func (k Key) Int64Slice(v []int64) KeyValue { - return KeyValue{ - Key: k, - Value: Int64SliceValue(v), - } -} - -// Float64 creates a KeyValue instance with a FLOAT64 Value. -// -// If creating both a key and value at the same time, use the provided -// convenience function instead -- Float64(name, value). -func (k Key) Float64(v float64) KeyValue { - return KeyValue{ - Key: k, - Value: Float64Value(v), - } -} - -// Float64Slice creates a KeyValue instance with a FLOAT64SLICE Value. -// -// If creating both a key and value at the same time, use the provided -// convenience function instead -- Float64(name, value). -func (k Key) Float64Slice(v []float64) KeyValue { - return KeyValue{ - Key: k, - Value: Float64SliceValue(v), - } -} - -// String creates a KeyValue instance with a STRING Value. -// -// If creating both a key and value at the same time, use the provided -// convenience function instead -- String(name, value). -func (k Key) String(v string) KeyValue { - return KeyValue{ - Key: k, - Value: StringValue(v), - } -} - -// StringSlice creates a KeyValue instance with a STRINGSLICE Value. -// -// If creating both a key and value at the same time, use the provided -// convenience function instead -- StringSlice(name, value). -func (k Key) StringSlice(v []string) KeyValue { - return KeyValue{ - Key: k, - Value: StringSliceValue(v), - } -} - -// Defined returns true for non-empty keys. -func (k Key) Defined() bool { - return len(k) != 0 -} diff --git a/vendor/go.opentelemetry.io/otel/attribute/kv.go b/vendor/go.opentelemetry.io/otel/attribute/kv.go deleted file mode 100644 index 1ddf3ce0..00000000 --- a/vendor/go.opentelemetry.io/otel/attribute/kv.go +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package attribute // import "go.opentelemetry.io/otel/attribute" - -import ( - "fmt" -) - -// KeyValue holds a key and value pair. -type KeyValue struct { - Key Key - Value Value -} - -// Valid returns if kv is a valid OpenTelemetry attribute. -func (kv KeyValue) Valid() bool { - return kv.Key.Defined() && kv.Value.Type() != INVALID -} - -// Bool creates a KeyValue with a BOOL Value type. -func Bool(k string, v bool) KeyValue { - return Key(k).Bool(v) -} - -// BoolSlice creates a KeyValue with a BOOLSLICE Value type. -func BoolSlice(k string, v []bool) KeyValue { - return Key(k).BoolSlice(v) -} - -// Int creates a KeyValue with an INT64 Value type. -func Int(k string, v int) KeyValue { - return Key(k).Int(v) -} - -// IntSlice creates a KeyValue with an INT64SLICE Value type. -func IntSlice(k string, v []int) KeyValue { - return Key(k).IntSlice(v) -} - -// Int64 creates a KeyValue with an INT64 Value type. -func Int64(k string, v int64) KeyValue { - return Key(k).Int64(v) -} - -// Int64Slice creates a KeyValue with an INT64SLICE Value type. -func Int64Slice(k string, v []int64) KeyValue { - return Key(k).Int64Slice(v) -} - -// Float64 creates a KeyValue with a FLOAT64 Value type. -func Float64(k string, v float64) KeyValue { - return Key(k).Float64(v) -} - -// Float64Slice creates a KeyValue with a FLOAT64SLICE Value type. -func Float64Slice(k string, v []float64) KeyValue { - return Key(k).Float64Slice(v) -} - -// String creates a KeyValue with a STRING Value type. -func String(k, v string) KeyValue { - return Key(k).String(v) -} - -// StringSlice creates a KeyValue with a STRINGSLICE Value type. -func StringSlice(k string, v []string) KeyValue { - return Key(k).StringSlice(v) -} - -// Stringer creates a new key-value pair with a passed name and a string -// value generated by the passed Stringer interface. -func Stringer(k string, v fmt.Stringer) KeyValue { - return Key(k).String(v.String()) -} diff --git a/vendor/go.opentelemetry.io/otel/attribute/set.go b/vendor/go.opentelemetry.io/otel/attribute/set.go deleted file mode 100644 index fb6da514..00000000 --- a/vendor/go.opentelemetry.io/otel/attribute/set.go +++ /dev/null @@ -1,452 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package attribute // import "go.opentelemetry.io/otel/attribute" - -import ( - "encoding/json" - "reflect" - "sort" - "sync" -) - -type ( - // Set is the representation for a distinct attribute set. It manages an - // immutable set of attributes, with an internal cache for storing - // attribute encodings. - // - // This type supports the Equivalent method of comparison using values of - // type Distinct. - Set struct { - equivalent Distinct - } - - // Distinct wraps a variable-size array of KeyValue, constructed with keys - // in sorted order. This can be used as a map key or for equality checking - // between Sets. - Distinct struct { - iface interface{} - } - - // Sortable implements sort.Interface, used for sorting KeyValue. This is - // an exported type to support a memory optimization. A pointer to one of - // these is needed for the call to sort.Stable(), which the caller may - // provide in order to avoid an allocation. See NewSetWithSortable(). - Sortable []KeyValue -) - -var ( - // keyValueType is used in computeDistinctReflect. - keyValueType = reflect.TypeOf(KeyValue{}) - - // emptySet is returned for empty attribute sets. - emptySet = &Set{ - equivalent: Distinct{ - iface: [0]KeyValue{}, - }, - } - - // sortables is a pool of Sortables used to create Sets with a user does - // not provide one. - sortables = sync.Pool{ - New: func() interface{} { return new(Sortable) }, - } -) - -// EmptySet returns a reference to a Set with no elements. -// -// This is a convenience provided for optimized calling utility. -func EmptySet() *Set { - return emptySet -} - -// reflectValue abbreviates reflect.ValueOf(d). -func (d Distinct) reflectValue() reflect.Value { - return reflect.ValueOf(d.iface) -} - -// Valid returns true if this value refers to a valid Set. -func (d Distinct) Valid() bool { - return d.iface != nil -} - -// Len returns the number of attributes in this set. -func (l *Set) Len() int { - if l == nil || !l.equivalent.Valid() { - return 0 - } - return l.equivalent.reflectValue().Len() -} - -// Get returns the KeyValue at ordered position idx in this set. -func (l *Set) Get(idx int) (KeyValue, bool) { - if l == nil || !l.equivalent.Valid() { - return KeyValue{}, false - } - value := l.equivalent.reflectValue() - - if idx >= 0 && idx < value.Len() { - // Note: The Go compiler successfully avoids an allocation for - // the interface{} conversion here: - return value.Index(idx).Interface().(KeyValue), true - } - - return KeyValue{}, false -} - -// Value returns the value of a specified key in this set. -func (l *Set) Value(k Key) (Value, bool) { - if l == nil || !l.equivalent.Valid() { - return Value{}, false - } - rValue := l.equivalent.reflectValue() - vlen := rValue.Len() - - idx := sort.Search(vlen, func(idx int) bool { - return rValue.Index(idx).Interface().(KeyValue).Key >= k - }) - if idx >= vlen { - return Value{}, false - } - keyValue := rValue.Index(idx).Interface().(KeyValue) - if k == keyValue.Key { - return keyValue.Value, true - } - return Value{}, false -} - -// HasValue tests whether a key is defined in this set. -func (l *Set) HasValue(k Key) bool { - if l == nil { - return false - } - _, ok := l.Value(k) - return ok -} - -// Iter returns an iterator for visiting the attributes in this set. -func (l *Set) Iter() Iterator { - return Iterator{ - storage: l, - idx: -1, - } -} - -// ToSlice returns the set of attributes belonging to this set, sorted, where -// keys appear no more than once. -func (l *Set) ToSlice() []KeyValue { - iter := l.Iter() - return iter.ToSlice() -} - -// Equivalent returns a value that may be used as a map key. The Distinct type -// guarantees that the result will equal the equivalent. Distinct value of any -// attribute set with the same elements as this, where sets are made unique by -// choosing the last value in the input for any given key. -func (l *Set) Equivalent() Distinct { - if l == nil || !l.equivalent.Valid() { - return emptySet.equivalent - } - return l.equivalent -} - -// Equals returns true if the argument set is equivalent to this set. -func (l *Set) Equals(o *Set) bool { - return l.Equivalent() == o.Equivalent() -} - -// Encoded returns the encoded form of this set, according to encoder. -func (l *Set) Encoded(encoder Encoder) string { - if l == nil || encoder == nil { - return "" - } - - return encoder.Encode(l.Iter()) -} - -func empty() Set { - return Set{ - equivalent: emptySet.equivalent, - } -} - -// NewSet returns a new Set. See the documentation for -// NewSetWithSortableFiltered for more details. -// -// Except for empty sets, this method adds an additional allocation compared -// with calls that include a Sortable. -func NewSet(kvs ...KeyValue) Set { - // Check for empty set. - if len(kvs) == 0 { - return empty() - } - srt := sortables.Get().(*Sortable) - s, _ := NewSetWithSortableFiltered(kvs, srt, nil) - sortables.Put(srt) - return s -} - -// NewSetWithSortable returns a new Set. See the documentation for -// NewSetWithSortableFiltered for more details. -// -// This call includes a Sortable option as a memory optimization. -func NewSetWithSortable(kvs []KeyValue, tmp *Sortable) Set { - // Check for empty set. - if len(kvs) == 0 { - return empty() - } - s, _ := NewSetWithSortableFiltered(kvs, tmp, nil) - return s -} - -// NewSetWithFiltered returns a new Set. See the documentation for -// NewSetWithSortableFiltered for more details. -// -// This call includes a Filter to include/exclude attribute keys from the -// return value. Excluded keys are returned as a slice of attribute values. -func NewSetWithFiltered(kvs []KeyValue, filter Filter) (Set, []KeyValue) { - // Check for empty set. - if len(kvs) == 0 { - return empty(), nil - } - srt := sortables.Get().(*Sortable) - s, filtered := NewSetWithSortableFiltered(kvs, srt, filter) - sortables.Put(srt) - return s, filtered -} - -// NewSetWithSortableFiltered returns a new Set. -// -// Duplicate keys are eliminated by taking the last value. This -// re-orders the input slice so that unique last-values are contiguous -// at the end of the slice. -// -// This ensures the following: -// -// - Last-value-wins semantics -// - Caller sees the reordering, but doesn't lose values -// - Repeated call preserve last-value wins. -// -// Note that methods are defined on Set, although this returns Set. Callers -// can avoid memory allocations by: -// -// - allocating a Sortable for use as a temporary in this method -// - allocating a Set for storing the return value of this constructor. -// -// The result maintains a cache of encoded attributes, by attribute.EncoderID. -// This value should not be copied after its first use. -// -// The second []KeyValue return value is a list of attributes that were -// excluded by the Filter (if non-nil). -func NewSetWithSortableFiltered(kvs []KeyValue, tmp *Sortable, filter Filter) (Set, []KeyValue) { - // Check for empty set. - if len(kvs) == 0 { - return empty(), nil - } - - *tmp = kvs - - // Stable sort so the following de-duplication can implement - // last-value-wins semantics. - sort.Stable(tmp) - - *tmp = nil - - position := len(kvs) - 1 - offset := position - 1 - - // The requirements stated above require that the stable - // result be placed in the end of the input slice, while - // overwritten values are swapped to the beginning. - // - // De-duplicate with last-value-wins semantics. Preserve - // duplicate values at the beginning of the input slice. - for ; offset >= 0; offset-- { - if kvs[offset].Key == kvs[position].Key { - continue - } - position-- - kvs[offset], kvs[position] = kvs[position], kvs[offset] - } - kvs = kvs[position:] - - if filter != nil { - if div := filteredToFront(kvs, filter); div != 0 { - return Set{equivalent: computeDistinct(kvs[div:])}, kvs[:div] - } - } - return Set{equivalent: computeDistinct(kvs)}, nil -} - -// filteredToFront filters slice in-place using keep function. All KeyValues that need to -// be removed are moved to the front. All KeyValues that need to be kept are -// moved (in-order) to the back. The index for the first KeyValue to be kept is -// returned. -func filteredToFront(slice []KeyValue, keep Filter) int { - n := len(slice) - j := n - for i := n - 1; i >= 0; i-- { - if keep(slice[i]) { - j-- - slice[i], slice[j] = slice[j], slice[i] - } - } - return j -} - -// Filter returns a filtered copy of this Set. See the documentation for -// NewSetWithSortableFiltered for more details. -func (l *Set) Filter(re Filter) (Set, []KeyValue) { - if re == nil { - return *l, nil - } - - // Iterate in reverse to the first attribute that will be filtered out. - n := l.Len() - first := n - 1 - for ; first >= 0; first-- { - kv, _ := l.Get(first) - if !re(kv) { - break - } - } - - // No attributes will be dropped, return the immutable Set l and nil. - if first < 0 { - return *l, nil - } - - // Copy now that we know we need to return a modified set. - // - // Do not do this in-place on the underlying storage of *Set l. Sets are - // immutable and filtering should not change this. - slice := l.ToSlice() - - // Don't re-iterate the slice if only slice[0] is filtered. - if first == 0 { - // It is safe to assume len(slice) >= 1 given we found at least one - // attribute above that needs to be filtered out. - return Set{equivalent: computeDistinct(slice[1:])}, slice[:1] - } - - // Move the filtered slice[first] to the front (preserving order). - kv := slice[first] - copy(slice[1:first+1], slice[:first]) - slice[0] = kv - - // Do not re-evaluate re(slice[first+1:]). - div := filteredToFront(slice[1:first+1], re) + 1 - return Set{equivalent: computeDistinct(slice[div:])}, slice[:div] -} - -// computeDistinct returns a Distinct using either the fixed- or -// reflect-oriented code path, depending on the size of the input. The input -// slice is assumed to already be sorted and de-duplicated. -func computeDistinct(kvs []KeyValue) Distinct { - iface := computeDistinctFixed(kvs) - if iface == nil { - iface = computeDistinctReflect(kvs) - } - return Distinct{ - iface: iface, - } -} - -// computeDistinctFixed computes a Distinct for small slices. It returns nil -// if the input is too large for this code path. -func computeDistinctFixed(kvs []KeyValue) interface{} { - switch len(kvs) { - case 1: - ptr := new([1]KeyValue) - copy((*ptr)[:], kvs) - return *ptr - case 2: - ptr := new([2]KeyValue) - copy((*ptr)[:], kvs) - return *ptr - case 3: - ptr := new([3]KeyValue) - copy((*ptr)[:], kvs) - return *ptr - case 4: - ptr := new([4]KeyValue) - copy((*ptr)[:], kvs) - return *ptr - case 5: - ptr := new([5]KeyValue) - copy((*ptr)[:], kvs) - return *ptr - case 6: - ptr := new([6]KeyValue) - copy((*ptr)[:], kvs) - return *ptr - case 7: - ptr := new([7]KeyValue) - copy((*ptr)[:], kvs) - return *ptr - case 8: - ptr := new([8]KeyValue) - copy((*ptr)[:], kvs) - return *ptr - case 9: - ptr := new([9]KeyValue) - copy((*ptr)[:], kvs) - return *ptr - case 10: - ptr := new([10]KeyValue) - copy((*ptr)[:], kvs) - return *ptr - default: - return nil - } -} - -// computeDistinctReflect computes a Distinct using reflection, works for any -// size input. -func computeDistinctReflect(kvs []KeyValue) interface{} { - at := reflect.New(reflect.ArrayOf(len(kvs), keyValueType)).Elem() - for i, keyValue := range kvs { - *(at.Index(i).Addr().Interface().(*KeyValue)) = keyValue - } - return at.Interface() -} - -// MarshalJSON returns the JSON encoding of the Set. -func (l *Set) MarshalJSON() ([]byte, error) { - return json.Marshal(l.equivalent.iface) -} - -// MarshalLog is the marshaling function used by the logging system to represent this Set. -func (l Set) MarshalLog() interface{} { - kvs := make(map[string]string) - for _, kv := range l.ToSlice() { - kvs[string(kv.Key)] = kv.Value.Emit() - } - return kvs -} - -// Len implements sort.Interface. -func (l *Sortable) Len() int { - return len(*l) -} - -// Swap implements sort.Interface. -func (l *Sortable) Swap(i, j int) { - (*l)[i], (*l)[j] = (*l)[j], (*l)[i] -} - -// Less implements sort.Interface. -func (l *Sortable) Less(i, j int) bool { - return (*l)[i].Key < (*l)[j].Key -} diff --git a/vendor/go.opentelemetry.io/otel/attribute/type_string.go b/vendor/go.opentelemetry.io/otel/attribute/type_string.go deleted file mode 100644 index e584b247..00000000 --- a/vendor/go.opentelemetry.io/otel/attribute/type_string.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by "stringer -type=Type"; DO NOT EDIT. - -package attribute - -import "strconv" - -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[INVALID-0] - _ = x[BOOL-1] - _ = x[INT64-2] - _ = x[FLOAT64-3] - _ = x[STRING-4] - _ = x[BOOLSLICE-5] - _ = x[INT64SLICE-6] - _ = x[FLOAT64SLICE-7] - _ = x[STRINGSLICE-8] -} - -const _Type_name = "INVALIDBOOLINT64FLOAT64STRINGBOOLSLICEINT64SLICEFLOAT64SLICESTRINGSLICE" - -var _Type_index = [...]uint8{0, 7, 11, 16, 23, 29, 38, 48, 60, 71} - -func (i Type) String() string { - if i < 0 || i >= Type(len(_Type_index)-1) { - return "Type(" + strconv.FormatInt(int64(i), 10) + ")" - } - return _Type_name[_Type_index[i]:_Type_index[i+1]] -} diff --git a/vendor/go.opentelemetry.io/otel/attribute/value.go b/vendor/go.opentelemetry.io/otel/attribute/value.go deleted file mode 100644 index cb21dd5c..00000000 --- a/vendor/go.opentelemetry.io/otel/attribute/value.go +++ /dev/null @@ -1,270 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package attribute // import "go.opentelemetry.io/otel/attribute" - -import ( - "encoding/json" - "fmt" - "reflect" - "strconv" - - "go.opentelemetry.io/otel/internal" - "go.opentelemetry.io/otel/internal/attribute" -) - -//go:generate stringer -type=Type - -// Type describes the type of the data Value holds. -type Type int // nolint: revive // redefines builtin Type. - -// Value represents the value part in key-value pairs. -type Value struct { - vtype Type - numeric uint64 - stringly string - slice interface{} -} - -const ( - // INVALID is used for a Value with no value set. - INVALID Type = iota - // BOOL is a boolean Type Value. - BOOL - // INT64 is a 64-bit signed integral Type Value. - INT64 - // FLOAT64 is a 64-bit floating point Type Value. - FLOAT64 - // STRING is a string Type Value. - STRING - // BOOLSLICE is a slice of booleans Type Value. - BOOLSLICE - // INT64SLICE is a slice of 64-bit signed integral numbers Type Value. - INT64SLICE - // FLOAT64SLICE is a slice of 64-bit floating point numbers Type Value. - FLOAT64SLICE - // STRINGSLICE is a slice of strings Type Value. - STRINGSLICE -) - -// BoolValue creates a BOOL Value. -func BoolValue(v bool) Value { - return Value{ - vtype: BOOL, - numeric: internal.BoolToRaw(v), - } -} - -// BoolSliceValue creates a BOOLSLICE Value. -func BoolSliceValue(v []bool) Value { - return Value{vtype: BOOLSLICE, slice: attribute.BoolSliceValue(v)} -} - -// IntValue creates an INT64 Value. -func IntValue(v int) Value { - return Int64Value(int64(v)) -} - -// IntSliceValue creates an INTSLICE Value. -func IntSliceValue(v []int) Value { - var int64Val int64 - cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(int64Val))) - for i, val := range v { - cp.Elem().Index(i).SetInt(int64(val)) - } - return Value{ - vtype: INT64SLICE, - slice: cp.Elem().Interface(), - } -} - -// Int64Value creates an INT64 Value. -func Int64Value(v int64) Value { - return Value{ - vtype: INT64, - numeric: internal.Int64ToRaw(v), - } -} - -// Int64SliceValue creates an INT64SLICE Value. -func Int64SliceValue(v []int64) Value { - return Value{vtype: INT64SLICE, slice: attribute.Int64SliceValue(v)} -} - -// Float64Value creates a FLOAT64 Value. -func Float64Value(v float64) Value { - return Value{ - vtype: FLOAT64, - numeric: internal.Float64ToRaw(v), - } -} - -// Float64SliceValue creates a FLOAT64SLICE Value. -func Float64SliceValue(v []float64) Value { - return Value{vtype: FLOAT64SLICE, slice: attribute.Float64SliceValue(v)} -} - -// StringValue creates a STRING Value. -func StringValue(v string) Value { - return Value{ - vtype: STRING, - stringly: v, - } -} - -// StringSliceValue creates a STRINGSLICE Value. -func StringSliceValue(v []string) Value { - return Value{vtype: STRINGSLICE, slice: attribute.StringSliceValue(v)} -} - -// Type returns a type of the Value. -func (v Value) Type() Type { - return v.vtype -} - -// AsBool returns the bool value. Make sure that the Value's type is -// BOOL. -func (v Value) AsBool() bool { - return internal.RawToBool(v.numeric) -} - -// AsBoolSlice returns the []bool value. Make sure that the Value's type is -// BOOLSLICE. -func (v Value) AsBoolSlice() []bool { - if v.vtype != BOOLSLICE { - return nil - } - return v.asBoolSlice() -} - -func (v Value) asBoolSlice() []bool { - return attribute.AsBoolSlice(v.slice) -} - -// AsInt64 returns the int64 value. Make sure that the Value's type is -// INT64. -func (v Value) AsInt64() int64 { - return internal.RawToInt64(v.numeric) -} - -// AsInt64Slice returns the []int64 value. Make sure that the Value's type is -// INT64SLICE. -func (v Value) AsInt64Slice() []int64 { - if v.vtype != INT64SLICE { - return nil - } - return v.asInt64Slice() -} - -func (v Value) asInt64Slice() []int64 { - return attribute.AsInt64Slice(v.slice) -} - -// AsFloat64 returns the float64 value. Make sure that the Value's -// type is FLOAT64. -func (v Value) AsFloat64() float64 { - return internal.RawToFloat64(v.numeric) -} - -// AsFloat64Slice returns the []float64 value. Make sure that the Value's type is -// FLOAT64SLICE. -func (v Value) AsFloat64Slice() []float64 { - if v.vtype != FLOAT64SLICE { - return nil - } - return v.asFloat64Slice() -} - -func (v Value) asFloat64Slice() []float64 { - return attribute.AsFloat64Slice(v.slice) -} - -// AsString returns the string value. Make sure that the Value's type -// is STRING. -func (v Value) AsString() string { - return v.stringly -} - -// AsStringSlice returns the []string value. Make sure that the Value's type is -// STRINGSLICE. -func (v Value) AsStringSlice() []string { - if v.vtype != STRINGSLICE { - return nil - } - return v.asStringSlice() -} - -func (v Value) asStringSlice() []string { - return attribute.AsStringSlice(v.slice) -} - -type unknownValueType struct{} - -// AsInterface returns Value's data as interface{}. -func (v Value) AsInterface() interface{} { - switch v.Type() { - case BOOL: - return v.AsBool() - case BOOLSLICE: - return v.asBoolSlice() - case INT64: - return v.AsInt64() - case INT64SLICE: - return v.asInt64Slice() - case FLOAT64: - return v.AsFloat64() - case FLOAT64SLICE: - return v.asFloat64Slice() - case STRING: - return v.stringly - case STRINGSLICE: - return v.asStringSlice() - } - return unknownValueType{} -} - -// Emit returns a string representation of Value's data. -func (v Value) Emit() string { - switch v.Type() { - case BOOLSLICE: - return fmt.Sprint(v.asBoolSlice()) - case BOOL: - return strconv.FormatBool(v.AsBool()) - case INT64SLICE: - return fmt.Sprint(v.asInt64Slice()) - case INT64: - return strconv.FormatInt(v.AsInt64(), 10) - case FLOAT64SLICE: - return fmt.Sprint(v.asFloat64Slice()) - case FLOAT64: - return fmt.Sprint(v.AsFloat64()) - case STRINGSLICE: - return fmt.Sprint(v.asStringSlice()) - case STRING: - return v.stringly - default: - return "unknown" - } -} - -// MarshalJSON returns the JSON encoding of the Value. -func (v Value) MarshalJSON() ([]byte, error) { - var jsonVal struct { - Type string - Value interface{} - } - jsonVal.Type = v.Type().String() - jsonVal.Value = v.AsInterface() - return json.Marshal(jsonVal) -} diff --git a/vendor/go.opentelemetry.io/otel/baggage/baggage.go b/vendor/go.opentelemetry.io/otel/baggage/baggage.go deleted file mode 100644 index 7d27cf77..00000000 --- a/vendor/go.opentelemetry.io/otel/baggage/baggage.go +++ /dev/null @@ -1,744 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package baggage // import "go.opentelemetry.io/otel/baggage" - -import ( - "errors" - "fmt" - "net/url" - "strings" - - "go.opentelemetry.io/otel/internal/baggage" -) - -const ( - maxMembers = 180 - maxBytesPerMembers = 4096 - maxBytesPerBaggageString = 8192 - - listDelimiter = "," - keyValueDelimiter = "=" - propertyDelimiter = ";" -) - -var ( - errInvalidKey = errors.New("invalid key") - errInvalidValue = errors.New("invalid value") - errInvalidProperty = errors.New("invalid baggage list-member property") - errInvalidMember = errors.New("invalid baggage list-member") - errMemberNumber = errors.New("too many list-members in baggage-string") - errMemberBytes = errors.New("list-member too large") - errBaggageBytes = errors.New("baggage-string too large") -) - -// Property is an additional metadata entry for a baggage list-member. -type Property struct { - key, value string - - // hasValue indicates if a zero-value value means the property does not - // have a value or if it was the zero-value. - hasValue bool -} - -// NewKeyProperty returns a new Property for key. -// -// If key is invalid, an error will be returned. -func NewKeyProperty(key string) (Property, error) { - if !validateKey(key) { - return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key) - } - - p := Property{key: key} - return p, nil -} - -// NewKeyValueProperty returns a new Property for key with value. -// -// The passed key must be compliant with W3C Baggage specification. -// The passed value must be precent-encoded as defined in W3C Baggage specification. -// -// Notice: Consider using [NewKeyValuePropertyRaw] instead -// that does not require precent-encoding of the value. -func NewKeyValueProperty(key, value string) (Property, error) { - if !validateValue(value) { - return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidValue, value) - } - decodedValue, err := url.PathUnescape(value) - if err != nil { - return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidValue, value) - } - return NewKeyValuePropertyRaw(key, decodedValue) -} - -// NewKeyValuePropertyRaw returns a new Property for key with value. -// -// The passed key must be compliant with W3C Baggage specification. -func NewKeyValuePropertyRaw(key, value string) (Property, error) { - if !validateKey(key) { - return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key) - } - - p := Property{ - key: key, - value: value, - hasValue: true, - } - return p, nil -} - -func newInvalidProperty() Property { - return Property{} -} - -// parseProperty attempts to decode a Property from the passed string. It -// returns an error if the input is invalid according to the W3C Baggage -// specification. -func parseProperty(property string) (Property, error) { - if property == "" { - return newInvalidProperty(), nil - } - - p, ok := parsePropertyInternal(property) - if !ok { - return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidProperty, property) - } - - return p, nil -} - -// validate ensures p conforms to the W3C Baggage specification, returning an -// error otherwise. -func (p Property) validate() error { - errFunc := func(err error) error { - return fmt.Errorf("invalid property: %w", err) - } - - if !validateKey(p.key) { - return errFunc(fmt.Errorf("%w: %q", errInvalidKey, p.key)) - } - if !p.hasValue && p.value != "" { - return errFunc(errors.New("inconsistent value")) - } - return nil -} - -// Key returns the Property key. -func (p Property) Key() string { - return p.key -} - -// Value returns the Property value. Additionally, a boolean value is returned -// indicating if the returned value is the empty if the Property has a value -// that is empty or if the value is not set. -func (p Property) Value() (string, bool) { - return p.value, p.hasValue -} - -// String encodes Property into a header string compliant with the W3C Baggage -// specification. -func (p Property) String() string { - if p.hasValue { - return fmt.Sprintf("%s%s%v", p.key, keyValueDelimiter, valueEscape(p.value)) - } - return p.key -} - -type properties []Property - -func fromInternalProperties(iProps []baggage.Property) properties { - if len(iProps) == 0 { - return nil - } - - props := make(properties, len(iProps)) - for i, p := range iProps { - props[i] = Property{ - key: p.Key, - value: p.Value, - hasValue: p.HasValue, - } - } - return props -} - -func (p properties) asInternal() []baggage.Property { - if len(p) == 0 { - return nil - } - - iProps := make([]baggage.Property, len(p)) - for i, prop := range p { - iProps[i] = baggage.Property{ - Key: prop.key, - Value: prop.value, - HasValue: prop.hasValue, - } - } - return iProps -} - -func (p properties) Copy() properties { - if len(p) == 0 { - return nil - } - - props := make(properties, len(p)) - copy(props, p) - return props -} - -// validate ensures each Property in p conforms to the W3C Baggage -// specification, returning an error otherwise. -func (p properties) validate() error { - for _, prop := range p { - if err := prop.validate(); err != nil { - return err - } - } - return nil -} - -// String encodes properties into a header string compliant with the W3C Baggage -// specification. -func (p properties) String() string { - props := make([]string, len(p)) - for i, prop := range p { - props[i] = prop.String() - } - return strings.Join(props, propertyDelimiter) -} - -// Member is a list-member of a baggage-string as defined by the W3C Baggage -// specification. -type Member struct { - key, value string - properties properties - - // hasData indicates whether the created property contains data or not. - // Properties that do not contain data are invalid with no other check - // required. - hasData bool -} - -// NewMemberRaw returns a new Member from the passed arguments. -// -// The passed key must be compliant with W3C Baggage specification. -// The passed value must be precent-encoded as defined in W3C Baggage specification. -// -// Notice: Consider using [NewMemberRaw] instead -// that does not require precent-encoding of the value. -func NewMember(key, value string, props ...Property) (Member, error) { - if !validateValue(value) { - return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value) - } - decodedValue, err := url.PathUnescape(value) - if err != nil { - return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value) - } - return NewMemberRaw(key, decodedValue, props...) -} - -// NewMemberRaw returns a new Member from the passed arguments. -// -// The passed key must be compliant with W3C Baggage specification. -func NewMemberRaw(key, value string, props ...Property) (Member, error) { - m := Member{ - key: key, - value: value, - properties: properties(props).Copy(), - hasData: true, - } - if err := m.validate(); err != nil { - return newInvalidMember(), err - } - return m, nil -} - -func newInvalidMember() Member { - return Member{} -} - -// parseMember attempts to decode a Member from the passed string. It returns -// an error if the input is invalid according to the W3C Baggage -// specification. -func parseMember(member string) (Member, error) { - if n := len(member); n > maxBytesPerMembers { - return newInvalidMember(), fmt.Errorf("%w: %d", errMemberBytes, n) - } - - var props properties - keyValue, properties, found := strings.Cut(member, propertyDelimiter) - if found { - // Parse the member properties. - for _, pStr := range strings.Split(properties, propertyDelimiter) { - p, err := parseProperty(pStr) - if err != nil { - return newInvalidMember(), err - } - props = append(props, p) - } - } - // Parse the member key/value pair. - - // Take into account a value can contain equal signs (=). - k, v, found := strings.Cut(keyValue, keyValueDelimiter) - if !found { - return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidMember, member) - } - // "Leading and trailing whitespaces are allowed but MUST be trimmed - // when converting the header into a data structure." - key := strings.TrimSpace(k) - if !validateKey(key) { - return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidKey, key) - } - - val := strings.TrimSpace(v) - if !validateValue(val) { - return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, v) - } - - // Decode a precent-encoded value. - value, err := url.PathUnescape(val) - if err != nil { - return newInvalidMember(), fmt.Errorf("%w: %v", errInvalidValue, err) - } - return Member{key: key, value: value, properties: props, hasData: true}, nil -} - -// validate ensures m conforms to the W3C Baggage specification. -// A key must be an ASCII string, returning an error otherwise. -func (m Member) validate() error { - if !m.hasData { - return fmt.Errorf("%w: %q", errInvalidMember, m) - } - - if !validateKey(m.key) { - return fmt.Errorf("%w: %q", errInvalidKey, m.key) - } - return m.properties.validate() -} - -// Key returns the Member key. -func (m Member) Key() string { return m.key } - -// Value returns the Member value. -func (m Member) Value() string { return m.value } - -// Properties returns a copy of the Member properties. -func (m Member) Properties() []Property { return m.properties.Copy() } - -// String encodes Member into a header string compliant with the W3C Baggage -// specification. -func (m Member) String() string { - // A key is just an ASCII string. A value is restricted to be - // US-ASCII characters excluding CTLs, whitespace, - // DQUOTE, comma, semicolon, and backslash. - s := fmt.Sprintf("%s%s%s", m.key, keyValueDelimiter, valueEscape(m.value)) - if len(m.properties) > 0 { - s = fmt.Sprintf("%s%s%s", s, propertyDelimiter, m.properties.String()) - } - return s -} - -// Baggage is a list of baggage members representing the baggage-string as -// defined by the W3C Baggage specification. -type Baggage struct { //nolint:golint - list baggage.List -} - -// New returns a new valid Baggage. It returns an error if it results in a -// Baggage exceeding limits set in that specification. -// -// It expects all the provided members to have already been validated. -func New(members ...Member) (Baggage, error) { - if len(members) == 0 { - return Baggage{}, nil - } - - b := make(baggage.List) - for _, m := range members { - if !m.hasData { - return Baggage{}, errInvalidMember - } - - // OpenTelemetry resolves duplicates by last-one-wins. - b[m.key] = baggage.Item{ - Value: m.value, - Properties: m.properties.asInternal(), - } - } - - // Check member numbers after deduplication. - if len(b) > maxMembers { - return Baggage{}, errMemberNumber - } - - bag := Baggage{b} - if n := len(bag.String()); n > maxBytesPerBaggageString { - return Baggage{}, fmt.Errorf("%w: %d", errBaggageBytes, n) - } - - return bag, nil -} - -// Parse attempts to decode a baggage-string from the passed string. It -// returns an error if the input is invalid according to the W3C Baggage -// specification. -// -// If there are duplicate list-members contained in baggage, the last one -// defined (reading left-to-right) will be the only one kept. This diverges -// from the W3C Baggage specification which allows duplicate list-members, but -// conforms to the OpenTelemetry Baggage specification. -func Parse(bStr string) (Baggage, error) { - if bStr == "" { - return Baggage{}, nil - } - - if n := len(bStr); n > maxBytesPerBaggageString { - return Baggage{}, fmt.Errorf("%w: %d", errBaggageBytes, n) - } - - b := make(baggage.List) - for _, memberStr := range strings.Split(bStr, listDelimiter) { - m, err := parseMember(memberStr) - if err != nil { - return Baggage{}, err - } - // OpenTelemetry resolves duplicates by last-one-wins. - b[m.key] = baggage.Item{ - Value: m.value, - Properties: m.properties.asInternal(), - } - } - - // OpenTelemetry does not allow for duplicate list-members, but the W3C - // specification does. Now that we have deduplicated, ensure the baggage - // does not exceed list-member limits. - if len(b) > maxMembers { - return Baggage{}, errMemberNumber - } - - return Baggage{b}, nil -} - -// Member returns the baggage list-member identified by key. -// -// If there is no list-member matching the passed key the returned Member will -// be a zero-value Member. -// The returned member is not validated, as we assume the validation happened -// when it was added to the Baggage. -func (b Baggage) Member(key string) Member { - v, ok := b.list[key] - if !ok { - // We do not need to worry about distinguishing between the situation - // where a zero-valued Member is included in the Baggage because a - // zero-valued Member is invalid according to the W3C Baggage - // specification (it has an empty key). - return newInvalidMember() - } - - return Member{ - key: key, - value: v.Value, - properties: fromInternalProperties(v.Properties), - hasData: true, - } -} - -// Members returns all the baggage list-members. -// The order of the returned list-members does not have significance. -// -// The returned members are not validated, as we assume the validation happened -// when they were added to the Baggage. -func (b Baggage) Members() []Member { - if len(b.list) == 0 { - return nil - } - - members := make([]Member, 0, len(b.list)) - for k, v := range b.list { - members = append(members, Member{ - key: k, - value: v.Value, - properties: fromInternalProperties(v.Properties), - hasData: true, - }) - } - return members -} - -// SetMember returns a copy the Baggage with the member included. If the -// baggage contains a Member with the same key the existing Member is -// replaced. -// -// If member is invalid according to the W3C Baggage specification, an error -// is returned with the original Baggage. -func (b Baggage) SetMember(member Member) (Baggage, error) { - if !member.hasData { - return b, errInvalidMember - } - - n := len(b.list) - if _, ok := b.list[member.key]; !ok { - n++ - } - list := make(baggage.List, n) - - for k, v := range b.list { - // Do not copy if we are just going to overwrite. - if k == member.key { - continue - } - list[k] = v - } - - list[member.key] = baggage.Item{ - Value: member.value, - Properties: member.properties.asInternal(), - } - - return Baggage{list: list}, nil -} - -// DeleteMember returns a copy of the Baggage with the list-member identified -// by key removed. -func (b Baggage) DeleteMember(key string) Baggage { - n := len(b.list) - if _, ok := b.list[key]; ok { - n-- - } - list := make(baggage.List, n) - - for k, v := range b.list { - if k == key { - continue - } - list[k] = v - } - - return Baggage{list: list} -} - -// Len returns the number of list-members in the Baggage. -func (b Baggage) Len() int { - return len(b.list) -} - -// String encodes Baggage into a header string compliant with the W3C Baggage -// specification. -func (b Baggage) String() string { - members := make([]string, 0, len(b.list)) - for k, v := range b.list { - members = append(members, Member{ - key: k, - value: v.Value, - properties: fromInternalProperties(v.Properties), - }.String()) - } - return strings.Join(members, listDelimiter) -} - -// parsePropertyInternal attempts to decode a Property from the passed string. -// It follows the spec at https://www.w3.org/TR/baggage/#definition. -func parsePropertyInternal(s string) (p Property, ok bool) { - // For the entire function we will use " key = value " as an example. - // Attempting to parse the key. - // First skip spaces at the beginning "< >key = value " (they could be empty). - index := skipSpace(s, 0) - - // Parse the key: " = value ". - keyStart := index - keyEnd := index - for _, c := range s[keyStart:] { - if !validateKeyChar(c) { - break - } - keyEnd++ - } - - // If we couldn't find any valid key character, - // it means the key is either empty or invalid. - if keyStart == keyEnd { - return - } - - // Skip spaces after the key: " key< >= value ". - index = skipSpace(s, keyEnd) - - if index == len(s) { - // A key can have no value, like: " key ". - ok = true - p.key = s[keyStart:keyEnd] - return - } - - // If we have not reached the end and we can't find the '=' delimiter, - // it means the property is invalid. - if s[index] != keyValueDelimiter[0] { - return - } - - // Attempting to parse the value. - // Match: " key =< >value ". - index = skipSpace(s, index+1) - - // Match the value string: " key = ". - // A valid property can be: " key =". - // Therefore, we don't have to check if the value is empty. - valueStart := index - valueEnd := index - for _, c := range s[valueStart:] { - if !validateValueChar(c) { - break - } - valueEnd++ - } - - // Skip all trailing whitespaces: " key = value< >". - index = skipSpace(s, valueEnd) - - // If after looking for the value and skipping whitespaces - // we have not reached the end, it means the property is - // invalid, something like: " key = value value1". - if index != len(s) { - return - } - - // Decode a precent-encoded value. - value, err := url.PathUnescape(s[valueStart:valueEnd]) - if err != nil { - return - } - - ok = true - p.key = s[keyStart:keyEnd] - p.hasValue = true - - p.value = value - return -} - -func skipSpace(s string, offset int) int { - i := offset - for ; i < len(s); i++ { - c := s[i] - if c != ' ' && c != '\t' { - break - } - } - return i -} - -func validateKey(s string) bool { - if len(s) == 0 { - return false - } - - for _, c := range s { - if !validateKeyChar(c) { - return false - } - } - - return true -} - -func validateKeyChar(c int32) bool { - return (c >= 0x23 && c <= 0x27) || - (c >= 0x30 && c <= 0x39) || - (c >= 0x41 && c <= 0x5a) || - (c >= 0x5e && c <= 0x7a) || - c == 0x21 || - c == 0x2a || - c == 0x2b || - c == 0x2d || - c == 0x2e || - c == 0x7c || - c == 0x7e -} - -func validateValue(s string) bool { - for _, c := range s { - if !validateValueChar(c) { - return false - } - } - - return true -} - -func validateValueChar(c int32) bool { - return c == 0x21 || - (c >= 0x23 && c <= 0x2b) || - (c >= 0x2d && c <= 0x3a) || - (c >= 0x3c && c <= 0x5b) || - (c >= 0x5d && c <= 0x7e) -} - -// valueEscape escapes the string so it can be safely placed inside a baggage value, -// replacing special characters with %XX sequences as needed. -// -// The implementation is based on: -// https://github.com/golang/go/blob/f6509cf5cdbb5787061b784973782933c47f1782/src/net/url/url.go#L285. -func valueEscape(s string) string { - hexCount := 0 - for i := 0; i < len(s); i++ { - c := s[i] - if shouldEscape(c) { - hexCount++ - } - } - - if hexCount == 0 { - return s - } - - var buf [64]byte - var t []byte - - required := len(s) + 2*hexCount - if required <= len(buf) { - t = buf[:required] - } else { - t = make([]byte, required) - } - - j := 0 - for i := 0; i < len(s); i++ { - c := s[i] - if shouldEscape(s[i]) { - const upperhex = "0123456789ABCDEF" - t[j] = '%' - t[j+1] = upperhex[c>>4] - t[j+2] = upperhex[c&15] - j += 3 - } else { - t[j] = c - j++ - } - } - - return string(t) -} - -// shouldEscape returns true if the specified byte should be escaped when -// appearing in a baggage value string. -func shouldEscape(c byte) bool { - if c == '%' { - // The percent character must be encoded so that percent-encoding can work. - return true - } - return !validateValueChar(int32(c)) -} diff --git a/vendor/go.opentelemetry.io/otel/baggage/context.go b/vendor/go.opentelemetry.io/otel/baggage/context.go deleted file mode 100644 index 24b34b75..00000000 --- a/vendor/go.opentelemetry.io/otel/baggage/context.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package baggage // import "go.opentelemetry.io/otel/baggage" - -import ( - "context" - - "go.opentelemetry.io/otel/internal/baggage" -) - -// ContextWithBaggage returns a copy of parent with baggage. -func ContextWithBaggage(parent context.Context, b Baggage) context.Context { - // Delegate so any hooks for the OpenTracing bridge are handled. - return baggage.ContextWithList(parent, b.list) -} - -// ContextWithoutBaggage returns a copy of parent with no baggage. -func ContextWithoutBaggage(parent context.Context) context.Context { - // Delegate so any hooks for the OpenTracing bridge are handled. - return baggage.ContextWithList(parent, nil) -} - -// FromContext returns the baggage contained in ctx. -func FromContext(ctx context.Context) Baggage { - // Delegate so any hooks for the OpenTracing bridge are handled. - return Baggage{list: baggage.ListFromContext(ctx)} -} diff --git a/vendor/go.opentelemetry.io/otel/baggage/doc.go b/vendor/go.opentelemetry.io/otel/baggage/doc.go deleted file mode 100644 index 4545100d..00000000 --- a/vendor/go.opentelemetry.io/otel/baggage/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -/* -Package baggage provides functionality for storing and retrieving -baggage items in Go context. For propagating the baggage, see the -go.opentelemetry.io/otel/propagation package. -*/ -package baggage // import "go.opentelemetry.io/otel/baggage" diff --git a/vendor/go.opentelemetry.io/otel/codes/codes.go b/vendor/go.opentelemetry.io/otel/codes/codes.go deleted file mode 100644 index 587ebae4..00000000 --- a/vendor/go.opentelemetry.io/otel/codes/codes.go +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package codes // import "go.opentelemetry.io/otel/codes" - -import ( - "encoding/json" - "fmt" - "strconv" -) - -const ( - // Unset is the default status code. - Unset Code = 0 - - // Error indicates the operation contains an error. - // - // NOTE: The error code in OTLP is 2. - // The value of this enum is only relevant to the internals - // of the Go SDK. - Error Code = 1 - - // Ok indicates operation has been validated by an Application developers - // or Operator to have completed successfully, or contain no error. - // - // NOTE: The Ok code in OTLP is 1. - // The value of this enum is only relevant to the internals - // of the Go SDK. - Ok Code = 2 - - maxCode = 3 -) - -// Code is an 32-bit representation of a status state. -type Code uint32 - -var codeToStr = map[Code]string{ - Unset: "Unset", - Error: "Error", - Ok: "Ok", -} - -var strToCode = map[string]Code{ - `"Unset"`: Unset, - `"Error"`: Error, - `"Ok"`: Ok, -} - -// String returns the Code as a string. -func (c Code) String() string { - return codeToStr[c] -} - -// UnmarshalJSON unmarshals b into the Code. -// -// This is based on the functionality in the gRPC codes package: -// https://github.com/grpc/grpc-go/blob/bb64fee312b46ebee26be43364a7a966033521b1/codes/codes.go#L218-L244 -func (c *Code) UnmarshalJSON(b []byte) error { - // From json.Unmarshaler: By convention, to approximate the behavior of - // Unmarshal itself, Unmarshalers implement UnmarshalJSON([]byte("null")) as - // a no-op. - if string(b) == "null" { - return nil - } - if c == nil { - return fmt.Errorf("nil receiver passed to UnmarshalJSON") - } - - var x interface{} - if err := json.Unmarshal(b, &x); err != nil { - return err - } - switch x.(type) { - case string: - if jc, ok := strToCode[string(b)]; ok { - *c = jc - return nil - } - return fmt.Errorf("invalid code: %q", string(b)) - case float64: - if ci, err := strconv.ParseUint(string(b), 10, 32); err == nil { - if ci >= maxCode { - return fmt.Errorf("invalid code: %q", ci) - } - - *c = Code(ci) - return nil - } - return fmt.Errorf("invalid code: %q", string(b)) - default: - return fmt.Errorf("invalid code: %q", string(b)) - } -} - -// MarshalJSON returns c as the JSON encoding of c. -func (c *Code) MarshalJSON() ([]byte, error) { - if c == nil { - return []byte("null"), nil - } - str, ok := codeToStr[*c] - if !ok { - return nil, fmt.Errorf("invalid code: %d", *c) - } - return []byte(fmt.Sprintf("%q", str)), nil -} diff --git a/vendor/go.opentelemetry.io/otel/codes/doc.go b/vendor/go.opentelemetry.io/otel/codes/doc.go deleted file mode 100644 index 4e328fbb..00000000 --- a/vendor/go.opentelemetry.io/otel/codes/doc.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -/* -Package codes defines the canonical error codes used by OpenTelemetry. - -It conforms to [the OpenTelemetry -specification](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/trace/api.md#set-status). -*/ -package codes // import "go.opentelemetry.io/otel/codes" diff --git a/vendor/go.opentelemetry.io/otel/doc.go b/vendor/go.opentelemetry.io/otel/doc.go deleted file mode 100644 index 36d7c24e..00000000 --- a/vendor/go.opentelemetry.io/otel/doc.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -/* -Package otel provides global access to the OpenTelemetry API. The subpackages of -the otel package provide an implementation of the OpenTelemetry API. - -The provided API is used to instrument code and measure data about that code's -performance and operation. The measured data, by default, is not processed or -transmitted anywhere. An implementation of the OpenTelemetry SDK, like the -default SDK implementation (go.opentelemetry.io/otel/sdk), and associated -exporters are used to process and transport this data. - -To read the getting started guide, see https://opentelemetry.io/docs/languages/go/getting-started/. - -To read more about tracing, see go.opentelemetry.io/otel/trace. - -To read more about metrics, see go.opentelemetry.io/otel/metric. - -To read more about propagation, see go.opentelemetry.io/otel/propagation and -go.opentelemetry.io/otel/baggage. -*/ -package otel // import "go.opentelemetry.io/otel" diff --git a/vendor/go.opentelemetry.io/otel/error_handler.go b/vendor/go.opentelemetry.io/otel/error_handler.go deleted file mode 100644 index 72fad854..00000000 --- a/vendor/go.opentelemetry.io/otel/error_handler.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package otel // import "go.opentelemetry.io/otel" - -// ErrorHandler handles irremediable events. -type ErrorHandler interface { - // DO NOT CHANGE: any modification will not be backwards compatible and - // must never be done outside of a new major release. - - // Handle handles any error deemed irremediable by an OpenTelemetry - // component. - Handle(error) - // DO NOT CHANGE: any modification will not be backwards compatible and - // must never be done outside of a new major release. -} - -// ErrorHandlerFunc is a convenience adapter to allow the use of a function -// as an ErrorHandler. -type ErrorHandlerFunc func(error) - -var _ ErrorHandler = ErrorHandlerFunc(nil) - -// Handle handles the irremediable error by calling the ErrorHandlerFunc itself. -func (f ErrorHandlerFunc) Handle(err error) { - f(err) -} diff --git a/vendor/go.opentelemetry.io/otel/get_main_pkgs.sh b/vendor/go.opentelemetry.io/otel/get_main_pkgs.sh deleted file mode 100644 index 9a58fb1d..00000000 --- a/vendor/go.opentelemetry.io/otel/get_main_pkgs.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash - -# Copyright The OpenTelemetry Authors -# -# 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. - -set -euo pipefail - -top_dir='.' -if [[ $# -gt 0 ]]; then - top_dir="${1}" -fi - -p=$(pwd) -mod_dirs=() - -# Note `mapfile` does not exist in older bash versions: -# https://stackoverflow.com/questions/41475261/need-alternative-to-readarray-mapfile-for-script-on-older-version-of-bash - -while IFS= read -r line; do - mod_dirs+=("$line") -done < <(find "${top_dir}" -type f -name 'go.mod' -exec dirname {} \; | sort) - -for mod_dir in "${mod_dirs[@]}"; do - cd "${mod_dir}" - - while IFS= read -r line; do - echo ".${line#${p}}" - done < <(go list --find -f '{{.Name}}|{{.Dir}}' ./... | grep '^main|' | cut -f 2- -d '|') - cd "${p}" -done diff --git a/vendor/go.opentelemetry.io/otel/handler.go b/vendor/go.opentelemetry.io/otel/handler.go deleted file mode 100644 index 4115fe3b..00000000 --- a/vendor/go.opentelemetry.io/otel/handler.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package otel // import "go.opentelemetry.io/otel" - -import ( - "go.opentelemetry.io/otel/internal/global" -) - -var ( - // Compile-time check global.ErrDelegator implements ErrorHandler. - _ ErrorHandler = (*global.ErrDelegator)(nil) - // Compile-time check global.ErrLogger implements ErrorHandler. - _ ErrorHandler = (*global.ErrLogger)(nil) -) - -// GetErrorHandler returns the global ErrorHandler instance. -// -// The default ErrorHandler instance returned will log all errors to STDERR -// until an override ErrorHandler is set with SetErrorHandler. All -// ErrorHandler returned prior to this will automatically forward errors to -// the set instance instead of logging. -// -// Subsequent calls to SetErrorHandler after the first will not forward errors -// to the new ErrorHandler for prior returned instances. -func GetErrorHandler() ErrorHandler { return global.GetErrorHandler() } - -// SetErrorHandler sets the global ErrorHandler to h. -// -// The first time this is called all ErrorHandler previously returned from -// GetErrorHandler will send errors to h instead of the default logging -// ErrorHandler. Subsequent calls will set the global ErrorHandler, but not -// delegate errors to h. -func SetErrorHandler(h ErrorHandler) { global.SetErrorHandler(h) } - -// Handle is a convenience function for ErrorHandler().Handle(err). -func Handle(err error) { global.Handle(err) } diff --git a/vendor/go.opentelemetry.io/otel/internal/attribute/attribute.go b/vendor/go.opentelemetry.io/otel/internal/attribute/attribute.go deleted file mode 100644 index 622c3ee3..00000000 --- a/vendor/go.opentelemetry.io/otel/internal/attribute/attribute.go +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -/* -Package attribute provide several helper functions for some commonly used -logic of processing attributes. -*/ -package attribute // import "go.opentelemetry.io/otel/internal/attribute" - -import ( - "reflect" -) - -// BoolSliceValue converts a bool slice into an array with same elements as slice. -func BoolSliceValue(v []bool) interface{} { - var zero bool - cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) - copy(cp.Elem().Slice(0, len(v)).Interface().([]bool), v) - return cp.Elem().Interface() -} - -// Int64SliceValue converts an int64 slice into an array with same elements as slice. -func Int64SliceValue(v []int64) interface{} { - var zero int64 - cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) - copy(cp.Elem().Slice(0, len(v)).Interface().([]int64), v) - return cp.Elem().Interface() -} - -// Float64SliceValue converts a float64 slice into an array with same elements as slice. -func Float64SliceValue(v []float64) interface{} { - var zero float64 - cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) - copy(cp.Elem().Slice(0, len(v)).Interface().([]float64), v) - return cp.Elem().Interface() -} - -// StringSliceValue converts a string slice into an array with same elements as slice. -func StringSliceValue(v []string) interface{} { - var zero string - cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) - copy(cp.Elem().Slice(0, len(v)).Interface().([]string), v) - return cp.Elem().Interface() -} - -// AsBoolSlice converts a bool array into a slice into with same elements as array. -func AsBoolSlice(v interface{}) []bool { - rv := reflect.ValueOf(v) - if rv.Type().Kind() != reflect.Array { - return nil - } - var zero bool - correctLen := rv.Len() - correctType := reflect.ArrayOf(correctLen, reflect.TypeOf(zero)) - cpy := reflect.New(correctType) - _ = reflect.Copy(cpy.Elem(), rv) - return cpy.Elem().Slice(0, correctLen).Interface().([]bool) -} - -// AsInt64Slice converts an int64 array into a slice into with same elements as array. -func AsInt64Slice(v interface{}) []int64 { - rv := reflect.ValueOf(v) - if rv.Type().Kind() != reflect.Array { - return nil - } - var zero int64 - correctLen := rv.Len() - correctType := reflect.ArrayOf(correctLen, reflect.TypeOf(zero)) - cpy := reflect.New(correctType) - _ = reflect.Copy(cpy.Elem(), rv) - return cpy.Elem().Slice(0, correctLen).Interface().([]int64) -} - -// AsFloat64Slice converts a float64 array into a slice into with same elements as array. -func AsFloat64Slice(v interface{}) []float64 { - rv := reflect.ValueOf(v) - if rv.Type().Kind() != reflect.Array { - return nil - } - var zero float64 - correctLen := rv.Len() - correctType := reflect.ArrayOf(correctLen, reflect.TypeOf(zero)) - cpy := reflect.New(correctType) - _ = reflect.Copy(cpy.Elem(), rv) - return cpy.Elem().Slice(0, correctLen).Interface().([]float64) -} - -// AsStringSlice converts a string array into a slice into with same elements as array. -func AsStringSlice(v interface{}) []string { - rv := reflect.ValueOf(v) - if rv.Type().Kind() != reflect.Array { - return nil - } - var zero string - correctLen := rv.Len() - correctType := reflect.ArrayOf(correctLen, reflect.TypeOf(zero)) - cpy := reflect.New(correctType) - _ = reflect.Copy(cpy.Elem(), rv) - return cpy.Elem().Slice(0, correctLen).Interface().([]string) -} diff --git a/vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go b/vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go deleted file mode 100644 index b96e5408..00000000 --- a/vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -/* -Package baggage provides base types and functionality to store and retrieve -baggage in Go context. This package exists because the OpenTracing bridge to -OpenTelemetry needs to synchronize state whenever baggage for a context is -modified and that context contains an OpenTracing span. If it were not for -this need this package would not need to exist and the -`go.opentelemetry.io/otel/baggage` package would be the singular place where -W3C baggage is handled. -*/ -package baggage // import "go.opentelemetry.io/otel/internal/baggage" - -// List is the collection of baggage members. The W3C allows for duplicates, -// but OpenTelemetry does not, therefore, this is represented as a map. -type List map[string]Item - -// Item is the value and metadata properties part of a list-member. -type Item struct { - Value string - Properties []Property -} - -// Property is a metadata entry for a list-member. -type Property struct { - Key, Value string - - // HasValue indicates if a zero-value value means the property does not - // have a value or if it was the zero-value. - HasValue bool -} diff --git a/vendor/go.opentelemetry.io/otel/internal/baggage/context.go b/vendor/go.opentelemetry.io/otel/internal/baggage/context.go deleted file mode 100644 index 4469700d..00000000 --- a/vendor/go.opentelemetry.io/otel/internal/baggage/context.go +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package baggage // import "go.opentelemetry.io/otel/internal/baggage" - -import "context" - -type baggageContextKeyType int - -const baggageKey baggageContextKeyType = iota - -// SetHookFunc is a callback called when storing baggage in the context. -type SetHookFunc func(context.Context, List) context.Context - -// GetHookFunc is a callback called when getting baggage from the context. -type GetHookFunc func(context.Context, List) List - -type baggageState struct { - list List - - setHook SetHookFunc - getHook GetHookFunc -} - -// ContextWithSetHook returns a copy of parent with hook configured to be -// invoked every time ContextWithBaggage is called. -// -// Passing nil SetHookFunc creates a context with no set hook to call. -func ContextWithSetHook(parent context.Context, hook SetHookFunc) context.Context { - var s baggageState - if v, ok := parent.Value(baggageKey).(baggageState); ok { - s = v - } - - s.setHook = hook - return context.WithValue(parent, baggageKey, s) -} - -// ContextWithGetHook returns a copy of parent with hook configured to be -// invoked every time FromContext is called. -// -// Passing nil GetHookFunc creates a context with no get hook to call. -func ContextWithGetHook(parent context.Context, hook GetHookFunc) context.Context { - var s baggageState - if v, ok := parent.Value(baggageKey).(baggageState); ok { - s = v - } - - s.getHook = hook - return context.WithValue(parent, baggageKey, s) -} - -// ContextWithList returns a copy of parent with baggage. Passing nil list -// returns a context without any baggage. -func ContextWithList(parent context.Context, list List) context.Context { - var s baggageState - if v, ok := parent.Value(baggageKey).(baggageState); ok { - s = v - } - - s.list = list - ctx := context.WithValue(parent, baggageKey, s) - if s.setHook != nil { - ctx = s.setHook(ctx, list) - } - - return ctx -} - -// ListFromContext returns the baggage contained in ctx. -func ListFromContext(ctx context.Context) List { - switch v := ctx.Value(baggageKey).(type) { - case baggageState: - if v.getHook != nil { - return v.getHook(ctx, v.list) - } - return v.list - default: - return nil - } -} diff --git a/vendor/go.opentelemetry.io/otel/internal/gen.go b/vendor/go.opentelemetry.io/otel/internal/gen.go deleted file mode 100644 index f532f07e..00000000 --- a/vendor/go.opentelemetry.io/otel/internal/gen.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package internal // import "go.opentelemetry.io/otel/internal" - -//go:generate gotmpl --body=./shared/matchers/expectation.go.tmpl "--data={}" --out=matchers/expectation.go -//go:generate gotmpl --body=./shared/matchers/expecter.go.tmpl "--data={}" --out=matchers/expecter.go -//go:generate gotmpl --body=./shared/matchers/temporal_matcher.go.tmpl "--data={}" --out=matchers/temporal_matcher.go - -//go:generate gotmpl --body=./shared/internaltest/alignment.go.tmpl "--data={}" --out=internaltest/alignment.go -//go:generate gotmpl --body=./shared/internaltest/env.go.tmpl "--data={}" --out=internaltest/env.go -//go:generate gotmpl --body=./shared/internaltest/env_test.go.tmpl "--data={}" --out=internaltest/env_test.go -//go:generate gotmpl --body=./shared/internaltest/errors.go.tmpl "--data={}" --out=internaltest/errors.go -//go:generate gotmpl --body=./shared/internaltest/harness.go.tmpl "--data={\"matchersImportPath\": \"go.opentelemetry.io/otel/internal/matchers\"}" --out=internaltest/harness.go -//go:generate gotmpl --body=./shared/internaltest/text_map_carrier.go.tmpl "--data={}" --out=internaltest/text_map_carrier.go -//go:generate gotmpl --body=./shared/internaltest/text_map_carrier_test.go.tmpl "--data={}" --out=internaltest/text_map_carrier_test.go -//go:generate gotmpl --body=./shared/internaltest/text_map_propagator.go.tmpl "--data={}" --out=internaltest/text_map_propagator.go -//go:generate gotmpl --body=./shared/internaltest/text_map_propagator_test.go.tmpl "--data={}" --out=internaltest/text_map_propagator_test.go diff --git a/vendor/go.opentelemetry.io/otel/internal/global/handler.go b/vendor/go.opentelemetry.io/otel/internal/global/handler.go deleted file mode 100644 index 5e9b8304..00000000 --- a/vendor/go.opentelemetry.io/otel/internal/global/handler.go +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package global // import "go.opentelemetry.io/otel/internal/global" - -import ( - "log" - "os" - "sync/atomic" -) - -var ( - // GlobalErrorHandler provides an ErrorHandler that can be used - // throughout an OpenTelemetry instrumented project. When a user - // specified ErrorHandler is registered (`SetErrorHandler`) all calls to - // `Handle` and will be delegated to the registered ErrorHandler. - GlobalErrorHandler = defaultErrorHandler() - - // Compile-time check that delegator implements ErrorHandler. - _ ErrorHandler = (*ErrDelegator)(nil) - // Compile-time check that errLogger implements ErrorHandler. - _ ErrorHandler = (*ErrLogger)(nil) -) - -// ErrorHandler handles irremediable events. -type ErrorHandler interface { - // Handle handles any error deemed irremediable by an OpenTelemetry - // component. - Handle(error) -} - -type ErrDelegator struct { - delegate atomic.Pointer[ErrorHandler] -} - -func (d *ErrDelegator) Handle(err error) { - d.getDelegate().Handle(err) -} - -func (d *ErrDelegator) getDelegate() ErrorHandler { - return *d.delegate.Load() -} - -// setDelegate sets the ErrorHandler delegate. -func (d *ErrDelegator) setDelegate(eh ErrorHandler) { - d.delegate.Store(&eh) -} - -func defaultErrorHandler() *ErrDelegator { - d := &ErrDelegator{} - d.setDelegate(&ErrLogger{l: log.New(os.Stderr, "", log.LstdFlags)}) - return d -} - -// ErrLogger logs errors if no delegate is set, otherwise they are delegated. -type ErrLogger struct { - l *log.Logger -} - -// Handle logs err if no delegate is set, otherwise it is delegated. -func (h *ErrLogger) Handle(err error) { - h.l.Print(err) -} - -// GetErrorHandler returns the global ErrorHandler instance. -// -// The default ErrorHandler instance returned will log all errors to STDERR -// until an override ErrorHandler is set with SetErrorHandler. All -// ErrorHandler returned prior to this will automatically forward errors to -// the set instance instead of logging. -// -// Subsequent calls to SetErrorHandler after the first will not forward errors -// to the new ErrorHandler for prior returned instances. -func GetErrorHandler() ErrorHandler { - return GlobalErrorHandler -} - -// SetErrorHandler sets the global ErrorHandler to h. -// -// The first time this is called all ErrorHandler previously returned from -// GetErrorHandler will send errors to h instead of the default logging -// ErrorHandler. Subsequent calls will set the global ErrorHandler, but not -// delegate errors to h. -func SetErrorHandler(h ErrorHandler) { - GlobalErrorHandler.setDelegate(h) -} - -// Handle is a convenience function for ErrorHandler().Handle(err). -func Handle(err error) { - GetErrorHandler().Handle(err) -} diff --git a/vendor/go.opentelemetry.io/otel/internal/global/instruments.go b/vendor/go.opentelemetry.io/otel/internal/global/instruments.go deleted file mode 100644 index ebb13c20..00000000 --- a/vendor/go.opentelemetry.io/otel/internal/global/instruments.go +++ /dev/null @@ -1,371 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package global // import "go.opentelemetry.io/otel/internal/global" - -import ( - "context" - "sync/atomic" - - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/embedded" -) - -// unwrapper unwraps to return the underlying instrument implementation. -type unwrapper interface { - Unwrap() metric.Observable -} - -type afCounter struct { - embedded.Float64ObservableCounter - metric.Float64Observable - - name string - opts []metric.Float64ObservableCounterOption - - delegate atomic.Value // metric.Float64ObservableCounter -} - -var ( - _ unwrapper = (*afCounter)(nil) - _ metric.Float64ObservableCounter = (*afCounter)(nil) -) - -func (i *afCounter) setDelegate(m metric.Meter) { - ctr, err := m.Float64ObservableCounter(i.name, i.opts...) - if err != nil { - GetErrorHandler().Handle(err) - return - } - i.delegate.Store(ctr) -} - -func (i *afCounter) Unwrap() metric.Observable { - if ctr := i.delegate.Load(); ctr != nil { - return ctr.(metric.Float64ObservableCounter) - } - return nil -} - -type afUpDownCounter struct { - embedded.Float64ObservableUpDownCounter - metric.Float64Observable - - name string - opts []metric.Float64ObservableUpDownCounterOption - - delegate atomic.Value // metric.Float64ObservableUpDownCounter -} - -var ( - _ unwrapper = (*afUpDownCounter)(nil) - _ metric.Float64ObservableUpDownCounter = (*afUpDownCounter)(nil) -) - -func (i *afUpDownCounter) setDelegate(m metric.Meter) { - ctr, err := m.Float64ObservableUpDownCounter(i.name, i.opts...) - if err != nil { - GetErrorHandler().Handle(err) - return - } - i.delegate.Store(ctr) -} - -func (i *afUpDownCounter) Unwrap() metric.Observable { - if ctr := i.delegate.Load(); ctr != nil { - return ctr.(metric.Float64ObservableUpDownCounter) - } - return nil -} - -type afGauge struct { - embedded.Float64ObservableGauge - metric.Float64Observable - - name string - opts []metric.Float64ObservableGaugeOption - - delegate atomic.Value // metric.Float64ObservableGauge -} - -var ( - _ unwrapper = (*afGauge)(nil) - _ metric.Float64ObservableGauge = (*afGauge)(nil) -) - -func (i *afGauge) setDelegate(m metric.Meter) { - ctr, err := m.Float64ObservableGauge(i.name, i.opts...) - if err != nil { - GetErrorHandler().Handle(err) - return - } - i.delegate.Store(ctr) -} - -func (i *afGauge) Unwrap() metric.Observable { - if ctr := i.delegate.Load(); ctr != nil { - return ctr.(metric.Float64ObservableGauge) - } - return nil -} - -type aiCounter struct { - embedded.Int64ObservableCounter - metric.Int64Observable - - name string - opts []metric.Int64ObservableCounterOption - - delegate atomic.Value // metric.Int64ObservableCounter -} - -var ( - _ unwrapper = (*aiCounter)(nil) - _ metric.Int64ObservableCounter = (*aiCounter)(nil) -) - -func (i *aiCounter) setDelegate(m metric.Meter) { - ctr, err := m.Int64ObservableCounter(i.name, i.opts...) - if err != nil { - GetErrorHandler().Handle(err) - return - } - i.delegate.Store(ctr) -} - -func (i *aiCounter) Unwrap() metric.Observable { - if ctr := i.delegate.Load(); ctr != nil { - return ctr.(metric.Int64ObservableCounter) - } - return nil -} - -type aiUpDownCounter struct { - embedded.Int64ObservableUpDownCounter - metric.Int64Observable - - name string - opts []metric.Int64ObservableUpDownCounterOption - - delegate atomic.Value // metric.Int64ObservableUpDownCounter -} - -var ( - _ unwrapper = (*aiUpDownCounter)(nil) - _ metric.Int64ObservableUpDownCounter = (*aiUpDownCounter)(nil) -) - -func (i *aiUpDownCounter) setDelegate(m metric.Meter) { - ctr, err := m.Int64ObservableUpDownCounter(i.name, i.opts...) - if err != nil { - GetErrorHandler().Handle(err) - return - } - i.delegate.Store(ctr) -} - -func (i *aiUpDownCounter) Unwrap() metric.Observable { - if ctr := i.delegate.Load(); ctr != nil { - return ctr.(metric.Int64ObservableUpDownCounter) - } - return nil -} - -type aiGauge struct { - embedded.Int64ObservableGauge - metric.Int64Observable - - name string - opts []metric.Int64ObservableGaugeOption - - delegate atomic.Value // metric.Int64ObservableGauge -} - -var ( - _ unwrapper = (*aiGauge)(nil) - _ metric.Int64ObservableGauge = (*aiGauge)(nil) -) - -func (i *aiGauge) setDelegate(m metric.Meter) { - ctr, err := m.Int64ObservableGauge(i.name, i.opts...) - if err != nil { - GetErrorHandler().Handle(err) - return - } - i.delegate.Store(ctr) -} - -func (i *aiGauge) Unwrap() metric.Observable { - if ctr := i.delegate.Load(); ctr != nil { - return ctr.(metric.Int64ObservableGauge) - } - return nil -} - -// Sync Instruments. -type sfCounter struct { - embedded.Float64Counter - - name string - opts []metric.Float64CounterOption - - delegate atomic.Value // metric.Float64Counter -} - -var _ metric.Float64Counter = (*sfCounter)(nil) - -func (i *sfCounter) setDelegate(m metric.Meter) { - ctr, err := m.Float64Counter(i.name, i.opts...) - if err != nil { - GetErrorHandler().Handle(err) - return - } - i.delegate.Store(ctr) -} - -func (i *sfCounter) Add(ctx context.Context, incr float64, opts ...metric.AddOption) { - if ctr := i.delegate.Load(); ctr != nil { - ctr.(metric.Float64Counter).Add(ctx, incr, opts...) - } -} - -type sfUpDownCounter struct { - embedded.Float64UpDownCounter - - name string - opts []metric.Float64UpDownCounterOption - - delegate atomic.Value // metric.Float64UpDownCounter -} - -var _ metric.Float64UpDownCounter = (*sfUpDownCounter)(nil) - -func (i *sfUpDownCounter) setDelegate(m metric.Meter) { - ctr, err := m.Float64UpDownCounter(i.name, i.opts...) - if err != nil { - GetErrorHandler().Handle(err) - return - } - i.delegate.Store(ctr) -} - -func (i *sfUpDownCounter) Add(ctx context.Context, incr float64, opts ...metric.AddOption) { - if ctr := i.delegate.Load(); ctr != nil { - ctr.(metric.Float64UpDownCounter).Add(ctx, incr, opts...) - } -} - -type sfHistogram struct { - embedded.Float64Histogram - - name string - opts []metric.Float64HistogramOption - - delegate atomic.Value // metric.Float64Histogram -} - -var _ metric.Float64Histogram = (*sfHistogram)(nil) - -func (i *sfHistogram) setDelegate(m metric.Meter) { - ctr, err := m.Float64Histogram(i.name, i.opts...) - if err != nil { - GetErrorHandler().Handle(err) - return - } - i.delegate.Store(ctr) -} - -func (i *sfHistogram) Record(ctx context.Context, x float64, opts ...metric.RecordOption) { - if ctr := i.delegate.Load(); ctr != nil { - ctr.(metric.Float64Histogram).Record(ctx, x, opts...) - } -} - -type siCounter struct { - embedded.Int64Counter - - name string - opts []metric.Int64CounterOption - - delegate atomic.Value // metric.Int64Counter -} - -var _ metric.Int64Counter = (*siCounter)(nil) - -func (i *siCounter) setDelegate(m metric.Meter) { - ctr, err := m.Int64Counter(i.name, i.opts...) - if err != nil { - GetErrorHandler().Handle(err) - return - } - i.delegate.Store(ctr) -} - -func (i *siCounter) Add(ctx context.Context, x int64, opts ...metric.AddOption) { - if ctr := i.delegate.Load(); ctr != nil { - ctr.(metric.Int64Counter).Add(ctx, x, opts...) - } -} - -type siUpDownCounter struct { - embedded.Int64UpDownCounter - - name string - opts []metric.Int64UpDownCounterOption - - delegate atomic.Value // metric.Int64UpDownCounter -} - -var _ metric.Int64UpDownCounter = (*siUpDownCounter)(nil) - -func (i *siUpDownCounter) setDelegate(m metric.Meter) { - ctr, err := m.Int64UpDownCounter(i.name, i.opts...) - if err != nil { - GetErrorHandler().Handle(err) - return - } - i.delegate.Store(ctr) -} - -func (i *siUpDownCounter) Add(ctx context.Context, x int64, opts ...metric.AddOption) { - if ctr := i.delegate.Load(); ctr != nil { - ctr.(metric.Int64UpDownCounter).Add(ctx, x, opts...) - } -} - -type siHistogram struct { - embedded.Int64Histogram - - name string - opts []metric.Int64HistogramOption - - delegate atomic.Value // metric.Int64Histogram -} - -var _ metric.Int64Histogram = (*siHistogram)(nil) - -func (i *siHistogram) setDelegate(m metric.Meter) { - ctr, err := m.Int64Histogram(i.name, i.opts...) - if err != nil { - GetErrorHandler().Handle(err) - return - } - i.delegate.Store(ctr) -} - -func (i *siHistogram) Record(ctx context.Context, x int64, opts ...metric.RecordOption) { - if ctr := i.delegate.Load(); ctr != nil { - ctr.(metric.Int64Histogram).Record(ctx, x, opts...) - } -} diff --git a/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go b/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go deleted file mode 100644 index c6f305a2..00000000 --- a/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package global // import "go.opentelemetry.io/otel/internal/global" - -import ( - "log" - "os" - "sync/atomic" - - "github.com/go-logr/logr" - "github.com/go-logr/stdr" -) - -// globalLogger is the logging interface used within the otel api and sdk provide details of the internals. -// -// The default logger uses stdr which is backed by the standard `log.Logger` -// interface. This logger will only show messages at the Error Level. -var globalLogger atomic.Pointer[logr.Logger] - -func init() { - SetLogger(stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile))) -} - -// SetLogger overrides the globalLogger with l. -// -// To see Warn messages use a logger with `l.V(1).Enabled() == true` -// To see Info messages use a logger with `l.V(4).Enabled() == true` -// To see Debug messages use a logger with `l.V(8).Enabled() == true`. -func SetLogger(l logr.Logger) { - globalLogger.Store(&l) -} - -func getLogger() logr.Logger { - return *globalLogger.Load() -} - -// Info prints messages about the general state of the API or SDK. -// This should usually be less than 5 messages a minute. -func Info(msg string, keysAndValues ...interface{}) { - getLogger().V(4).Info(msg, keysAndValues...) -} - -// Error prints messages about exceptional states of the API or SDK. -func Error(err error, msg string, keysAndValues ...interface{}) { - getLogger().Error(err, msg, keysAndValues...) -} - -// Debug prints messages about all internal changes in the API or SDK. -func Debug(msg string, keysAndValues ...interface{}) { - getLogger().V(8).Info(msg, keysAndValues...) -} - -// Warn prints messages about warnings in the API or SDK. -// Not an error but is likely more important than an informational event. -func Warn(msg string, keysAndValues ...interface{}) { - getLogger().V(1).Info(msg, keysAndValues...) -} diff --git a/vendor/go.opentelemetry.io/otel/internal/global/meter.go b/vendor/go.opentelemetry.io/otel/internal/global/meter.go deleted file mode 100644 index 7ed61c0e..00000000 --- a/vendor/go.opentelemetry.io/otel/internal/global/meter.go +++ /dev/null @@ -1,356 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package global // import "go.opentelemetry.io/otel/internal/global" - -import ( - "container/list" - "sync" - "sync/atomic" - - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/embedded" -) - -// meterProvider is a placeholder for a configured SDK MeterProvider. -// -// All MeterProvider functionality is forwarded to a delegate once -// configured. -type meterProvider struct { - embedded.MeterProvider - - mtx sync.Mutex - meters map[il]*meter - - delegate metric.MeterProvider -} - -// setDelegate configures p to delegate all MeterProvider functionality to -// provider. -// -// All Meters provided prior to this function call are switched out to be -// Meters provided by provider. All instruments and callbacks are recreated and -// delegated. -// -// It is guaranteed by the caller that this happens only once. -func (p *meterProvider) setDelegate(provider metric.MeterProvider) { - p.mtx.Lock() - defer p.mtx.Unlock() - - p.delegate = provider - - if len(p.meters) == 0 { - return - } - - for _, meter := range p.meters { - meter.setDelegate(provider) - } - - p.meters = nil -} - -// Meter implements MeterProvider. -func (p *meterProvider) Meter(name string, opts ...metric.MeterOption) metric.Meter { - p.mtx.Lock() - defer p.mtx.Unlock() - - if p.delegate != nil { - return p.delegate.Meter(name, opts...) - } - - // At this moment it is guaranteed that no sdk is installed, save the meter in the meters map. - - c := metric.NewMeterConfig(opts...) - key := il{ - name: name, - version: c.InstrumentationVersion(), - } - - if p.meters == nil { - p.meters = make(map[il]*meter) - } - - if val, ok := p.meters[key]; ok { - return val - } - - t := &meter{name: name, opts: opts} - p.meters[key] = t - return t -} - -// meter is a placeholder for a metric.Meter. -// -// All Meter functionality is forwarded to a delegate once configured. -// Otherwise, all functionality is forwarded to a NoopMeter. -type meter struct { - embedded.Meter - - name string - opts []metric.MeterOption - - mtx sync.Mutex - instruments []delegatedInstrument - - registry list.List - - delegate atomic.Value // metric.Meter -} - -type delegatedInstrument interface { - setDelegate(metric.Meter) -} - -// setDelegate configures m to delegate all Meter functionality to Meters -// created by provider. -// -// All subsequent calls to the Meter methods will be passed to the delegate. -// -// It is guaranteed by the caller that this happens only once. -func (m *meter) setDelegate(provider metric.MeterProvider) { - meter := provider.Meter(m.name, m.opts...) - m.delegate.Store(meter) - - m.mtx.Lock() - defer m.mtx.Unlock() - - for _, inst := range m.instruments { - inst.setDelegate(meter) - } - - var n *list.Element - for e := m.registry.Front(); e != nil; e = n { - r := e.Value.(*registration) - r.setDelegate(meter) - n = e.Next() - m.registry.Remove(e) - } - - m.instruments = nil - m.registry.Init() -} - -func (m *meter) Int64Counter(name string, options ...metric.Int64CounterOption) (metric.Int64Counter, error) { - if del, ok := m.delegate.Load().(metric.Meter); ok { - return del.Int64Counter(name, options...) - } - m.mtx.Lock() - defer m.mtx.Unlock() - i := &siCounter{name: name, opts: options} - m.instruments = append(m.instruments, i) - return i, nil -} - -func (m *meter) Int64UpDownCounter(name string, options ...metric.Int64UpDownCounterOption) (metric.Int64UpDownCounter, error) { - if del, ok := m.delegate.Load().(metric.Meter); ok { - return del.Int64UpDownCounter(name, options...) - } - m.mtx.Lock() - defer m.mtx.Unlock() - i := &siUpDownCounter{name: name, opts: options} - m.instruments = append(m.instruments, i) - return i, nil -} - -func (m *meter) Int64Histogram(name string, options ...metric.Int64HistogramOption) (metric.Int64Histogram, error) { - if del, ok := m.delegate.Load().(metric.Meter); ok { - return del.Int64Histogram(name, options...) - } - m.mtx.Lock() - defer m.mtx.Unlock() - i := &siHistogram{name: name, opts: options} - m.instruments = append(m.instruments, i) - return i, nil -} - -func (m *meter) Int64ObservableCounter(name string, options ...metric.Int64ObservableCounterOption) (metric.Int64ObservableCounter, error) { - if del, ok := m.delegate.Load().(metric.Meter); ok { - return del.Int64ObservableCounter(name, options...) - } - m.mtx.Lock() - defer m.mtx.Unlock() - i := &aiCounter{name: name, opts: options} - m.instruments = append(m.instruments, i) - return i, nil -} - -func (m *meter) Int64ObservableUpDownCounter(name string, options ...metric.Int64ObservableUpDownCounterOption) (metric.Int64ObservableUpDownCounter, error) { - if del, ok := m.delegate.Load().(metric.Meter); ok { - return del.Int64ObservableUpDownCounter(name, options...) - } - m.mtx.Lock() - defer m.mtx.Unlock() - i := &aiUpDownCounter{name: name, opts: options} - m.instruments = append(m.instruments, i) - return i, nil -} - -func (m *meter) Int64ObservableGauge(name string, options ...metric.Int64ObservableGaugeOption) (metric.Int64ObservableGauge, error) { - if del, ok := m.delegate.Load().(metric.Meter); ok { - return del.Int64ObservableGauge(name, options...) - } - m.mtx.Lock() - defer m.mtx.Unlock() - i := &aiGauge{name: name, opts: options} - m.instruments = append(m.instruments, i) - return i, nil -} - -func (m *meter) Float64Counter(name string, options ...metric.Float64CounterOption) (metric.Float64Counter, error) { - if del, ok := m.delegate.Load().(metric.Meter); ok { - return del.Float64Counter(name, options...) - } - m.mtx.Lock() - defer m.mtx.Unlock() - i := &sfCounter{name: name, opts: options} - m.instruments = append(m.instruments, i) - return i, nil -} - -func (m *meter) Float64UpDownCounter(name string, options ...metric.Float64UpDownCounterOption) (metric.Float64UpDownCounter, error) { - if del, ok := m.delegate.Load().(metric.Meter); ok { - return del.Float64UpDownCounter(name, options...) - } - m.mtx.Lock() - defer m.mtx.Unlock() - i := &sfUpDownCounter{name: name, opts: options} - m.instruments = append(m.instruments, i) - return i, nil -} - -func (m *meter) Float64Histogram(name string, options ...metric.Float64HistogramOption) (metric.Float64Histogram, error) { - if del, ok := m.delegate.Load().(metric.Meter); ok { - return del.Float64Histogram(name, options...) - } - m.mtx.Lock() - defer m.mtx.Unlock() - i := &sfHistogram{name: name, opts: options} - m.instruments = append(m.instruments, i) - return i, nil -} - -func (m *meter) Float64ObservableCounter(name string, options ...metric.Float64ObservableCounterOption) (metric.Float64ObservableCounter, error) { - if del, ok := m.delegate.Load().(metric.Meter); ok { - return del.Float64ObservableCounter(name, options...) - } - m.mtx.Lock() - defer m.mtx.Unlock() - i := &afCounter{name: name, opts: options} - m.instruments = append(m.instruments, i) - return i, nil -} - -func (m *meter) Float64ObservableUpDownCounter(name string, options ...metric.Float64ObservableUpDownCounterOption) (metric.Float64ObservableUpDownCounter, error) { - if del, ok := m.delegate.Load().(metric.Meter); ok { - return del.Float64ObservableUpDownCounter(name, options...) - } - m.mtx.Lock() - defer m.mtx.Unlock() - i := &afUpDownCounter{name: name, opts: options} - m.instruments = append(m.instruments, i) - return i, nil -} - -func (m *meter) Float64ObservableGauge(name string, options ...metric.Float64ObservableGaugeOption) (metric.Float64ObservableGauge, error) { - if del, ok := m.delegate.Load().(metric.Meter); ok { - return del.Float64ObservableGauge(name, options...) - } - m.mtx.Lock() - defer m.mtx.Unlock() - i := &afGauge{name: name, opts: options} - m.instruments = append(m.instruments, i) - return i, nil -} - -// RegisterCallback captures the function that will be called during Collect. -func (m *meter) RegisterCallback(f metric.Callback, insts ...metric.Observable) (metric.Registration, error) { - if del, ok := m.delegate.Load().(metric.Meter); ok { - insts = unwrapInstruments(insts) - return del.RegisterCallback(f, insts...) - } - - m.mtx.Lock() - defer m.mtx.Unlock() - - reg := ®istration{instruments: insts, function: f} - e := m.registry.PushBack(reg) - reg.unreg = func() error { - m.mtx.Lock() - _ = m.registry.Remove(e) - m.mtx.Unlock() - return nil - } - return reg, nil -} - -type wrapped interface { - unwrap() metric.Observable -} - -func unwrapInstruments(instruments []metric.Observable) []metric.Observable { - out := make([]metric.Observable, 0, len(instruments)) - - for _, inst := range instruments { - if in, ok := inst.(wrapped); ok { - out = append(out, in.unwrap()) - } else { - out = append(out, inst) - } - } - - return out -} - -type registration struct { - embedded.Registration - - instruments []metric.Observable - function metric.Callback - - unreg func() error - unregMu sync.Mutex -} - -func (c *registration) setDelegate(m metric.Meter) { - insts := unwrapInstruments(c.instruments) - - c.unregMu.Lock() - defer c.unregMu.Unlock() - - if c.unreg == nil { - // Unregister already called. - return - } - - reg, err := m.RegisterCallback(c.function, insts...) - if err != nil { - GetErrorHandler().Handle(err) - } - - c.unreg = reg.Unregister -} - -func (c *registration) Unregister() error { - c.unregMu.Lock() - defer c.unregMu.Unlock() - if c.unreg == nil { - // Unregister already called. - return nil - } - - var err error - err, c.unreg = c.unreg(), nil - return err -} diff --git a/vendor/go.opentelemetry.io/otel/internal/global/propagator.go b/vendor/go.opentelemetry.io/otel/internal/global/propagator.go deleted file mode 100644 index 06bac35c..00000000 --- a/vendor/go.opentelemetry.io/otel/internal/global/propagator.go +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package global // import "go.opentelemetry.io/otel/internal/global" - -import ( - "context" - "sync" - - "go.opentelemetry.io/otel/propagation" -) - -// textMapPropagator is a default TextMapPropagator that delegates calls to a -// registered delegate if one is set, otherwise it defaults to delegating the -// calls to a the default no-op propagation.TextMapPropagator. -type textMapPropagator struct { - mtx sync.Mutex - once sync.Once - delegate propagation.TextMapPropagator - noop propagation.TextMapPropagator -} - -// Compile-time guarantee that textMapPropagator implements the -// propagation.TextMapPropagator interface. -var _ propagation.TextMapPropagator = (*textMapPropagator)(nil) - -func newTextMapPropagator() *textMapPropagator { - return &textMapPropagator{ - noop: propagation.NewCompositeTextMapPropagator(), - } -} - -// SetDelegate sets a delegate propagation.TextMapPropagator that all calls are -// forwarded to. Delegation can only be performed once, all subsequent calls -// perform no delegation. -func (p *textMapPropagator) SetDelegate(delegate propagation.TextMapPropagator) { - if delegate == nil { - return - } - - p.mtx.Lock() - p.once.Do(func() { p.delegate = delegate }) - p.mtx.Unlock() -} - -// effectiveDelegate returns the current delegate of p if one is set, -// otherwise the default noop TextMapPropagator is returned. This method -// can be called concurrently. -func (p *textMapPropagator) effectiveDelegate() propagation.TextMapPropagator { - p.mtx.Lock() - defer p.mtx.Unlock() - if p.delegate != nil { - return p.delegate - } - return p.noop -} - -// Inject set cross-cutting concerns from the Context into the carrier. -func (p *textMapPropagator) Inject(ctx context.Context, carrier propagation.TextMapCarrier) { - p.effectiveDelegate().Inject(ctx, carrier) -} - -// Extract reads cross-cutting concerns from the carrier into a Context. -func (p *textMapPropagator) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context { - return p.effectiveDelegate().Extract(ctx, carrier) -} - -// Fields returns the keys whose values are set with Inject. -func (p *textMapPropagator) Fields() []string { - return p.effectiveDelegate().Fields() -} diff --git a/vendor/go.opentelemetry.io/otel/internal/global/state.go b/vendor/go.opentelemetry.io/otel/internal/global/state.go deleted file mode 100644 index 386c8bfd..00000000 --- a/vendor/go.opentelemetry.io/otel/internal/global/state.go +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package global // import "go.opentelemetry.io/otel/internal/global" - -import ( - "errors" - "sync" - "sync/atomic" - - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/propagation" - "go.opentelemetry.io/otel/trace" -) - -type ( - tracerProviderHolder struct { - tp trace.TracerProvider - } - - propagatorsHolder struct { - tm propagation.TextMapPropagator - } - - meterProviderHolder struct { - mp metric.MeterProvider - } -) - -var ( - globalTracer = defaultTracerValue() - globalPropagators = defaultPropagatorsValue() - globalMeterProvider = defaultMeterProvider() - - delegateTraceOnce sync.Once - delegateTextMapPropagatorOnce sync.Once - delegateMeterOnce sync.Once -) - -// TracerProvider is the internal implementation for global.TracerProvider. -func TracerProvider() trace.TracerProvider { - return globalTracer.Load().(tracerProviderHolder).tp -} - -// SetTracerProvider is the internal implementation for global.SetTracerProvider. -func SetTracerProvider(tp trace.TracerProvider) { - current := TracerProvider() - - if _, cOk := current.(*tracerProvider); cOk { - if _, tpOk := tp.(*tracerProvider); tpOk && current == tp { - // Do not assign the default delegating TracerProvider to delegate - // to itself. - Error( - errors.New("no delegate configured in tracer provider"), - "Setting tracer provider to its current value. No delegate will be configured", - ) - return - } - } - - delegateTraceOnce.Do(func() { - if def, ok := current.(*tracerProvider); ok { - def.setDelegate(tp) - } - }) - globalTracer.Store(tracerProviderHolder{tp: tp}) -} - -// TextMapPropagator is the internal implementation for global.TextMapPropagator. -func TextMapPropagator() propagation.TextMapPropagator { - return globalPropagators.Load().(propagatorsHolder).tm -} - -// SetTextMapPropagator is the internal implementation for global.SetTextMapPropagator. -func SetTextMapPropagator(p propagation.TextMapPropagator) { - current := TextMapPropagator() - - if _, cOk := current.(*textMapPropagator); cOk { - if _, pOk := p.(*textMapPropagator); pOk && current == p { - // Do not assign the default delegating TextMapPropagator to - // delegate to itself. - Error( - errors.New("no delegate configured in text map propagator"), - "Setting text map propagator to its current value. No delegate will be configured", - ) - return - } - } - - // For the textMapPropagator already returned by TextMapPropagator - // delegate to p. - delegateTextMapPropagatorOnce.Do(func() { - if def, ok := current.(*textMapPropagator); ok { - def.SetDelegate(p) - } - }) - // Return p when subsequent calls to TextMapPropagator are made. - globalPropagators.Store(propagatorsHolder{tm: p}) -} - -// MeterProvider is the internal implementation for global.MeterProvider. -func MeterProvider() metric.MeterProvider { - return globalMeterProvider.Load().(meterProviderHolder).mp -} - -// SetMeterProvider is the internal implementation for global.SetMeterProvider. -func SetMeterProvider(mp metric.MeterProvider) { - current := MeterProvider() - if _, cOk := current.(*meterProvider); cOk { - if _, mpOk := mp.(*meterProvider); mpOk && current == mp { - // Do not assign the default delegating MeterProvider to delegate - // to itself. - Error( - errors.New("no delegate configured in meter provider"), - "Setting meter provider to its current value. No delegate will be configured", - ) - return - } - } - - delegateMeterOnce.Do(func() { - if def, ok := current.(*meterProvider); ok { - def.setDelegate(mp) - } - }) - globalMeterProvider.Store(meterProviderHolder{mp: mp}) -} - -func defaultTracerValue() *atomic.Value { - v := &atomic.Value{} - v.Store(tracerProviderHolder{tp: &tracerProvider{}}) - return v -} - -func defaultPropagatorsValue() *atomic.Value { - v := &atomic.Value{} - v.Store(propagatorsHolder{tm: newTextMapPropagator()}) - return v -} - -func defaultMeterProvider() *atomic.Value { - v := &atomic.Value{} - v.Store(meterProviderHolder{mp: &meterProvider{}}) - return v -} diff --git a/vendor/go.opentelemetry.io/otel/internal/global/trace.go b/vendor/go.opentelemetry.io/otel/internal/global/trace.go deleted file mode 100644 index 3f61ec12..00000000 --- a/vendor/go.opentelemetry.io/otel/internal/global/trace.go +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package global // import "go.opentelemetry.io/otel/internal/global" - -/* -This file contains the forwarding implementation of the TracerProvider used as -the default global instance. Prior to initialization of an SDK, Tracers -returned by the global TracerProvider will provide no-op functionality. This -means that all Span created prior to initialization are no-op Spans. - -Once an SDK has been initialized, all provided no-op Tracers are swapped for -Tracers provided by the SDK defined TracerProvider. However, any Span started -prior to this initialization does not change its behavior. Meaning, the Span -remains a no-op Span. - -The implementation to track and swap Tracers locks all new Tracer creation -until the swap is complete. This assumes that this operation is not -performance-critical. If that assumption is incorrect, be sure to configure an -SDK prior to any Tracer creation. -*/ - -import ( - "context" - "sync" - "sync/atomic" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/trace" - "go.opentelemetry.io/otel/trace/embedded" -) - -// tracerProvider is a placeholder for a configured SDK TracerProvider. -// -// All TracerProvider functionality is forwarded to a delegate once -// configured. -type tracerProvider struct { - embedded.TracerProvider - - mtx sync.Mutex - tracers map[il]*tracer - delegate trace.TracerProvider -} - -// Compile-time guarantee that tracerProvider implements the TracerProvider -// interface. -var _ trace.TracerProvider = &tracerProvider{} - -// setDelegate configures p to delegate all TracerProvider functionality to -// provider. -// -// All Tracers provided prior to this function call are switched out to be -// Tracers provided by provider. -// -// It is guaranteed by the caller that this happens only once. -func (p *tracerProvider) setDelegate(provider trace.TracerProvider) { - p.mtx.Lock() - defer p.mtx.Unlock() - - p.delegate = provider - - if len(p.tracers) == 0 { - return - } - - for _, t := range p.tracers { - t.setDelegate(provider) - } - - p.tracers = nil -} - -// Tracer implements TracerProvider. -func (p *tracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.Tracer { - p.mtx.Lock() - defer p.mtx.Unlock() - - if p.delegate != nil { - return p.delegate.Tracer(name, opts...) - } - - // At this moment it is guaranteed that no sdk is installed, save the tracer in the tracers map. - - c := trace.NewTracerConfig(opts...) - key := il{ - name: name, - version: c.InstrumentationVersion(), - } - - if p.tracers == nil { - p.tracers = make(map[il]*tracer) - } - - if val, ok := p.tracers[key]; ok { - return val - } - - t := &tracer{name: name, opts: opts, provider: p} - p.tracers[key] = t - return t -} - -type il struct { - name string - version string -} - -// tracer is a placeholder for a trace.Tracer. -// -// All Tracer functionality is forwarded to a delegate once configured. -// Otherwise, all functionality is forwarded to a NoopTracer. -type tracer struct { - embedded.Tracer - - name string - opts []trace.TracerOption - provider *tracerProvider - - delegate atomic.Value -} - -// Compile-time guarantee that tracer implements the trace.Tracer interface. -var _ trace.Tracer = &tracer{} - -// setDelegate configures t to delegate all Tracer functionality to Tracers -// created by provider. -// -// All subsequent calls to the Tracer methods will be passed to the delegate. -// -// It is guaranteed by the caller that this happens only once. -func (t *tracer) setDelegate(provider trace.TracerProvider) { - t.delegate.Store(provider.Tracer(t.name, t.opts...)) -} - -// Start implements trace.Tracer by forwarding the call to t.delegate if -// set, otherwise it forwards the call to a NoopTracer. -func (t *tracer) Start(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span) { - delegate := t.delegate.Load() - if delegate != nil { - return delegate.(trace.Tracer).Start(ctx, name, opts...) - } - - s := nonRecordingSpan{sc: trace.SpanContextFromContext(ctx), tracer: t} - ctx = trace.ContextWithSpan(ctx, s) - return ctx, s -} - -// nonRecordingSpan is a minimal implementation of a Span that wraps a -// SpanContext. It performs no operations other than to return the wrapped -// SpanContext. -type nonRecordingSpan struct { - embedded.Span - - sc trace.SpanContext - tracer *tracer -} - -var _ trace.Span = nonRecordingSpan{} - -// SpanContext returns the wrapped SpanContext. -func (s nonRecordingSpan) SpanContext() trace.SpanContext { return s.sc } - -// IsRecording always returns false. -func (nonRecordingSpan) IsRecording() bool { return false } - -// SetStatus does nothing. -func (nonRecordingSpan) SetStatus(codes.Code, string) {} - -// SetError does nothing. -func (nonRecordingSpan) SetError(bool) {} - -// SetAttributes does nothing. -func (nonRecordingSpan) SetAttributes(...attribute.KeyValue) {} - -// End does nothing. -func (nonRecordingSpan) End(...trace.SpanEndOption) {} - -// RecordError does nothing. -func (nonRecordingSpan) RecordError(error, ...trace.EventOption) {} - -// AddEvent does nothing. -func (nonRecordingSpan) AddEvent(string, ...trace.EventOption) {} - -// SetName does nothing. -func (nonRecordingSpan) SetName(string) {} - -func (s nonRecordingSpan) TracerProvider() trace.TracerProvider { return s.tracer.provider } diff --git a/vendor/go.opentelemetry.io/otel/internal/rawhelpers.go b/vendor/go.opentelemetry.io/otel/internal/rawhelpers.go deleted file mode 100644 index e07e7940..00000000 --- a/vendor/go.opentelemetry.io/otel/internal/rawhelpers.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package internal // import "go.opentelemetry.io/otel/internal" - -import ( - "math" - "unsafe" -) - -func BoolToRaw(b bool) uint64 { // nolint:revive // b is not a control flag. - if b { - return 1 - } - return 0 -} - -func RawToBool(r uint64) bool { - return r != 0 -} - -func Int64ToRaw(i int64) uint64 { - return uint64(i) -} - -func RawToInt64(r uint64) int64 { - return int64(r) -} - -func Float64ToRaw(f float64) uint64 { - return math.Float64bits(f) -} - -func RawToFloat64(r uint64) float64 { - return math.Float64frombits(r) -} - -func RawPtrToFloat64Ptr(r *uint64) *float64 { - return (*float64)(unsafe.Pointer(r)) -} - -func RawPtrToInt64Ptr(r *uint64) *int64 { - return (*int64)(unsafe.Pointer(r)) -} diff --git a/vendor/go.opentelemetry.io/otel/internal_logging.go b/vendor/go.opentelemetry.io/otel/internal_logging.go deleted file mode 100644 index c4f8acd5..00000000 --- a/vendor/go.opentelemetry.io/otel/internal_logging.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package otel // import "go.opentelemetry.io/otel" - -import ( - "github.com/go-logr/logr" - - "go.opentelemetry.io/otel/internal/global" -) - -// SetLogger configures the logger used internally to opentelemetry. -func SetLogger(logger logr.Logger) { - global.SetLogger(logger) -} diff --git a/vendor/go.opentelemetry.io/otel/metric.go b/vendor/go.opentelemetry.io/otel/metric.go deleted file mode 100644 index f9551719..00000000 --- a/vendor/go.opentelemetry.io/otel/metric.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package otel // import "go.opentelemetry.io/otel" - -import ( - "go.opentelemetry.io/otel/internal/global" - "go.opentelemetry.io/otel/metric" -) - -// Meter returns a Meter from the global MeterProvider. The name must be the -// name of the library providing instrumentation. This name may be the same as -// the instrumented code only if that code provides built-in instrumentation. -// If the name is empty, then a implementation defined default name will be -// used instead. -// -// If this is called before a global MeterProvider is registered the returned -// Meter will be a No-op implementation of a Meter. When a global MeterProvider -// is registered for the first time, the returned Meter, and all the -// instruments it has created or will create, are recreated automatically from -// the new MeterProvider. -// -// This is short for GetMeterProvider().Meter(name). -func Meter(name string, opts ...metric.MeterOption) metric.Meter { - return GetMeterProvider().Meter(name, opts...) -} - -// GetMeterProvider returns the registered global meter provider. -// -// If no global GetMeterProvider has been registered, a No-op GetMeterProvider -// implementation is returned. When a global GetMeterProvider is registered for -// the first time, the returned GetMeterProvider, and all the Meters it has -// created or will create, are recreated automatically from the new -// GetMeterProvider. -func GetMeterProvider() metric.MeterProvider { - return global.MeterProvider() -} - -// SetMeterProvider registers mp as the global MeterProvider. -func SetMeterProvider(mp metric.MeterProvider) { - global.SetMeterProvider(mp) -} diff --git a/vendor/go.opentelemetry.io/otel/metric/LICENSE b/vendor/go.opentelemetry.io/otel/metric/LICENSE deleted file mode 100644 index 261eeb9e..00000000 --- a/vendor/go.opentelemetry.io/otel/metric/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. diff --git a/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go b/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go deleted file mode 100644 index 072baa8e..00000000 --- a/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go +++ /dev/null @@ -1,271 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package metric // import "go.opentelemetry.io/otel/metric" - -import ( - "context" - - "go.opentelemetry.io/otel/metric/embedded" -) - -// Float64Observable describes a set of instruments used asynchronously to -// record float64 measurements once per collection cycle. Observations of -// these instruments are only made within a callback. -// -// Warning: Methods may be added to this interface in minor releases. -type Float64Observable interface { - Observable - - float64Observable() -} - -// Float64ObservableCounter is an instrument used to asynchronously record -// increasing float64 measurements once per collection cycle. Observations are -// only made within a callback for this instrument. The value observed is -// assumed the to be the cumulative sum of the count. -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for -// unimplemented methods. -type Float64ObservableCounter interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.Float64ObservableCounter - - Float64Observable -} - -// Float64ObservableCounterConfig contains options for asynchronous counter -// instruments that record int64 values. -type Float64ObservableCounterConfig struct { - description string - unit string - callbacks []Float64Callback -} - -// NewFloat64ObservableCounterConfig returns a new -// [Float64ObservableCounterConfig] with all opts applied. -func NewFloat64ObservableCounterConfig(opts ...Float64ObservableCounterOption) Float64ObservableCounterConfig { - var config Float64ObservableCounterConfig - for _, o := range opts { - config = o.applyFloat64ObservableCounter(config) - } - return config -} - -// Description returns the configured description. -func (c Float64ObservableCounterConfig) Description() string { - return c.description -} - -// Unit returns the configured unit. -func (c Float64ObservableCounterConfig) Unit() string { - return c.unit -} - -// Callbacks returns the configured callbacks. -func (c Float64ObservableCounterConfig) Callbacks() []Float64Callback { - return c.callbacks -} - -// Float64ObservableCounterOption applies options to a -// [Float64ObservableCounterConfig]. See [Float64ObservableOption] and -// [InstrumentOption] for other options that can be used as a -// Float64ObservableCounterOption. -type Float64ObservableCounterOption interface { - applyFloat64ObservableCounter(Float64ObservableCounterConfig) Float64ObservableCounterConfig -} - -// Float64ObservableUpDownCounter is an instrument used to asynchronously -// record float64 measurements once per collection cycle. Observations are only -// made within a callback for this instrument. The value observed is assumed -// the to be the cumulative sum of the count. -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type Float64ObservableUpDownCounter interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.Float64ObservableUpDownCounter - - Float64Observable -} - -// Float64ObservableUpDownCounterConfig contains options for asynchronous -// counter instruments that record int64 values. -type Float64ObservableUpDownCounterConfig struct { - description string - unit string - callbacks []Float64Callback -} - -// NewFloat64ObservableUpDownCounterConfig returns a new -// [Float64ObservableUpDownCounterConfig] with all opts applied. -func NewFloat64ObservableUpDownCounterConfig(opts ...Float64ObservableUpDownCounterOption) Float64ObservableUpDownCounterConfig { - var config Float64ObservableUpDownCounterConfig - for _, o := range opts { - config = o.applyFloat64ObservableUpDownCounter(config) - } - return config -} - -// Description returns the configured description. -func (c Float64ObservableUpDownCounterConfig) Description() string { - return c.description -} - -// Unit returns the configured unit. -func (c Float64ObservableUpDownCounterConfig) Unit() string { - return c.unit -} - -// Callbacks returns the configured callbacks. -func (c Float64ObservableUpDownCounterConfig) Callbacks() []Float64Callback { - return c.callbacks -} - -// Float64ObservableUpDownCounterOption applies options to a -// [Float64ObservableUpDownCounterConfig]. See [Float64ObservableOption] and -// [InstrumentOption] for other options that can be used as a -// Float64ObservableUpDownCounterOption. -type Float64ObservableUpDownCounterOption interface { - applyFloat64ObservableUpDownCounter(Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig -} - -// Float64ObservableGauge is an instrument used to asynchronously record -// instantaneous float64 measurements once per collection cycle. Observations -// are only made within a callback for this instrument. -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type Float64ObservableGauge interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.Float64ObservableGauge - - Float64Observable -} - -// Float64ObservableGaugeConfig contains options for asynchronous counter -// instruments that record int64 values. -type Float64ObservableGaugeConfig struct { - description string - unit string - callbacks []Float64Callback -} - -// NewFloat64ObservableGaugeConfig returns a new [Float64ObservableGaugeConfig] -// with all opts applied. -func NewFloat64ObservableGaugeConfig(opts ...Float64ObservableGaugeOption) Float64ObservableGaugeConfig { - var config Float64ObservableGaugeConfig - for _, o := range opts { - config = o.applyFloat64ObservableGauge(config) - } - return config -} - -// Description returns the configured description. -func (c Float64ObservableGaugeConfig) Description() string { - return c.description -} - -// Unit returns the configured unit. -func (c Float64ObservableGaugeConfig) Unit() string { - return c.unit -} - -// Callbacks returns the configured callbacks. -func (c Float64ObservableGaugeConfig) Callbacks() []Float64Callback { - return c.callbacks -} - -// Float64ObservableGaugeOption applies options to a -// [Float64ObservableGaugeConfig]. See [Float64ObservableOption] and -// [InstrumentOption] for other options that can be used as a -// Float64ObservableGaugeOption. -type Float64ObservableGaugeOption interface { - applyFloat64ObservableGauge(Float64ObservableGaugeConfig) Float64ObservableGaugeConfig -} - -// Float64Observer is a recorder of float64 measurements. -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type Float64Observer interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.Float64Observer - - // Observe records the float64 value. - // - // Use the WithAttributeSet (or, if performance is not a concern, - // the WithAttributes) option to include measurement attributes. - Observe(value float64, options ...ObserveOption) -} - -// Float64Callback is a function registered with a Meter that makes -// observations for a Float64Observerable instrument it is registered with. -// Calls to the Float64Observer record measurement values for the -// Float64Observable. -// -// The function needs to complete in a finite amount of time and the deadline -// of the passed context is expected to be honored. -// -// The function needs to make unique observations across all registered -// Float64Callbacks. Meaning, it should not report measurements with the same -// attributes as another Float64Callbacks also registered for the same -// instrument. -// -// The function needs to be concurrent safe. -type Float64Callback func(context.Context, Float64Observer) error - -// Float64ObservableOption applies options to float64 Observer instruments. -type Float64ObservableOption interface { - Float64ObservableCounterOption - Float64ObservableUpDownCounterOption - Float64ObservableGaugeOption -} - -type float64CallbackOpt struct { - cback Float64Callback -} - -func (o float64CallbackOpt) applyFloat64ObservableCounter(cfg Float64ObservableCounterConfig) Float64ObservableCounterConfig { - cfg.callbacks = append(cfg.callbacks, o.cback) - return cfg -} - -func (o float64CallbackOpt) applyFloat64ObservableUpDownCounter(cfg Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig { - cfg.callbacks = append(cfg.callbacks, o.cback) - return cfg -} - -func (o float64CallbackOpt) applyFloat64ObservableGauge(cfg Float64ObservableGaugeConfig) Float64ObservableGaugeConfig { - cfg.callbacks = append(cfg.callbacks, o.cback) - return cfg -} - -// WithFloat64Callback adds callback to be called for an instrument. -func WithFloat64Callback(callback Float64Callback) Float64ObservableOption { - return float64CallbackOpt{callback} -} diff --git a/vendor/go.opentelemetry.io/otel/metric/asyncint64.go b/vendor/go.opentelemetry.io/otel/metric/asyncint64.go deleted file mode 100644 index 9bd6ebf0..00000000 --- a/vendor/go.opentelemetry.io/otel/metric/asyncint64.go +++ /dev/null @@ -1,269 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package metric // import "go.opentelemetry.io/otel/metric" - -import ( - "context" - - "go.opentelemetry.io/otel/metric/embedded" -) - -// Int64Observable describes a set of instruments used asynchronously to record -// int64 measurements once per collection cycle. Observations of these -// instruments are only made within a callback. -// -// Warning: Methods may be added to this interface in minor releases. -type Int64Observable interface { - Observable - - int64Observable() -} - -// Int64ObservableCounter is an instrument used to asynchronously record -// increasing int64 measurements once per collection cycle. Observations are -// only made within a callback for this instrument. The value observed is -// assumed the to be the cumulative sum of the count. -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type Int64ObservableCounter interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.Int64ObservableCounter - - Int64Observable -} - -// Int64ObservableCounterConfig contains options for asynchronous counter -// instruments that record int64 values. -type Int64ObservableCounterConfig struct { - description string - unit string - callbacks []Int64Callback -} - -// NewInt64ObservableCounterConfig returns a new [Int64ObservableCounterConfig] -// with all opts applied. -func NewInt64ObservableCounterConfig(opts ...Int64ObservableCounterOption) Int64ObservableCounterConfig { - var config Int64ObservableCounterConfig - for _, o := range opts { - config = o.applyInt64ObservableCounter(config) - } - return config -} - -// Description returns the configured description. -func (c Int64ObservableCounterConfig) Description() string { - return c.description -} - -// Unit returns the configured unit. -func (c Int64ObservableCounterConfig) Unit() string { - return c.unit -} - -// Callbacks returns the configured callbacks. -func (c Int64ObservableCounterConfig) Callbacks() []Int64Callback { - return c.callbacks -} - -// Int64ObservableCounterOption applies options to a -// [Int64ObservableCounterConfig]. See [Int64ObservableOption] and -// [InstrumentOption] for other options that can be used as an -// Int64ObservableCounterOption. -type Int64ObservableCounterOption interface { - applyInt64ObservableCounter(Int64ObservableCounterConfig) Int64ObservableCounterConfig -} - -// Int64ObservableUpDownCounter is an instrument used to asynchronously record -// int64 measurements once per collection cycle. Observations are only made -// within a callback for this instrument. The value observed is assumed the to -// be the cumulative sum of the count. -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type Int64ObservableUpDownCounter interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.Int64ObservableUpDownCounter - - Int64Observable -} - -// Int64ObservableUpDownCounterConfig contains options for asynchronous counter -// instruments that record int64 values. -type Int64ObservableUpDownCounterConfig struct { - description string - unit string - callbacks []Int64Callback -} - -// NewInt64ObservableUpDownCounterConfig returns a new -// [Int64ObservableUpDownCounterConfig] with all opts applied. -func NewInt64ObservableUpDownCounterConfig(opts ...Int64ObservableUpDownCounterOption) Int64ObservableUpDownCounterConfig { - var config Int64ObservableUpDownCounterConfig - for _, o := range opts { - config = o.applyInt64ObservableUpDownCounter(config) - } - return config -} - -// Description returns the configured description. -func (c Int64ObservableUpDownCounterConfig) Description() string { - return c.description -} - -// Unit returns the configured unit. -func (c Int64ObservableUpDownCounterConfig) Unit() string { - return c.unit -} - -// Callbacks returns the configured callbacks. -func (c Int64ObservableUpDownCounterConfig) Callbacks() []Int64Callback { - return c.callbacks -} - -// Int64ObservableUpDownCounterOption applies options to a -// [Int64ObservableUpDownCounterConfig]. See [Int64ObservableOption] and -// [InstrumentOption] for other options that can be used as an -// Int64ObservableUpDownCounterOption. -type Int64ObservableUpDownCounterOption interface { - applyInt64ObservableUpDownCounter(Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig -} - -// Int64ObservableGauge is an instrument used to asynchronously record -// instantaneous int64 measurements once per collection cycle. Observations are -// only made within a callback for this instrument. -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type Int64ObservableGauge interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.Int64ObservableGauge - - Int64Observable -} - -// Int64ObservableGaugeConfig contains options for asynchronous counter -// instruments that record int64 values. -type Int64ObservableGaugeConfig struct { - description string - unit string - callbacks []Int64Callback -} - -// NewInt64ObservableGaugeConfig returns a new [Int64ObservableGaugeConfig] -// with all opts applied. -func NewInt64ObservableGaugeConfig(opts ...Int64ObservableGaugeOption) Int64ObservableGaugeConfig { - var config Int64ObservableGaugeConfig - for _, o := range opts { - config = o.applyInt64ObservableGauge(config) - } - return config -} - -// Description returns the configured description. -func (c Int64ObservableGaugeConfig) Description() string { - return c.description -} - -// Unit returns the configured unit. -func (c Int64ObservableGaugeConfig) Unit() string { - return c.unit -} - -// Callbacks returns the configured callbacks. -func (c Int64ObservableGaugeConfig) Callbacks() []Int64Callback { - return c.callbacks -} - -// Int64ObservableGaugeOption applies options to a -// [Int64ObservableGaugeConfig]. See [Int64ObservableOption] and -// [InstrumentOption] for other options that can be used as an -// Int64ObservableGaugeOption. -type Int64ObservableGaugeOption interface { - applyInt64ObservableGauge(Int64ObservableGaugeConfig) Int64ObservableGaugeConfig -} - -// Int64Observer is a recorder of int64 measurements. -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type Int64Observer interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.Int64Observer - - // Observe records the int64 value. - // - // Use the WithAttributeSet (or, if performance is not a concern, - // the WithAttributes) option to include measurement attributes. - Observe(value int64, options ...ObserveOption) -} - -// Int64Callback is a function registered with a Meter that makes observations -// for an Int64Observerable instrument it is registered with. Calls to the -// Int64Observer record measurement values for the Int64Observable. -// -// The function needs to complete in a finite amount of time and the deadline -// of the passed context is expected to be honored. -// -// The function needs to make unique observations across all registered -// Int64Callbacks. Meaning, it should not report measurements with the same -// attributes as another Int64Callbacks also registered for the same -// instrument. -// -// The function needs to be concurrent safe. -type Int64Callback func(context.Context, Int64Observer) error - -// Int64ObservableOption applies options to int64 Observer instruments. -type Int64ObservableOption interface { - Int64ObservableCounterOption - Int64ObservableUpDownCounterOption - Int64ObservableGaugeOption -} - -type int64CallbackOpt struct { - cback Int64Callback -} - -func (o int64CallbackOpt) applyInt64ObservableCounter(cfg Int64ObservableCounterConfig) Int64ObservableCounterConfig { - cfg.callbacks = append(cfg.callbacks, o.cback) - return cfg -} - -func (o int64CallbackOpt) applyInt64ObservableUpDownCounter(cfg Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig { - cfg.callbacks = append(cfg.callbacks, o.cback) - return cfg -} - -func (o int64CallbackOpt) applyInt64ObservableGauge(cfg Int64ObservableGaugeConfig) Int64ObservableGaugeConfig { - cfg.callbacks = append(cfg.callbacks, o.cback) - return cfg -} - -// WithInt64Callback adds callback to be called for an instrument. -func WithInt64Callback(callback Int64Callback) Int64ObservableOption { - return int64CallbackOpt{callback} -} diff --git a/vendor/go.opentelemetry.io/otel/metric/config.go b/vendor/go.opentelemetry.io/otel/metric/config.go deleted file mode 100644 index 778ad2d7..00000000 --- a/vendor/go.opentelemetry.io/otel/metric/config.go +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package metric // import "go.opentelemetry.io/otel/metric" - -import "go.opentelemetry.io/otel/attribute" - -// MeterConfig contains options for Meters. -type MeterConfig struct { - instrumentationVersion string - schemaURL string - attrs attribute.Set - - // Ensure forward compatibility by explicitly making this not comparable. - noCmp [0]func() //nolint: unused // This is indeed used. -} - -// InstrumentationVersion returns the version of the library providing -// instrumentation. -func (cfg MeterConfig) InstrumentationVersion() string { - return cfg.instrumentationVersion -} - -// InstrumentationAttributes returns the attributes associated with the library -// providing instrumentation. -func (cfg MeterConfig) InstrumentationAttributes() attribute.Set { - return cfg.attrs -} - -// SchemaURL is the schema_url of the library providing instrumentation. -func (cfg MeterConfig) SchemaURL() string { - return cfg.schemaURL -} - -// MeterOption is an interface for applying Meter options. -type MeterOption interface { - // applyMeter is used to set a MeterOption value of a MeterConfig. - applyMeter(MeterConfig) MeterConfig -} - -// NewMeterConfig creates a new MeterConfig and applies -// all the given options. -func NewMeterConfig(opts ...MeterOption) MeterConfig { - var config MeterConfig - for _, o := range opts { - config = o.applyMeter(config) - } - return config -} - -type meterOptionFunc func(MeterConfig) MeterConfig - -func (fn meterOptionFunc) applyMeter(cfg MeterConfig) MeterConfig { - return fn(cfg) -} - -// WithInstrumentationVersion sets the instrumentation version. -func WithInstrumentationVersion(version string) MeterOption { - return meterOptionFunc(func(config MeterConfig) MeterConfig { - config.instrumentationVersion = version - return config - }) -} - -// WithInstrumentationAttributes sets the instrumentation attributes. -// -// The passed attributes will be de-duplicated. -func WithInstrumentationAttributes(attr ...attribute.KeyValue) MeterOption { - return meterOptionFunc(func(config MeterConfig) MeterConfig { - config.attrs = attribute.NewSet(attr...) - return config - }) -} - -// WithSchemaURL sets the schema URL. -func WithSchemaURL(schemaURL string) MeterOption { - return meterOptionFunc(func(config MeterConfig) MeterConfig { - config.schemaURL = schemaURL - return config - }) -} diff --git a/vendor/go.opentelemetry.io/otel/metric/doc.go b/vendor/go.opentelemetry.io/otel/metric/doc.go deleted file mode 100644 index 54716e13..00000000 --- a/vendor/go.opentelemetry.io/otel/metric/doc.go +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -/* -Package metric provides the OpenTelemetry API used to measure metrics about -source code operation. - -This API is separate from its implementation so the instrumentation built from -it is reusable. See [go.opentelemetry.io/otel/sdk/metric] for the official -OpenTelemetry implementation of this API. - -All measurements made with this package are made via instruments. These -instruments are created by a [Meter] which itself is created by a -[MeterProvider]. Applications need to accept a [MeterProvider] implementation -as a starting point when instrumenting. This can be done directly, or by using -the OpenTelemetry global MeterProvider via [GetMeterProvider]. Using an -appropriately named [Meter] from the accepted [MeterProvider], instrumentation -can then be built from the [Meter]'s instruments. - -# Instruments - -Each instrument is designed to make measurements of a particular type. Broadly, -all instruments fall into two overlapping logical categories: asynchronous or -synchronous, and int64 or float64. - -All synchronous instruments ([Int64Counter], [Int64UpDownCounter], -[Int64Histogram], [Float64Counter], [Float64UpDownCounter], and -[Float64Histogram]) are used to measure the operation and performance of source -code during the source code execution. These instruments only make measurements -when the source code they instrument is run. - -All asynchronous instruments ([Int64ObservableCounter], -[Int64ObservableUpDownCounter], [Int64ObservableGauge], -[Float64ObservableCounter], [Float64ObservableUpDownCounter], and -[Float64ObservableGauge]) are used to measure metrics outside of the execution -of source code. They are said to make "observations" via a callback function -called once every measurement collection cycle. - -Each instrument is also grouped by the value type it measures. Either int64 or -float64. The value being measured will dictate which instrument in these -categories to use. - -Outside of these two broad categories, instruments are described by the -function they are designed to serve. All Counters ([Int64Counter], -[Float64Counter], [Int64ObservableCounter], and [Float64ObservableCounter]) are -designed to measure values that never decrease in value, but instead only -incrementally increase in value. UpDownCounters ([Int64UpDownCounter], -[Float64UpDownCounter], [Int64ObservableUpDownCounter], and -[Float64ObservableUpDownCounter]) on the other hand, are designed to measure -values that can increase and decrease. When more information needs to be -conveyed about all the synchronous measurements made during a collection cycle, -a Histogram ([Int64Histogram] and [Float64Histogram]) should be used. Finally, -when just the most recent measurement needs to be conveyed about an -asynchronous measurement, a Gauge ([Int64ObservableGauge] and -[Float64ObservableGauge]) should be used. - -See the [OpenTelemetry documentation] for more information about instruments -and their intended use. - -# Measurements - -Measurements are made by recording values and information about the values with -an instrument. How these measurements are recorded depends on the instrument. - -Measurements for synchronous instruments ([Int64Counter], [Int64UpDownCounter], -[Int64Histogram], [Float64Counter], [Float64UpDownCounter], and -[Float64Histogram]) are recorded using the instrument methods directly. All -counter instruments have an Add method that is used to measure an increment -value, and all histogram instruments have a Record method to measure a data -point. - -Asynchronous instruments ([Int64ObservableCounter], -[Int64ObservableUpDownCounter], [Int64ObservableGauge], -[Float64ObservableCounter], [Float64ObservableUpDownCounter], and -[Float64ObservableGauge]) record measurements within a callback function. The -callback is registered with the Meter which ensures the callback is called once -per collection cycle. A callback can be registered two ways: during the -instrument's creation using an option, or later using the RegisterCallback -method of the [Meter] that created the instrument. - -If the following criteria are met, an option ([WithInt64Callback] or -[WithFloat64Callback]) can be used during the asynchronous instrument's -creation to register a callback ([Int64Callback] or [Float64Callback], -respectively): - - - The measurement process is known when the instrument is created - - Only that instrument will make a measurement within the callback - - The callback never needs to be unregistered - -If the criteria are not met, use the RegisterCallback method of the [Meter] that -created the instrument to register a [Callback]. - -# API Implementations - -This package does not conform to the standard Go versioning policy, all of its -interfaces may have methods added to them without a package major version bump. -This non-standard API evolution could surprise an uninformed implementation -author. They could unknowingly build their implementation in a way that would -result in a runtime panic for their users that update to the new API. - -The API is designed to help inform an instrumentation author about this -non-standard API evolution. It requires them to choose a default behavior for -unimplemented interface methods. There are three behavior choices they can -make: - - - Compilation failure - - Panic - - Default to another implementation - -All interfaces in this API embed a corresponding interface from -[go.opentelemetry.io/otel/metric/embedded]. If an author wants the default -behavior of their implementations to be a compilation failure, signaling to -their users they need to update to the latest version of that implementation, -they need to embed the corresponding interface from -[go.opentelemetry.io/otel/metric/embedded] in their implementation. For -example, - - import "go.opentelemetry.io/otel/metric/embedded" - - type MeterProvider struct { - embedded.MeterProvider - // ... - } - -If an author wants the default behavior of their implementations to a panic, -they need to embed the API interface directly. - - import "go.opentelemetry.io/otel/metric" - - type MeterProvider struct { - metric.MeterProvider - // ... - } - -This is not a recommended behavior as it could lead to publishing packages that -contain runtime panics when users update other package that use newer versions -of [go.opentelemetry.io/otel/metric]. - -Finally, an author can embed another implementation in theirs. The embedded -implementation will be used for methods not defined by the author. For example, -an author who wants to default to silently dropping the call can use -[go.opentelemetry.io/otel/metric/noop]: - - import "go.opentelemetry.io/otel/metric/noop" - - type MeterProvider struct { - noop.MeterProvider - // ... - } - -It is strongly recommended that authors only embed -[go.opentelemetry.io/otel/metric/noop] if they choose this default behavior. -That implementation is the only one OpenTelemetry authors can guarantee will -fully implement all the API interfaces when a user updates their API. - -[OpenTelemetry documentation]: https://opentelemetry.io/docs/concepts/signals/metrics/ -[GetMeterProvider]: https://pkg.go.dev/go.opentelemetry.io/otel#GetMeterProvider -*/ -package metric // import "go.opentelemetry.io/otel/metric" diff --git a/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go b/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go deleted file mode 100644 index ae0bdbd2..00000000 --- a/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go +++ /dev/null @@ -1,234 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -// Package embedded provides interfaces embedded within the [OpenTelemetry -// metric API]. -// -// Implementers of the [OpenTelemetry metric API] can embed the relevant type -// from this package into their implementation directly. Doing so will result -// in a compilation error for users when the [OpenTelemetry metric API] is -// extended (which is something that can happen without a major version bump of -// the API package). -// -// [OpenTelemetry metric API]: https://pkg.go.dev/go.opentelemetry.io/otel/metric -package embedded // import "go.opentelemetry.io/otel/metric/embedded" - -// MeterProvider is embedded in -// [go.opentelemetry.io/otel/metric.MeterProvider]. -// -// Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric.MeterProvider] if you want users to -// experience a compilation error, signaling they need to update to your latest -// implementation, when the [go.opentelemetry.io/otel/metric.MeterProvider] -// interface is extended (which is something that can happen without a major -// version bump of the API package). -type MeterProvider interface{ meterProvider() } - -// Meter is embedded in [go.opentelemetry.io/otel/metric.Meter]. -// -// Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric.Meter] if you want users to experience a -// compilation error, signaling they need to update to your latest -// implementation, when the [go.opentelemetry.io/otel/metric.Meter] interface -// is extended (which is something that can happen without a major version bump -// of the API package). -type Meter interface{ meter() } - -// Float64Observer is embedded in -// [go.opentelemetry.io/otel/metric.Float64Observer]. -// -// Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric.Float64Observer] if you want -// users to experience a compilation error, signaling they need to update to -// your latest implementation, when the -// [go.opentelemetry.io/otel/metric.Float64Observer] interface is -// extended (which is something that can happen without a major version bump of -// the API package). -type Float64Observer interface{ float64Observer() } - -// Int64Observer is embedded in -// [go.opentelemetry.io/otel/metric.Int64Observer]. -// -// Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric.Int64Observer] if you want users -// to experience a compilation error, signaling they need to update to your -// latest implementation, when the -// [go.opentelemetry.io/otel/metric.Int64Observer] interface is -// extended (which is something that can happen without a major version bump of -// the API package). -type Int64Observer interface{ int64Observer() } - -// Observer is embedded in [go.opentelemetry.io/otel/metric.Observer]. -// -// Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric.Observer] if you want users to experience a -// compilation error, signaling they need to update to your latest -// implementation, when the [go.opentelemetry.io/otel/metric.Observer] -// interface is extended (which is something that can happen without a major -// version bump of the API package). -type Observer interface{ observer() } - -// Registration is embedded in [go.opentelemetry.io/otel/metric.Registration]. -// -// Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric.Registration] if you want users to -// experience a compilation error, signaling they need to update to your latest -// implementation, when the [go.opentelemetry.io/otel/metric.Registration] -// interface is extended (which is something that can happen without a major -// version bump of the API package). -type Registration interface{ registration() } - -// Float64Counter is embedded in -// [go.opentelemetry.io/otel/metric.Float64Counter]. -// -// Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric.Float64Counter] if you want -// users to experience a compilation error, signaling they need to update to -// your latest implementation, when the -// [go.opentelemetry.io/otel/metric.Float64Counter] interface is -// extended (which is something that can happen without a major version bump of -// the API package). -type Float64Counter interface{ float64Counter() } - -// Float64Histogram is embedded in -// [go.opentelemetry.io/otel/metric.Float64Histogram]. -// -// Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric.Float64Histogram] if you want -// users to experience a compilation error, signaling they need to update to -// your latest implementation, when the -// [go.opentelemetry.io/otel/metric.Float64Histogram] interface is -// extended (which is something that can happen without a major version bump of -// the API package). -type Float64Histogram interface{ float64Histogram() } - -// Float64ObservableCounter is embedded in -// [go.opentelemetry.io/otel/metric.Float64ObservableCounter]. -// -// Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric.Float64ObservableCounter] if you -// want users to experience a compilation error, signaling they need to update -// to your latest implementation, when the -// [go.opentelemetry.io/otel/metric.Float64ObservableCounter] -// interface is extended (which is something that can happen without a major -// version bump of the API package). -type Float64ObservableCounter interface{ float64ObservableCounter() } - -// Float64ObservableGauge is embedded in -// [go.opentelemetry.io/otel/metric.Float64ObservableGauge]. -// -// Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric.Float64ObservableGauge] if you -// want users to experience a compilation error, signaling they need to update -// to your latest implementation, when the -// [go.opentelemetry.io/otel/metric.Float64ObservableGauge] -// interface is extended (which is something that can happen without a major -// version bump of the API package). -type Float64ObservableGauge interface{ float64ObservableGauge() } - -// Float64ObservableUpDownCounter is embedded in -// [go.opentelemetry.io/otel/metric.Float64ObservableUpDownCounter]. -// -// Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric.Float64ObservableUpDownCounter] -// if you want users to experience a compilation error, signaling they need to -// update to your latest implementation, when the -// [go.opentelemetry.io/otel/metric.Float64ObservableUpDownCounter] -// interface is extended (which is something that can happen without a major -// version bump of the API package). -type Float64ObservableUpDownCounter interface{ float64ObservableUpDownCounter() } - -// Float64UpDownCounter is embedded in -// [go.opentelemetry.io/otel/metric.Float64UpDownCounter]. -// -// Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric.Float64UpDownCounter] if you -// want users to experience a compilation error, signaling they need to update -// to your latest implementation, when the -// [go.opentelemetry.io/otel/metric.Float64UpDownCounter] interface -// is extended (which is something that can happen without a major version bump -// of the API package). -type Float64UpDownCounter interface{ float64UpDownCounter() } - -// Int64Counter is embedded in -// [go.opentelemetry.io/otel/metric.Int64Counter]. -// -// Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric.Int64Counter] if you want users -// to experience a compilation error, signaling they need to update to your -// latest implementation, when the -// [go.opentelemetry.io/otel/metric.Int64Counter] interface is -// extended (which is something that can happen without a major version bump of -// the API package). -type Int64Counter interface{ int64Counter() } - -// Int64Histogram is embedded in -// [go.opentelemetry.io/otel/metric.Int64Histogram]. -// -// Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric.Int64Histogram] if you want -// users to experience a compilation error, signaling they need to update to -// your latest implementation, when the -// [go.opentelemetry.io/otel/metric.Int64Histogram] interface is -// extended (which is something that can happen without a major version bump of -// the API package). -type Int64Histogram interface{ int64Histogram() } - -// Int64ObservableCounter is embedded in -// [go.opentelemetry.io/otel/metric.Int64ObservableCounter]. -// -// Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric.Int64ObservableCounter] if you -// want users to experience a compilation error, signaling they need to update -// to your latest implementation, when the -// [go.opentelemetry.io/otel/metric.Int64ObservableCounter] -// interface is extended (which is something that can happen without a major -// version bump of the API package). -type Int64ObservableCounter interface{ int64ObservableCounter() } - -// Int64ObservableGauge is embedded in -// [go.opentelemetry.io/otel/metric.Int64ObservableGauge]. -// -// Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric.Int64ObservableGauge] if you -// want users to experience a compilation error, signaling they need to update -// to your latest implementation, when the -// [go.opentelemetry.io/otel/metric.Int64ObservableGauge] interface -// is extended (which is something that can happen without a major version bump -// of the API package). -type Int64ObservableGauge interface{ int64ObservableGauge() } - -// Int64ObservableUpDownCounter is embedded in -// [go.opentelemetry.io/otel/metric.Int64ObservableUpDownCounter]. -// -// Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric.Int64ObservableUpDownCounter] if -// you want users to experience a compilation error, signaling they need to -// update to your latest implementation, when the -// [go.opentelemetry.io/otel/metric.Int64ObservableUpDownCounter] -// interface is extended (which is something that can happen without a major -// version bump of the API package). -type Int64ObservableUpDownCounter interface{ int64ObservableUpDownCounter() } - -// Int64UpDownCounter is embedded in -// [go.opentelemetry.io/otel/metric.Int64UpDownCounter]. -// -// Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric.Int64UpDownCounter] if you want -// users to experience a compilation error, signaling they need to update to -// your latest implementation, when the -// [go.opentelemetry.io/otel/metric.Int64UpDownCounter] interface is -// extended (which is something that can happen without a major version bump of -// the API package). -type Int64UpDownCounter interface{ int64UpDownCounter() } diff --git a/vendor/go.opentelemetry.io/otel/metric/instrument.go b/vendor/go.opentelemetry.io/otel/metric/instrument.go deleted file mode 100644 index be89cd53..00000000 --- a/vendor/go.opentelemetry.io/otel/metric/instrument.go +++ /dev/null @@ -1,357 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package metric // import "go.opentelemetry.io/otel/metric" - -import "go.opentelemetry.io/otel/attribute" - -// Observable is used as a grouping mechanism for all instruments that are -// updated within a Callback. -type Observable interface { - observable() -} - -// InstrumentOption applies options to all instruments. -type InstrumentOption interface { - Int64CounterOption - Int64UpDownCounterOption - Int64HistogramOption - Int64ObservableCounterOption - Int64ObservableUpDownCounterOption - Int64ObservableGaugeOption - - Float64CounterOption - Float64UpDownCounterOption - Float64HistogramOption - Float64ObservableCounterOption - Float64ObservableUpDownCounterOption - Float64ObservableGaugeOption -} - -// HistogramOption applies options to histogram instruments. -type HistogramOption interface { - Int64HistogramOption - Float64HistogramOption -} - -type descOpt string - -func (o descOpt) applyFloat64Counter(c Float64CounterConfig) Float64CounterConfig { - c.description = string(o) - return c -} - -func (o descOpt) applyFloat64UpDownCounter(c Float64UpDownCounterConfig) Float64UpDownCounterConfig { - c.description = string(o) - return c -} - -func (o descOpt) applyFloat64Histogram(c Float64HistogramConfig) Float64HistogramConfig { - c.description = string(o) - return c -} - -func (o descOpt) applyFloat64ObservableCounter(c Float64ObservableCounterConfig) Float64ObservableCounterConfig { - c.description = string(o) - return c -} - -func (o descOpt) applyFloat64ObservableUpDownCounter(c Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig { - c.description = string(o) - return c -} - -func (o descOpt) applyFloat64ObservableGauge(c Float64ObservableGaugeConfig) Float64ObservableGaugeConfig { - c.description = string(o) - return c -} - -func (o descOpt) applyInt64Counter(c Int64CounterConfig) Int64CounterConfig { - c.description = string(o) - return c -} - -func (o descOpt) applyInt64UpDownCounter(c Int64UpDownCounterConfig) Int64UpDownCounterConfig { - c.description = string(o) - return c -} - -func (o descOpt) applyInt64Histogram(c Int64HistogramConfig) Int64HistogramConfig { - c.description = string(o) - return c -} - -func (o descOpt) applyInt64ObservableCounter(c Int64ObservableCounterConfig) Int64ObservableCounterConfig { - c.description = string(o) - return c -} - -func (o descOpt) applyInt64ObservableUpDownCounter(c Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig { - c.description = string(o) - return c -} - -func (o descOpt) applyInt64ObservableGauge(c Int64ObservableGaugeConfig) Int64ObservableGaugeConfig { - c.description = string(o) - return c -} - -// WithDescription sets the instrument description. -func WithDescription(desc string) InstrumentOption { return descOpt(desc) } - -type unitOpt string - -func (o unitOpt) applyFloat64Counter(c Float64CounterConfig) Float64CounterConfig { - c.unit = string(o) - return c -} - -func (o unitOpt) applyFloat64UpDownCounter(c Float64UpDownCounterConfig) Float64UpDownCounterConfig { - c.unit = string(o) - return c -} - -func (o unitOpt) applyFloat64Histogram(c Float64HistogramConfig) Float64HistogramConfig { - c.unit = string(o) - return c -} - -func (o unitOpt) applyFloat64ObservableCounter(c Float64ObservableCounterConfig) Float64ObservableCounterConfig { - c.unit = string(o) - return c -} - -func (o unitOpt) applyFloat64ObservableUpDownCounter(c Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig { - c.unit = string(o) - return c -} - -func (o unitOpt) applyFloat64ObservableGauge(c Float64ObservableGaugeConfig) Float64ObservableGaugeConfig { - c.unit = string(o) - return c -} - -func (o unitOpt) applyInt64Counter(c Int64CounterConfig) Int64CounterConfig { - c.unit = string(o) - return c -} - -func (o unitOpt) applyInt64UpDownCounter(c Int64UpDownCounterConfig) Int64UpDownCounterConfig { - c.unit = string(o) - return c -} - -func (o unitOpt) applyInt64Histogram(c Int64HistogramConfig) Int64HistogramConfig { - c.unit = string(o) - return c -} - -func (o unitOpt) applyInt64ObservableCounter(c Int64ObservableCounterConfig) Int64ObservableCounterConfig { - c.unit = string(o) - return c -} - -func (o unitOpt) applyInt64ObservableUpDownCounter(c Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig { - c.unit = string(o) - return c -} - -func (o unitOpt) applyInt64ObservableGauge(c Int64ObservableGaugeConfig) Int64ObservableGaugeConfig { - c.unit = string(o) - return c -} - -// WithUnit sets the instrument unit. -// -// The unit u should be defined using the appropriate [UCUM](https://ucum.org) case-sensitive code. -func WithUnit(u string) InstrumentOption { return unitOpt(u) } - -// WithExplicitBucketBoundaries sets the instrument explicit bucket boundaries. -// -// This option is considered "advisory", and may be ignored by API implementations. -func WithExplicitBucketBoundaries(bounds ...float64) HistogramOption { return bucketOpt(bounds) } - -type bucketOpt []float64 - -func (o bucketOpt) applyFloat64Histogram(c Float64HistogramConfig) Float64HistogramConfig { - c.explicitBucketBoundaries = o - return c -} - -func (o bucketOpt) applyInt64Histogram(c Int64HistogramConfig) Int64HistogramConfig { - c.explicitBucketBoundaries = o - return c -} - -// AddOption applies options to an addition measurement. See -// [MeasurementOption] for other options that can be used as an AddOption. -type AddOption interface { - applyAdd(AddConfig) AddConfig -} - -// AddConfig contains options for an addition measurement. -type AddConfig struct { - attrs attribute.Set -} - -// NewAddConfig returns a new [AddConfig] with all opts applied. -func NewAddConfig(opts []AddOption) AddConfig { - config := AddConfig{attrs: *attribute.EmptySet()} - for _, o := range opts { - config = o.applyAdd(config) - } - return config -} - -// Attributes returns the configured attribute set. -func (c AddConfig) Attributes() attribute.Set { - return c.attrs -} - -// RecordOption applies options to an addition measurement. See -// [MeasurementOption] for other options that can be used as a RecordOption. -type RecordOption interface { - applyRecord(RecordConfig) RecordConfig -} - -// RecordConfig contains options for a recorded measurement. -type RecordConfig struct { - attrs attribute.Set -} - -// NewRecordConfig returns a new [RecordConfig] with all opts applied. -func NewRecordConfig(opts []RecordOption) RecordConfig { - config := RecordConfig{attrs: *attribute.EmptySet()} - for _, o := range opts { - config = o.applyRecord(config) - } - return config -} - -// Attributes returns the configured attribute set. -func (c RecordConfig) Attributes() attribute.Set { - return c.attrs -} - -// ObserveOption applies options to an addition measurement. See -// [MeasurementOption] for other options that can be used as a ObserveOption. -type ObserveOption interface { - applyObserve(ObserveConfig) ObserveConfig -} - -// ObserveConfig contains options for an observed measurement. -type ObserveConfig struct { - attrs attribute.Set -} - -// NewObserveConfig returns a new [ObserveConfig] with all opts applied. -func NewObserveConfig(opts []ObserveOption) ObserveConfig { - config := ObserveConfig{attrs: *attribute.EmptySet()} - for _, o := range opts { - config = o.applyObserve(config) - } - return config -} - -// Attributes returns the configured attribute set. -func (c ObserveConfig) Attributes() attribute.Set { - return c.attrs -} - -// MeasurementOption applies options to all instrument measurement. -type MeasurementOption interface { - AddOption - RecordOption - ObserveOption -} - -type attrOpt struct { - set attribute.Set -} - -// mergeSets returns the union of keys between a and b. Any duplicate keys will -// use the value associated with b. -func mergeSets(a, b attribute.Set) attribute.Set { - // NewMergeIterator uses the first value for any duplicates. - iter := attribute.NewMergeIterator(&b, &a) - merged := make([]attribute.KeyValue, 0, a.Len()+b.Len()) - for iter.Next() { - merged = append(merged, iter.Attribute()) - } - return attribute.NewSet(merged...) -} - -func (o attrOpt) applyAdd(c AddConfig) AddConfig { - switch { - case o.set.Len() == 0: - case c.attrs.Len() == 0: - c.attrs = o.set - default: - c.attrs = mergeSets(c.attrs, o.set) - } - return c -} - -func (o attrOpt) applyRecord(c RecordConfig) RecordConfig { - switch { - case o.set.Len() == 0: - case c.attrs.Len() == 0: - c.attrs = o.set - default: - c.attrs = mergeSets(c.attrs, o.set) - } - return c -} - -func (o attrOpt) applyObserve(c ObserveConfig) ObserveConfig { - switch { - case o.set.Len() == 0: - case c.attrs.Len() == 0: - c.attrs = o.set - default: - c.attrs = mergeSets(c.attrs, o.set) - } - return c -} - -// WithAttributeSet sets the attribute Set associated with a measurement is -// made with. -// -// If multiple WithAttributeSet or WithAttributes options are passed the -// attributes will be merged together in the order they are passed. Attributes -// with duplicate keys will use the last value passed. -func WithAttributeSet(attributes attribute.Set) MeasurementOption { - return attrOpt{set: attributes} -} - -// WithAttributes converts attributes into an attribute Set and sets the Set to -// be associated with a measurement. This is shorthand for: -// -// cp := make([]attribute.KeyValue, len(attributes)) -// copy(cp, attributes) -// WithAttributes(attribute.NewSet(cp...)) -// -// [attribute.NewSet] may modify the passed attributes so this will make a copy -// of attributes before creating a set in order to ensure this function is -// concurrent safe. This makes this option function less optimized in -// comparison to [WithAttributeSet]. Therefore, [WithAttributeSet] should be -// preferred for performance sensitive code. -// -// See [WithAttributeSet] for information about how multiple WithAttributes are -// merged. -func WithAttributes(attributes ...attribute.KeyValue) MeasurementOption { - cp := make([]attribute.KeyValue, len(attributes)) - copy(cp, attributes) - return attrOpt{set: attribute.NewSet(cp...)} -} diff --git a/vendor/go.opentelemetry.io/otel/metric/meter.go b/vendor/go.opentelemetry.io/otel/metric/meter.go deleted file mode 100644 index 2520bc74..00000000 --- a/vendor/go.opentelemetry.io/otel/metric/meter.go +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package metric // import "go.opentelemetry.io/otel/metric" - -import ( - "context" - - "go.opentelemetry.io/otel/metric/embedded" -) - -// MeterProvider provides access to named Meter instances, for instrumenting -// an application or package. -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type MeterProvider interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.MeterProvider - - // Meter returns a new Meter with the provided name and configuration. - // - // A Meter should be scoped at most to a single package. The name needs to - // be unique so it does not collide with other names used by - // an application, nor other applications. To achieve this, the import path - // of the instrumentation package is recommended to be used as name. - // - // If the name is empty, then an implementation defined default name will - // be used instead. - Meter(name string, opts ...MeterOption) Meter -} - -// Meter provides access to instrument instances for recording metrics. -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type Meter interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.Meter - - // Int64Counter returns a new Int64Counter instrument identified by name - // and configured with options. The instrument is used to synchronously - // record increasing int64 measurements during a computational operation. - Int64Counter(name string, options ...Int64CounterOption) (Int64Counter, error) - // Int64UpDownCounter returns a new Int64UpDownCounter instrument - // identified by name and configured with options. The instrument is used - // to synchronously record int64 measurements during a computational - // operation. - Int64UpDownCounter(name string, options ...Int64UpDownCounterOption) (Int64UpDownCounter, error) - // Int64Histogram returns a new Int64Histogram instrument identified by - // name and configured with options. The instrument is used to - // synchronously record the distribution of int64 measurements during a - // computational operation. - Int64Histogram(name string, options ...Int64HistogramOption) (Int64Histogram, error) - // Int64ObservableCounter returns a new Int64ObservableCounter identified - // by name and configured with options. The instrument is used to - // asynchronously record increasing int64 measurements once per a - // measurement collection cycle. - // - // Measurements for the returned instrument are made via a callback. Use - // the WithInt64Callback option to register the callback here, or use the - // RegisterCallback method of this Meter to register one later. See the - // Measurements section of the package documentation for more information. - Int64ObservableCounter(name string, options ...Int64ObservableCounterOption) (Int64ObservableCounter, error) - // Int64ObservableUpDownCounter returns a new Int64ObservableUpDownCounter - // instrument identified by name and configured with options. The - // instrument is used to asynchronously record int64 measurements once per - // a measurement collection cycle. - // - // Measurements for the returned instrument are made via a callback. Use - // the WithInt64Callback option to register the callback here, or use the - // RegisterCallback method of this Meter to register one later. See the - // Measurements section of the package documentation for more information. - Int64ObservableUpDownCounter(name string, options ...Int64ObservableUpDownCounterOption) (Int64ObservableUpDownCounter, error) - // Int64ObservableGauge returns a new Int64ObservableGauge instrument - // identified by name and configured with options. The instrument is used - // to asynchronously record instantaneous int64 measurements once per a - // measurement collection cycle. - // - // Measurements for the returned instrument are made via a callback. Use - // the WithInt64Callback option to register the callback here, or use the - // RegisterCallback method of this Meter to register one later. See the - // Measurements section of the package documentation for more information. - Int64ObservableGauge(name string, options ...Int64ObservableGaugeOption) (Int64ObservableGauge, error) - - // Float64Counter returns a new Float64Counter instrument identified by - // name and configured with options. The instrument is used to - // synchronously record increasing float64 measurements during a - // computational operation. - Float64Counter(name string, options ...Float64CounterOption) (Float64Counter, error) - // Float64UpDownCounter returns a new Float64UpDownCounter instrument - // identified by name and configured with options. The instrument is used - // to synchronously record float64 measurements during a computational - // operation. - Float64UpDownCounter(name string, options ...Float64UpDownCounterOption) (Float64UpDownCounter, error) - // Float64Histogram returns a new Float64Histogram instrument identified by - // name and configured with options. The instrument is used to - // synchronously record the distribution of float64 measurements during a - // computational operation. - Float64Histogram(name string, options ...Float64HistogramOption) (Float64Histogram, error) - // Float64ObservableCounter returns a new Float64ObservableCounter - // instrument identified by name and configured with options. The - // instrument is used to asynchronously record increasing float64 - // measurements once per a measurement collection cycle. - // - // Measurements for the returned instrument are made via a callback. Use - // the WithFloat64Callback option to register the callback here, or use the - // RegisterCallback method of this Meter to register one later. See the - // Measurements section of the package documentation for more information. - Float64ObservableCounter(name string, options ...Float64ObservableCounterOption) (Float64ObservableCounter, error) - // Float64ObservableUpDownCounter returns a new - // Float64ObservableUpDownCounter instrument identified by name and - // configured with options. The instrument is used to asynchronously record - // float64 measurements once per a measurement collection cycle. - // - // Measurements for the returned instrument are made via a callback. Use - // the WithFloat64Callback option to register the callback here, or use the - // RegisterCallback method of this Meter to register one later. See the - // Measurements section of the package documentation for more information. - Float64ObservableUpDownCounter(name string, options ...Float64ObservableUpDownCounterOption) (Float64ObservableUpDownCounter, error) - // Float64ObservableGauge returns a new Float64ObservableGauge instrument - // identified by name and configured with options. The instrument is used - // to asynchronously record instantaneous float64 measurements once per a - // measurement collection cycle. - // - // Measurements for the returned instrument are made via a callback. Use - // the WithFloat64Callback option to register the callback here, or use the - // RegisterCallback method of this Meter to register one later. See the - // Measurements section of the package documentation for more information. - Float64ObservableGauge(name string, options ...Float64ObservableGaugeOption) (Float64ObservableGauge, error) - - // RegisterCallback registers f to be called during the collection of a - // measurement cycle. - // - // If Unregister of the returned Registration is called, f needs to be - // unregistered and not called during collection. - // - // The instruments f is registered with are the only instruments that f may - // observe values for. - // - // If no instruments are passed, f should not be registered nor called - // during collection. - // - // The function f needs to be concurrent safe. - RegisterCallback(f Callback, instruments ...Observable) (Registration, error) -} - -// Callback is a function registered with a Meter that makes observations for -// the set of instruments it is registered with. The Observer parameter is used -// to record measurement observations for these instruments. -// -// The function needs to complete in a finite amount of time and the deadline -// of the passed context is expected to be honored. -// -// The function needs to make unique observations across all registered -// Callbacks. Meaning, it should not report measurements for an instrument with -// the same attributes as another Callback will report. -// -// The function needs to be concurrent safe. -type Callback func(context.Context, Observer) error - -// Observer records measurements for multiple instruments in a Callback. -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type Observer interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.Observer - - // ObserveFloat64 records the float64 value for obsrv. - ObserveFloat64(obsrv Float64Observable, value float64, opts ...ObserveOption) - // ObserveInt64 records the int64 value for obsrv. - ObserveInt64(obsrv Int64Observable, value int64, opts ...ObserveOption) -} - -// Registration is an token representing the unique registration of a callback -// for a set of instruments with a Meter. -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type Registration interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.Registration - - // Unregister removes the callback registration from a Meter. - // - // This method needs to be idempotent and concurrent safe. - Unregister() error -} diff --git a/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go b/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go deleted file mode 100644 index 0a4825ae..00000000 --- a/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package metric // import "go.opentelemetry.io/otel/metric" - -import ( - "context" - - "go.opentelemetry.io/otel/metric/embedded" -) - -// Float64Counter is an instrument that records increasing float64 values. -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type Float64Counter interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.Float64Counter - - // Add records a change to the counter. - // - // Use the WithAttributeSet (or, if performance is not a concern, - // the WithAttributes) option to include measurement attributes. - Add(ctx context.Context, incr float64, options ...AddOption) -} - -// Float64CounterConfig contains options for synchronous counter instruments that -// record int64 values. -type Float64CounterConfig struct { - description string - unit string -} - -// NewFloat64CounterConfig returns a new [Float64CounterConfig] with all opts -// applied. -func NewFloat64CounterConfig(opts ...Float64CounterOption) Float64CounterConfig { - var config Float64CounterConfig - for _, o := range opts { - config = o.applyFloat64Counter(config) - } - return config -} - -// Description returns the configured description. -func (c Float64CounterConfig) Description() string { - return c.description -} - -// Unit returns the configured unit. -func (c Float64CounterConfig) Unit() string { - return c.unit -} - -// Float64CounterOption applies options to a [Float64CounterConfig]. See -// [InstrumentOption] for other options that can be used as a -// Float64CounterOption. -type Float64CounterOption interface { - applyFloat64Counter(Float64CounterConfig) Float64CounterConfig -} - -// Float64UpDownCounter is an instrument that records increasing or decreasing -// float64 values. -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type Float64UpDownCounter interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.Float64UpDownCounter - - // Add records a change to the counter. - // - // Use the WithAttributeSet (or, if performance is not a concern, - // the WithAttributes) option to include measurement attributes. - Add(ctx context.Context, incr float64, options ...AddOption) -} - -// Float64UpDownCounterConfig contains options for synchronous counter -// instruments that record int64 values. -type Float64UpDownCounterConfig struct { - description string - unit string -} - -// NewFloat64UpDownCounterConfig returns a new [Float64UpDownCounterConfig] -// with all opts applied. -func NewFloat64UpDownCounterConfig(opts ...Float64UpDownCounterOption) Float64UpDownCounterConfig { - var config Float64UpDownCounterConfig - for _, o := range opts { - config = o.applyFloat64UpDownCounter(config) - } - return config -} - -// Description returns the configured description. -func (c Float64UpDownCounterConfig) Description() string { - return c.description -} - -// Unit returns the configured unit. -func (c Float64UpDownCounterConfig) Unit() string { - return c.unit -} - -// Float64UpDownCounterOption applies options to a -// [Float64UpDownCounterConfig]. See [InstrumentOption] for other options that -// can be used as a Float64UpDownCounterOption. -type Float64UpDownCounterOption interface { - applyFloat64UpDownCounter(Float64UpDownCounterConfig) Float64UpDownCounterConfig -} - -// Float64Histogram is an instrument that records a distribution of float64 -// values. -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type Float64Histogram interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.Float64Histogram - - // Record adds an additional value to the distribution. - // - // Use the WithAttributeSet (or, if performance is not a concern, - // the WithAttributes) option to include measurement attributes. - Record(ctx context.Context, incr float64, options ...RecordOption) -} - -// Float64HistogramConfig contains options for synchronous counter instruments -// that record int64 values. -type Float64HistogramConfig struct { - description string - unit string - explicitBucketBoundaries []float64 -} - -// NewFloat64HistogramConfig returns a new [Float64HistogramConfig] with all -// opts applied. -func NewFloat64HistogramConfig(opts ...Float64HistogramOption) Float64HistogramConfig { - var config Float64HistogramConfig - for _, o := range opts { - config = o.applyFloat64Histogram(config) - } - return config -} - -// Description returns the configured description. -func (c Float64HistogramConfig) Description() string { - return c.description -} - -// Unit returns the configured unit. -func (c Float64HistogramConfig) Unit() string { - return c.unit -} - -// ExplicitBucketBoundaries returns the configured explicit bucket boundaries. -func (c Float64HistogramConfig) ExplicitBucketBoundaries() []float64 { - return c.explicitBucketBoundaries -} - -// Float64HistogramOption applies options to a [Float64HistogramConfig]. See -// [InstrumentOption] for other options that can be used as a -// Float64HistogramOption. -type Float64HistogramOption interface { - applyFloat64Histogram(Float64HistogramConfig) Float64HistogramConfig -} diff --git a/vendor/go.opentelemetry.io/otel/metric/syncint64.go b/vendor/go.opentelemetry.io/otel/metric/syncint64.go deleted file mode 100644 index 56667d32..00000000 --- a/vendor/go.opentelemetry.io/otel/metric/syncint64.go +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package metric // import "go.opentelemetry.io/otel/metric" - -import ( - "context" - - "go.opentelemetry.io/otel/metric/embedded" -) - -// Int64Counter is an instrument that records increasing int64 values. -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type Int64Counter interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.Int64Counter - - // Add records a change to the counter. - // - // Use the WithAttributeSet (or, if performance is not a concern, - // the WithAttributes) option to include measurement attributes. - Add(ctx context.Context, incr int64, options ...AddOption) -} - -// Int64CounterConfig contains options for synchronous counter instruments that -// record int64 values. -type Int64CounterConfig struct { - description string - unit string -} - -// NewInt64CounterConfig returns a new [Int64CounterConfig] with all opts -// applied. -func NewInt64CounterConfig(opts ...Int64CounterOption) Int64CounterConfig { - var config Int64CounterConfig - for _, o := range opts { - config = o.applyInt64Counter(config) - } - return config -} - -// Description returns the configured description. -func (c Int64CounterConfig) Description() string { - return c.description -} - -// Unit returns the configured unit. -func (c Int64CounterConfig) Unit() string { - return c.unit -} - -// Int64CounterOption applies options to a [Int64CounterConfig]. See -// [InstrumentOption] for other options that can be used as an -// Int64CounterOption. -type Int64CounterOption interface { - applyInt64Counter(Int64CounterConfig) Int64CounterConfig -} - -// Int64UpDownCounter is an instrument that records increasing or decreasing -// int64 values. -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type Int64UpDownCounter interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.Int64UpDownCounter - - // Add records a change to the counter. - // - // Use the WithAttributeSet (or, if performance is not a concern, - // the WithAttributes) option to include measurement attributes. - Add(ctx context.Context, incr int64, options ...AddOption) -} - -// Int64UpDownCounterConfig contains options for synchronous counter -// instruments that record int64 values. -type Int64UpDownCounterConfig struct { - description string - unit string -} - -// NewInt64UpDownCounterConfig returns a new [Int64UpDownCounterConfig] with -// all opts applied. -func NewInt64UpDownCounterConfig(opts ...Int64UpDownCounterOption) Int64UpDownCounterConfig { - var config Int64UpDownCounterConfig - for _, o := range opts { - config = o.applyInt64UpDownCounter(config) - } - return config -} - -// Description returns the configured description. -func (c Int64UpDownCounterConfig) Description() string { - return c.description -} - -// Unit returns the configured unit. -func (c Int64UpDownCounterConfig) Unit() string { - return c.unit -} - -// Int64UpDownCounterOption applies options to a [Int64UpDownCounterConfig]. -// See [InstrumentOption] for other options that can be used as an -// Int64UpDownCounterOption. -type Int64UpDownCounterOption interface { - applyInt64UpDownCounter(Int64UpDownCounterConfig) Int64UpDownCounterConfig -} - -// Int64Histogram is an instrument that records a distribution of int64 -// values. -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type Int64Histogram interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.Int64Histogram - - // Record adds an additional value to the distribution. - // - // Use the WithAttributeSet (or, if performance is not a concern, - // the WithAttributes) option to include measurement attributes. - Record(ctx context.Context, incr int64, options ...RecordOption) -} - -// Int64HistogramConfig contains options for synchronous counter instruments -// that record int64 values. -type Int64HistogramConfig struct { - description string - unit string - explicitBucketBoundaries []float64 -} - -// NewInt64HistogramConfig returns a new [Int64HistogramConfig] with all opts -// applied. -func NewInt64HistogramConfig(opts ...Int64HistogramOption) Int64HistogramConfig { - var config Int64HistogramConfig - for _, o := range opts { - config = o.applyInt64Histogram(config) - } - return config -} - -// Description returns the configured description. -func (c Int64HistogramConfig) Description() string { - return c.description -} - -// Unit returns the configured unit. -func (c Int64HistogramConfig) Unit() string { - return c.unit -} - -// ExplicitBucketBoundaries returns the configured explicit bucket boundaries. -func (c Int64HistogramConfig) ExplicitBucketBoundaries() []float64 { - return c.explicitBucketBoundaries -} - -// Int64HistogramOption applies options to a [Int64HistogramConfig]. See -// [InstrumentOption] for other options that can be used as an -// Int64HistogramOption. -type Int64HistogramOption interface { - applyInt64Histogram(Int64HistogramConfig) Int64HistogramConfig -} diff --git a/vendor/go.opentelemetry.io/otel/propagation.go b/vendor/go.opentelemetry.io/otel/propagation.go deleted file mode 100644 index d29aaa32..00000000 --- a/vendor/go.opentelemetry.io/otel/propagation.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package otel // import "go.opentelemetry.io/otel" - -import ( - "go.opentelemetry.io/otel/internal/global" - "go.opentelemetry.io/otel/propagation" -) - -// GetTextMapPropagator returns the global TextMapPropagator. If none has been -// set, a No-Op TextMapPropagator is returned. -func GetTextMapPropagator() propagation.TextMapPropagator { - return global.TextMapPropagator() -} - -// SetTextMapPropagator sets propagator as the global TextMapPropagator. -func SetTextMapPropagator(propagator propagation.TextMapPropagator) { - global.SetTextMapPropagator(propagator) -} diff --git a/vendor/go.opentelemetry.io/otel/propagation/baggage.go b/vendor/go.opentelemetry.io/otel/propagation/baggage.go deleted file mode 100644 index 303cdf1c..00000000 --- a/vendor/go.opentelemetry.io/otel/propagation/baggage.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package propagation // import "go.opentelemetry.io/otel/propagation" - -import ( - "context" - - "go.opentelemetry.io/otel/baggage" -) - -const baggageHeader = "baggage" - -// Baggage is a propagator that supports the W3C Baggage format. -// -// This propagates user-defined baggage associated with a trace. The complete -// specification is defined at https://www.w3.org/TR/baggage/. -type Baggage struct{} - -var _ TextMapPropagator = Baggage{} - -// Inject sets baggage key-values from ctx into the carrier. -func (b Baggage) Inject(ctx context.Context, carrier TextMapCarrier) { - bStr := baggage.FromContext(ctx).String() - if bStr != "" { - carrier.Set(baggageHeader, bStr) - } -} - -// Extract returns a copy of parent with the baggage from the carrier added. -func (b Baggage) Extract(parent context.Context, carrier TextMapCarrier) context.Context { - bStr := carrier.Get(baggageHeader) - if bStr == "" { - return parent - } - - bag, err := baggage.Parse(bStr) - if err != nil { - return parent - } - return baggage.ContextWithBaggage(parent, bag) -} - -// Fields returns the keys who's values are set with Inject. -func (b Baggage) Fields() []string { - return []string{baggageHeader} -} diff --git a/vendor/go.opentelemetry.io/otel/propagation/doc.go b/vendor/go.opentelemetry.io/otel/propagation/doc.go deleted file mode 100644 index c119eb28..00000000 --- a/vendor/go.opentelemetry.io/otel/propagation/doc.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -/* -Package propagation contains OpenTelemetry context propagators. - -OpenTelemetry propagators are used to extract and inject context data from and -into messages exchanged by applications. The propagator supported by this -package is the W3C Trace Context encoding -(https://www.w3.org/TR/trace-context/), and W3C Baggage -(https://www.w3.org/TR/baggage/). -*/ -package propagation // import "go.opentelemetry.io/otel/propagation" diff --git a/vendor/go.opentelemetry.io/otel/propagation/propagation.go b/vendor/go.opentelemetry.io/otel/propagation/propagation.go deleted file mode 100644 index c94438f7..00000000 --- a/vendor/go.opentelemetry.io/otel/propagation/propagation.go +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package propagation // import "go.opentelemetry.io/otel/propagation" - -import ( - "context" - "net/http" -) - -// TextMapCarrier is the storage medium used by a TextMapPropagator. -type TextMapCarrier interface { - // DO NOT CHANGE: any modification will not be backwards compatible and - // must never be done outside of a new major release. - - // Get returns the value associated with the passed key. - Get(key string) string - // DO NOT CHANGE: any modification will not be backwards compatible and - // must never be done outside of a new major release. - - // Set stores the key-value pair. - Set(key string, value string) - // DO NOT CHANGE: any modification will not be backwards compatible and - // must never be done outside of a new major release. - - // Keys lists the keys stored in this carrier. - Keys() []string - // DO NOT CHANGE: any modification will not be backwards compatible and - // must never be done outside of a new major release. -} - -// MapCarrier is a TextMapCarrier that uses a map held in memory as a storage -// medium for propagated key-value pairs. -type MapCarrier map[string]string - -// Compile time check that MapCarrier implements the TextMapCarrier. -var _ TextMapCarrier = MapCarrier{} - -// Get returns the value associated with the passed key. -func (c MapCarrier) Get(key string) string { - return c[key] -} - -// Set stores the key-value pair. -func (c MapCarrier) Set(key, value string) { - c[key] = value -} - -// Keys lists the keys stored in this carrier. -func (c MapCarrier) Keys() []string { - keys := make([]string, 0, len(c)) - for k := range c { - keys = append(keys, k) - } - return keys -} - -// HeaderCarrier adapts http.Header to satisfy the TextMapCarrier interface. -type HeaderCarrier http.Header - -// Get returns the value associated with the passed key. -func (hc HeaderCarrier) Get(key string) string { - return http.Header(hc).Get(key) -} - -// Set stores the key-value pair. -func (hc HeaderCarrier) Set(key string, value string) { - http.Header(hc).Set(key, value) -} - -// Keys lists the keys stored in this carrier. -func (hc HeaderCarrier) Keys() []string { - keys := make([]string, 0, len(hc)) - for k := range hc { - keys = append(keys, k) - } - return keys -} - -// TextMapPropagator propagates cross-cutting concerns as key-value text -// pairs within a carrier that travels in-band across process boundaries. -type TextMapPropagator interface { - // DO NOT CHANGE: any modification will not be backwards compatible and - // must never be done outside of a new major release. - - // Inject set cross-cutting concerns from the Context into the carrier. - Inject(ctx context.Context, carrier TextMapCarrier) - // DO NOT CHANGE: any modification will not be backwards compatible and - // must never be done outside of a new major release. - - // Extract reads cross-cutting concerns from the carrier into a Context. - Extract(ctx context.Context, carrier TextMapCarrier) context.Context - // DO NOT CHANGE: any modification will not be backwards compatible and - // must never be done outside of a new major release. - - // Fields returns the keys whose values are set with Inject. - Fields() []string - // DO NOT CHANGE: any modification will not be backwards compatible and - // must never be done outside of a new major release. -} - -type compositeTextMapPropagator []TextMapPropagator - -func (p compositeTextMapPropagator) Inject(ctx context.Context, carrier TextMapCarrier) { - for _, i := range p { - i.Inject(ctx, carrier) - } -} - -func (p compositeTextMapPropagator) Extract(ctx context.Context, carrier TextMapCarrier) context.Context { - for _, i := range p { - ctx = i.Extract(ctx, carrier) - } - return ctx -} - -func (p compositeTextMapPropagator) Fields() []string { - unique := make(map[string]struct{}) - for _, i := range p { - for _, k := range i.Fields() { - unique[k] = struct{}{} - } - } - - fields := make([]string, 0, len(unique)) - for k := range unique { - fields = append(fields, k) - } - return fields -} - -// NewCompositeTextMapPropagator returns a unified TextMapPropagator from the -// group of passed TextMapPropagator. This allows different cross-cutting -// concerns to be propagates in a unified manner. -// -// The returned TextMapPropagator will inject and extract cross-cutting -// concerns in the order the TextMapPropagators were provided. Additionally, -// the Fields method will return a de-duplicated slice of the keys that are -// set with the Inject method. -func NewCompositeTextMapPropagator(p ...TextMapPropagator) TextMapPropagator { - return compositeTextMapPropagator(p) -} diff --git a/vendor/go.opentelemetry.io/otel/propagation/trace_context.go b/vendor/go.opentelemetry.io/otel/propagation/trace_context.go deleted file mode 100644 index 63e5d622..00000000 --- a/vendor/go.opentelemetry.io/otel/propagation/trace_context.go +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package propagation // import "go.opentelemetry.io/otel/propagation" - -import ( - "context" - "encoding/hex" - "fmt" - "strings" - - "go.opentelemetry.io/otel/trace" -) - -const ( - supportedVersion = 0 - maxVersion = 254 - traceparentHeader = "traceparent" - tracestateHeader = "tracestate" - delimiter = "-" -) - -// TraceContext is a propagator that supports the W3C Trace Context format -// (https://www.w3.org/TR/trace-context/) -// -// This propagator will propagate the traceparent and tracestate headers to -// guarantee traces are not broken. It is up to the users of this propagator -// to choose if they want to participate in a trace by modifying the -// traceparent header and relevant parts of the tracestate header containing -// their proprietary information. -type TraceContext struct{} - -var ( - _ TextMapPropagator = TraceContext{} - versionPart = fmt.Sprintf("%.2X", supportedVersion) -) - -// Inject set tracecontext from the Context into the carrier. -func (tc TraceContext) Inject(ctx context.Context, carrier TextMapCarrier) { - sc := trace.SpanContextFromContext(ctx) - if !sc.IsValid() { - return - } - - if ts := sc.TraceState().String(); ts != "" { - carrier.Set(tracestateHeader, ts) - } - - // Clear all flags other than the trace-context supported sampling bit. - flags := sc.TraceFlags() & trace.FlagsSampled - - var sb strings.Builder - sb.Grow(2 + 32 + 16 + 2 + 3) - _, _ = sb.WriteString(versionPart) - traceID := sc.TraceID() - spanID := sc.SpanID() - flagByte := [1]byte{byte(flags)} - var buf [32]byte - for _, src := range [][]byte{traceID[:], spanID[:], flagByte[:]} { - _ = sb.WriteByte(delimiter[0]) - n := hex.Encode(buf[:], src) - _, _ = sb.Write(buf[:n]) - } - carrier.Set(traceparentHeader, sb.String()) -} - -// Extract reads tracecontext from the carrier into a returned Context. -// -// The returned Context will be a copy of ctx and contain the extracted -// tracecontext as the remote SpanContext. If the extracted tracecontext is -// invalid, the passed ctx will be returned directly instead. -func (tc TraceContext) Extract(ctx context.Context, carrier TextMapCarrier) context.Context { - sc := tc.extract(carrier) - if !sc.IsValid() { - return ctx - } - return trace.ContextWithRemoteSpanContext(ctx, sc) -} - -func (tc TraceContext) extract(carrier TextMapCarrier) trace.SpanContext { - h := carrier.Get(traceparentHeader) - if h == "" { - return trace.SpanContext{} - } - - var ver [1]byte - if !extractPart(ver[:], &h, 2) { - return trace.SpanContext{} - } - version := int(ver[0]) - if version > maxVersion { - return trace.SpanContext{} - } - - var scc trace.SpanContextConfig - if !extractPart(scc.TraceID[:], &h, 32) { - return trace.SpanContext{} - } - if !extractPart(scc.SpanID[:], &h, 16) { - return trace.SpanContext{} - } - - var opts [1]byte - if !extractPart(opts[:], &h, 2) { - return trace.SpanContext{} - } - if version == 0 && (h != "" || opts[0] > 2) { - // version 0 not allow extra - // version 0 not allow other flag - return trace.SpanContext{} - } - - // Clear all flags other than the trace-context supported sampling bit. - scc.TraceFlags = trace.TraceFlags(opts[0]) & trace.FlagsSampled - - // Ignore the error returned here. Failure to parse tracestate MUST NOT - // affect the parsing of traceparent according to the W3C tracecontext - // specification. - scc.TraceState, _ = trace.ParseTraceState(carrier.Get(tracestateHeader)) - scc.Remote = true - - sc := trace.NewSpanContext(scc) - if !sc.IsValid() { - return trace.SpanContext{} - } - - return sc -} - -// upperHex detect hex is upper case Unicode characters. -func upperHex(v string) bool { - for _, c := range v { - if c >= 'A' && c <= 'F' { - return true - } - } - return false -} - -func extractPart(dst []byte, h *string, n int) bool { - part, left, _ := strings.Cut(*h, delimiter) - *h = left - // hex.Decode decodes unsupported upper-case characters, so exclude explicitly. - if len(part) != n || upperHex(part) { - return false - } - if p, err := hex.Decode(dst, []byte(part)); err != nil || p != n/2 { - return false - } - return true -} - -// Fields returns the keys who's values are set with Inject. -func (tc TraceContext) Fields() []string { - return []string{traceparentHeader, tracestateHeader} -} diff --git a/vendor/go.opentelemetry.io/otel/requirements.txt b/vendor/go.opentelemetry.io/otel/requirements.txt deleted file mode 100644 index e0a43e13..00000000 --- a/vendor/go.opentelemetry.io/otel/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -codespell==2.2.6 diff --git a/vendor/go.opentelemetry.io/otel/trace.go b/vendor/go.opentelemetry.io/otel/trace.go deleted file mode 100644 index caf7249d..00000000 --- a/vendor/go.opentelemetry.io/otel/trace.go +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package otel // import "go.opentelemetry.io/otel" - -import ( - "go.opentelemetry.io/otel/internal/global" - "go.opentelemetry.io/otel/trace" -) - -// Tracer creates a named tracer that implements Tracer interface. -// If the name is an empty string then provider uses default name. -// -// This is short for GetTracerProvider().Tracer(name, opts...) -func Tracer(name string, opts ...trace.TracerOption) trace.Tracer { - return GetTracerProvider().Tracer(name, opts...) -} - -// GetTracerProvider returns the registered global trace provider. -// If none is registered then an instance of NoopTracerProvider is returned. -// -// Use the trace provider to create a named tracer. E.g. -// -// tracer := otel.GetTracerProvider().Tracer("example.com/foo") -// -// or -// -// tracer := otel.Tracer("example.com/foo") -func GetTracerProvider() trace.TracerProvider { - return global.TracerProvider() -} - -// SetTracerProvider registers `tp` as the global trace provider. -func SetTracerProvider(tp trace.TracerProvider) { - global.SetTracerProvider(tp) -} diff --git a/vendor/go.opentelemetry.io/otel/trace/LICENSE b/vendor/go.opentelemetry.io/otel/trace/LICENSE deleted file mode 100644 index 261eeb9e..00000000 --- a/vendor/go.opentelemetry.io/otel/trace/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. diff --git a/vendor/go.opentelemetry.io/otel/trace/config.go b/vendor/go.opentelemetry.io/otel/trace/config.go deleted file mode 100644 index 3aadc66c..00000000 --- a/vendor/go.opentelemetry.io/otel/trace/config.go +++ /dev/null @@ -1,334 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package trace // import "go.opentelemetry.io/otel/trace" - -import ( - "time" - - "go.opentelemetry.io/otel/attribute" -) - -// TracerConfig is a group of options for a Tracer. -type TracerConfig struct { - instrumentationVersion string - // Schema URL of the telemetry emitted by the Tracer. - schemaURL string - attrs attribute.Set -} - -// InstrumentationVersion returns the version of the library providing instrumentation. -func (t *TracerConfig) InstrumentationVersion() string { - return t.instrumentationVersion -} - -// InstrumentationAttributes returns the attributes associated with the library -// providing instrumentation. -func (t *TracerConfig) InstrumentationAttributes() attribute.Set { - return t.attrs -} - -// SchemaURL returns the Schema URL of the telemetry emitted by the Tracer. -func (t *TracerConfig) SchemaURL() string { - return t.schemaURL -} - -// NewTracerConfig applies all the options to a returned TracerConfig. -func NewTracerConfig(options ...TracerOption) TracerConfig { - var config TracerConfig - for _, option := range options { - config = option.apply(config) - } - return config -} - -// TracerOption applies an option to a TracerConfig. -type TracerOption interface { - apply(TracerConfig) TracerConfig -} - -type tracerOptionFunc func(TracerConfig) TracerConfig - -func (fn tracerOptionFunc) apply(cfg TracerConfig) TracerConfig { - return fn(cfg) -} - -// SpanConfig is a group of options for a Span. -type SpanConfig struct { - attributes []attribute.KeyValue - timestamp time.Time - links []Link - newRoot bool - spanKind SpanKind - stackTrace bool -} - -// Attributes describe the associated qualities of a Span. -func (cfg *SpanConfig) Attributes() []attribute.KeyValue { - return cfg.attributes -} - -// Timestamp is a time in a Span life-cycle. -func (cfg *SpanConfig) Timestamp() time.Time { - return cfg.timestamp -} - -// StackTrace checks whether stack trace capturing is enabled. -func (cfg *SpanConfig) StackTrace() bool { - return cfg.stackTrace -} - -// Links are the associations a Span has with other Spans. -func (cfg *SpanConfig) Links() []Link { - return cfg.links -} - -// NewRoot identifies a Span as the root Span for a new trace. This is -// commonly used when an existing trace crosses trust boundaries and the -// remote parent span context should be ignored for security. -func (cfg *SpanConfig) NewRoot() bool { - return cfg.newRoot -} - -// SpanKind is the role a Span has in a trace. -func (cfg *SpanConfig) SpanKind() SpanKind { - return cfg.spanKind -} - -// NewSpanStartConfig applies all the options to a returned SpanConfig. -// No validation is performed on the returned SpanConfig (e.g. no uniqueness -// checking or bounding of data), it is left to the SDK to perform this -// action. -func NewSpanStartConfig(options ...SpanStartOption) SpanConfig { - var c SpanConfig - for _, option := range options { - c = option.applySpanStart(c) - } - return c -} - -// NewSpanEndConfig applies all the options to a returned SpanConfig. -// No validation is performed on the returned SpanConfig (e.g. no uniqueness -// checking or bounding of data), it is left to the SDK to perform this -// action. -func NewSpanEndConfig(options ...SpanEndOption) SpanConfig { - var c SpanConfig - for _, option := range options { - c = option.applySpanEnd(c) - } - return c -} - -// SpanStartOption applies an option to a SpanConfig. These options are applicable -// only when the span is created. -type SpanStartOption interface { - applySpanStart(SpanConfig) SpanConfig -} - -type spanOptionFunc func(SpanConfig) SpanConfig - -func (fn spanOptionFunc) applySpanStart(cfg SpanConfig) SpanConfig { - return fn(cfg) -} - -// SpanEndOption applies an option to a SpanConfig. These options are -// applicable only when the span is ended. -type SpanEndOption interface { - applySpanEnd(SpanConfig) SpanConfig -} - -// EventConfig is a group of options for an Event. -type EventConfig struct { - attributes []attribute.KeyValue - timestamp time.Time - stackTrace bool -} - -// Attributes describe the associated qualities of an Event. -func (cfg *EventConfig) Attributes() []attribute.KeyValue { - return cfg.attributes -} - -// Timestamp is a time in an Event life-cycle. -func (cfg *EventConfig) Timestamp() time.Time { - return cfg.timestamp -} - -// StackTrace checks whether stack trace capturing is enabled. -func (cfg *EventConfig) StackTrace() bool { - return cfg.stackTrace -} - -// NewEventConfig applies all the EventOptions to a returned EventConfig. If no -// timestamp option is passed, the returned EventConfig will have a Timestamp -// set to the call time, otherwise no validation is performed on the returned -// EventConfig. -func NewEventConfig(options ...EventOption) EventConfig { - var c EventConfig - for _, option := range options { - c = option.applyEvent(c) - } - if c.timestamp.IsZero() { - c.timestamp = time.Now() - } - return c -} - -// EventOption applies span event options to an EventConfig. -type EventOption interface { - applyEvent(EventConfig) EventConfig -} - -// SpanOption are options that can be used at both the beginning and end of a span. -type SpanOption interface { - SpanStartOption - SpanEndOption -} - -// SpanStartEventOption are options that can be used at the start of a span, or with an event. -type SpanStartEventOption interface { - SpanStartOption - EventOption -} - -// SpanEndEventOption are options that can be used at the end of a span, or with an event. -type SpanEndEventOption interface { - SpanEndOption - EventOption -} - -type attributeOption []attribute.KeyValue - -func (o attributeOption) applySpan(c SpanConfig) SpanConfig { - c.attributes = append(c.attributes, []attribute.KeyValue(o)...) - return c -} -func (o attributeOption) applySpanStart(c SpanConfig) SpanConfig { return o.applySpan(c) } -func (o attributeOption) applyEvent(c EventConfig) EventConfig { - c.attributes = append(c.attributes, []attribute.KeyValue(o)...) - return c -} - -var _ SpanStartEventOption = attributeOption{} - -// WithAttributes adds the attributes related to a span life-cycle event. -// These attributes are used to describe the work a Span represents when this -// option is provided to a Span's start or end events. Otherwise, these -// attributes provide additional information about the event being recorded -// (e.g. error, state change, processing progress, system event). -// -// If multiple of these options are passed the attributes of each successive -// option will extend the attributes instead of overwriting. There is no -// guarantee of uniqueness in the resulting attributes. -func WithAttributes(attributes ...attribute.KeyValue) SpanStartEventOption { - return attributeOption(attributes) -} - -// SpanEventOption are options that can be used with an event or a span. -type SpanEventOption interface { - SpanOption - EventOption -} - -type timestampOption time.Time - -func (o timestampOption) applySpan(c SpanConfig) SpanConfig { - c.timestamp = time.Time(o) - return c -} -func (o timestampOption) applySpanStart(c SpanConfig) SpanConfig { return o.applySpan(c) } -func (o timestampOption) applySpanEnd(c SpanConfig) SpanConfig { return o.applySpan(c) } -func (o timestampOption) applyEvent(c EventConfig) EventConfig { - c.timestamp = time.Time(o) - return c -} - -var _ SpanEventOption = timestampOption{} - -// WithTimestamp sets the time of a Span or Event life-cycle moment (e.g. -// started, stopped, errored). -func WithTimestamp(t time.Time) SpanEventOption { - return timestampOption(t) -} - -type stackTraceOption bool - -func (o stackTraceOption) applyEvent(c EventConfig) EventConfig { - c.stackTrace = bool(o) - return c -} - -func (o stackTraceOption) applySpan(c SpanConfig) SpanConfig { - c.stackTrace = bool(o) - return c -} -func (o stackTraceOption) applySpanEnd(c SpanConfig) SpanConfig { return o.applySpan(c) } - -// WithStackTrace sets the flag to capture the error with stack trace (e.g. true, false). -func WithStackTrace(b bool) SpanEndEventOption { - return stackTraceOption(b) -} - -// WithLinks adds links to a Span. The links are added to the existing Span -// links, i.e. this does not overwrite. Links with invalid span context are ignored. -func WithLinks(links ...Link) SpanStartOption { - return spanOptionFunc(func(cfg SpanConfig) SpanConfig { - cfg.links = append(cfg.links, links...) - return cfg - }) -} - -// WithNewRoot specifies that the Span should be treated as a root Span. Any -// existing parent span context will be ignored when defining the Span's trace -// identifiers. -func WithNewRoot() SpanStartOption { - return spanOptionFunc(func(cfg SpanConfig) SpanConfig { - cfg.newRoot = true - return cfg - }) -} - -// WithSpanKind sets the SpanKind of a Span. -func WithSpanKind(kind SpanKind) SpanStartOption { - return spanOptionFunc(func(cfg SpanConfig) SpanConfig { - cfg.spanKind = kind - return cfg - }) -} - -// WithInstrumentationVersion sets the instrumentation version. -func WithInstrumentationVersion(version string) TracerOption { - return tracerOptionFunc(func(cfg TracerConfig) TracerConfig { - cfg.instrumentationVersion = version - return cfg - }) -} - -// WithInstrumentationAttributes sets the instrumentation attributes. -// -// The passed attributes will be de-duplicated. -func WithInstrumentationAttributes(attr ...attribute.KeyValue) TracerOption { - return tracerOptionFunc(func(config TracerConfig) TracerConfig { - config.attrs = attribute.NewSet(attr...) - return config - }) -} - -// WithSchemaURL sets the schema URL for the Tracer. -func WithSchemaURL(schemaURL string) TracerOption { - return tracerOptionFunc(func(cfg TracerConfig) TracerConfig { - cfg.schemaURL = schemaURL - return cfg - }) -} diff --git a/vendor/go.opentelemetry.io/otel/trace/context.go b/vendor/go.opentelemetry.io/otel/trace/context.go deleted file mode 100644 index 76f9a083..00000000 --- a/vendor/go.opentelemetry.io/otel/trace/context.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package trace // import "go.opentelemetry.io/otel/trace" - -import "context" - -type traceContextKeyType int - -const currentSpanKey traceContextKeyType = iota - -// ContextWithSpan returns a copy of parent with span set as the current Span. -func ContextWithSpan(parent context.Context, span Span) context.Context { - return context.WithValue(parent, currentSpanKey, span) -} - -// ContextWithSpanContext returns a copy of parent with sc as the current -// Span. The Span implementation that wraps sc is non-recording and performs -// no operations other than to return sc as the SpanContext from the -// SpanContext method. -func ContextWithSpanContext(parent context.Context, sc SpanContext) context.Context { - return ContextWithSpan(parent, nonRecordingSpan{sc: sc}) -} - -// ContextWithRemoteSpanContext returns a copy of parent with rsc set explicly -// as a remote SpanContext and as the current Span. The Span implementation -// that wraps rsc is non-recording and performs no operations other than to -// return rsc as the SpanContext from the SpanContext method. -func ContextWithRemoteSpanContext(parent context.Context, rsc SpanContext) context.Context { - return ContextWithSpanContext(parent, rsc.WithRemote(true)) -} - -// SpanFromContext returns the current Span from ctx. -// -// If no Span is currently set in ctx an implementation of a Span that -// performs no operations is returned. -func SpanFromContext(ctx context.Context) Span { - if ctx == nil { - return noopSpan{} - } - if span, ok := ctx.Value(currentSpanKey).(Span); ok { - return span - } - return noopSpan{} -} - -// SpanContextFromContext returns the current Span's SpanContext. -func SpanContextFromContext(ctx context.Context) SpanContext { - return SpanFromContext(ctx).SpanContext() -} diff --git a/vendor/go.opentelemetry.io/otel/trace/doc.go b/vendor/go.opentelemetry.io/otel/trace/doc.go deleted file mode 100644 index 440f3d75..00000000 --- a/vendor/go.opentelemetry.io/otel/trace/doc.go +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -/* -Package trace provides an implementation of the tracing part of the -OpenTelemetry API. - -To participate in distributed traces a Span needs to be created for the -operation being performed as part of a traced workflow. In its simplest form: - - var tracer trace.Tracer - - func init() { - tracer = otel.Tracer("instrumentation/package/name") - } - - func operation(ctx context.Context) { - var span trace.Span - ctx, span = tracer.Start(ctx, "operation") - defer span.End() - // ... - } - -A Tracer is unique to the instrumentation and is used to create Spans. -Instrumentation should be designed to accept a TracerProvider from which it -can create its own unique Tracer. Alternatively, the registered global -TracerProvider from the go.opentelemetry.io/otel package can be used as -a default. - - const ( - name = "instrumentation/package/name" - version = "0.1.0" - ) - - type Instrumentation struct { - tracer trace.Tracer - } - - func NewInstrumentation(tp trace.TracerProvider) *Instrumentation { - if tp == nil { - tp = otel.TracerProvider() - } - return &Instrumentation{ - tracer: tp.Tracer(name, trace.WithInstrumentationVersion(version)), - } - } - - func operation(ctx context.Context, inst *Instrumentation) { - var span trace.Span - ctx, span = inst.tracer.Start(ctx, "operation") - defer span.End() - // ... - } - -# API Implementations - -This package does not conform to the standard Go versioning policy; all of its -interfaces may have methods added to them without a package major version bump. -This non-standard API evolution could surprise an uninformed implementation -author. They could unknowingly build their implementation in a way that would -result in a runtime panic for their users that update to the new API. - -The API is designed to help inform an instrumentation author about this -non-standard API evolution. It requires them to choose a default behavior for -unimplemented interface methods. There are three behavior choices they can -make: - - - Compilation failure - - Panic - - Default to another implementation - -All interfaces in this API embed a corresponding interface from -[go.opentelemetry.io/otel/trace/embedded]. If an author wants the default -behavior of their implementations to be a compilation failure, signaling to -their users they need to update to the latest version of that implementation, -they need to embed the corresponding interface from -[go.opentelemetry.io/otel/trace/embedded] in their implementation. For -example, - - import "go.opentelemetry.io/otel/trace/embedded" - - type TracerProvider struct { - embedded.TracerProvider - // ... - } - -If an author wants the default behavior of their implementations to panic, they -can embed the API interface directly. - - import "go.opentelemetry.io/otel/trace" - - type TracerProvider struct { - trace.TracerProvider - // ... - } - -This option is not recommended. It will lead to publishing packages that -contain runtime panics when users update to newer versions of -[go.opentelemetry.io/otel/trace], which may be done with a trasitive -dependency. - -Finally, an author can embed another implementation in theirs. The embedded -implementation will be used for methods not defined by the author. For example, -an author who wants to default to silently dropping the call can use -[go.opentelemetry.io/otel/trace/noop]: - - import "go.opentelemetry.io/otel/trace/noop" - - type TracerProvider struct { - noop.TracerProvider - // ... - } - -It is strongly recommended that authors only embed -[go.opentelemetry.io/otel/trace/noop] if they choose this default behavior. -That implementation is the only one OpenTelemetry authors can guarantee will -fully implement all the API interfaces when a user updates their API. -*/ -package trace // import "go.opentelemetry.io/otel/trace" diff --git a/vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go b/vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go deleted file mode 100644 index 898db5a7..00000000 --- a/vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -// Package embedded provides interfaces embedded within the [OpenTelemetry -// trace API]. -// -// Implementers of the [OpenTelemetry trace API] can embed the relevant type -// from this package into their implementation directly. Doing so will result -// in a compilation error for users when the [OpenTelemetry trace API] is -// extended (which is something that can happen without a major version bump of -// the API package). -// -// [OpenTelemetry trace API]: https://pkg.go.dev/go.opentelemetry.io/otel/trace -package embedded // import "go.opentelemetry.io/otel/trace/embedded" - -// TracerProvider is embedded in -// [go.opentelemetry.io/otel/trace.TracerProvider]. -// -// Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/trace.TracerProvider] if you want users to -// experience a compilation error, signaling they need to update to your latest -// implementation, when the [go.opentelemetry.io/otel/trace.TracerProvider] -// interface is extended (which is something that can happen without a major -// version bump of the API package). -type TracerProvider interface{ tracerProvider() } - -// Tracer is embedded in [go.opentelemetry.io/otel/trace.Tracer]. -// -// Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/trace.Tracer] if you want users to experience a -// compilation error, signaling they need to update to your latest -// implementation, when the [go.opentelemetry.io/otel/trace.Tracer] interface -// is extended (which is something that can happen without a major version bump -// of the API package). -type Tracer interface{ tracer() } - -// Span is embedded in [go.opentelemetry.io/otel/trace.Span]. -// -// Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/trace.Span] if you want users to experience a -// compilation error, signaling they need to update to your latest -// implementation, when the [go.opentelemetry.io/otel/trace.Span] interface is -// extended (which is something that can happen without a major version bump of -// the API package). -type Span interface{ span() } diff --git a/vendor/go.opentelemetry.io/otel/trace/nonrecording.go b/vendor/go.opentelemetry.io/otel/trace/nonrecording.go deleted file mode 100644 index 88fcb816..00000000 --- a/vendor/go.opentelemetry.io/otel/trace/nonrecording.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package trace // import "go.opentelemetry.io/otel/trace" - -// nonRecordingSpan is a minimal implementation of a Span that wraps a -// SpanContext. It performs no operations other than to return the wrapped -// SpanContext. -type nonRecordingSpan struct { - noopSpan - - sc SpanContext -} - -// SpanContext returns the wrapped SpanContext. -func (s nonRecordingSpan) SpanContext() SpanContext { return s.sc } diff --git a/vendor/go.opentelemetry.io/otel/trace/noop.go b/vendor/go.opentelemetry.io/otel/trace/noop.go deleted file mode 100644 index c125491c..00000000 --- a/vendor/go.opentelemetry.io/otel/trace/noop.go +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package trace // import "go.opentelemetry.io/otel/trace" - -import ( - "context" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/trace/embedded" -) - -// NewNoopTracerProvider returns an implementation of TracerProvider that -// performs no operations. The Tracer and Spans created from the returned -// TracerProvider also perform no operations. -// -// Deprecated: Use [go.opentelemetry.io/otel/trace/noop.NewTracerProvider] -// instead. -func NewNoopTracerProvider() TracerProvider { - return noopTracerProvider{} -} - -type noopTracerProvider struct{ embedded.TracerProvider } - -var _ TracerProvider = noopTracerProvider{} - -// Tracer returns noop implementation of Tracer. -func (p noopTracerProvider) Tracer(string, ...TracerOption) Tracer { - return noopTracer{} -} - -// noopTracer is an implementation of Tracer that performs no operations. -type noopTracer struct{ embedded.Tracer } - -var _ Tracer = noopTracer{} - -// Start carries forward a non-recording Span, if one is present in the context, otherwise it -// creates a no-op Span. -func (t noopTracer) Start(ctx context.Context, name string, _ ...SpanStartOption) (context.Context, Span) { - span := SpanFromContext(ctx) - if _, ok := span.(nonRecordingSpan); !ok { - // span is likely already a noopSpan, but let's be sure - span = noopSpan{} - } - return ContextWithSpan(ctx, span), span -} - -// noopSpan is an implementation of Span that performs no operations. -type noopSpan struct{ embedded.Span } - -var _ Span = noopSpan{} - -// SpanContext returns an empty span context. -func (noopSpan) SpanContext() SpanContext { return SpanContext{} } - -// IsRecording always returns false. -func (noopSpan) IsRecording() bool { return false } - -// SetStatus does nothing. -func (noopSpan) SetStatus(codes.Code, string) {} - -// SetError does nothing. -func (noopSpan) SetError(bool) {} - -// SetAttributes does nothing. -func (noopSpan) SetAttributes(...attribute.KeyValue) {} - -// End does nothing. -func (noopSpan) End(...SpanEndOption) {} - -// RecordError does nothing. -func (noopSpan) RecordError(error, ...EventOption) {} - -// AddEvent does nothing. -func (noopSpan) AddEvent(string, ...EventOption) {} - -// SetName does nothing. -func (noopSpan) SetName(string) {} - -// TracerProvider returns a no-op TracerProvider. -func (noopSpan) TracerProvider() TracerProvider { return noopTracerProvider{} } diff --git a/vendor/go.opentelemetry.io/otel/trace/trace.go b/vendor/go.opentelemetry.io/otel/trace/trace.go deleted file mode 100644 index 26a4b226..00000000 --- a/vendor/go.opentelemetry.io/otel/trace/trace.go +++ /dev/null @@ -1,577 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package trace // import "go.opentelemetry.io/otel/trace" - -import ( - "bytes" - "context" - "encoding/hex" - "encoding/json" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/trace/embedded" -) - -const ( - // FlagsSampled is a bitmask with the sampled bit set. A SpanContext - // with the sampling bit set means the span is sampled. - FlagsSampled = TraceFlags(0x01) - - errInvalidHexID errorConst = "trace-id and span-id can only contain [0-9a-f] characters, all lowercase" - - errInvalidTraceIDLength errorConst = "hex encoded trace-id must have length equals to 32" - errNilTraceID errorConst = "trace-id can't be all zero" - - errInvalidSpanIDLength errorConst = "hex encoded span-id must have length equals to 16" - errNilSpanID errorConst = "span-id can't be all zero" -) - -type errorConst string - -func (e errorConst) Error() string { - return string(e) -} - -// TraceID is a unique identity of a trace. -// nolint:revive // revive complains about stutter of `trace.TraceID`. -type TraceID [16]byte - -var ( - nilTraceID TraceID - _ json.Marshaler = nilTraceID -) - -// IsValid checks whether the trace TraceID is valid. A valid trace ID does -// not consist of zeros only. -func (t TraceID) IsValid() bool { - return !bytes.Equal(t[:], nilTraceID[:]) -} - -// MarshalJSON implements a custom marshal function to encode TraceID -// as a hex string. -func (t TraceID) MarshalJSON() ([]byte, error) { - return json.Marshal(t.String()) -} - -// String returns the hex string representation form of a TraceID. -func (t TraceID) String() string { - return hex.EncodeToString(t[:]) -} - -// SpanID is a unique identity of a span in a trace. -type SpanID [8]byte - -var ( - nilSpanID SpanID - _ json.Marshaler = nilSpanID -) - -// IsValid checks whether the SpanID is valid. A valid SpanID does not consist -// of zeros only. -func (s SpanID) IsValid() bool { - return !bytes.Equal(s[:], nilSpanID[:]) -} - -// MarshalJSON implements a custom marshal function to encode SpanID -// as a hex string. -func (s SpanID) MarshalJSON() ([]byte, error) { - return json.Marshal(s.String()) -} - -// String returns the hex string representation form of a SpanID. -func (s SpanID) String() string { - return hex.EncodeToString(s[:]) -} - -// TraceIDFromHex returns a TraceID from a hex string if it is compliant with -// the W3C trace-context specification. See more at -// https://www.w3.org/TR/trace-context/#trace-id -// nolint:revive // revive complains about stutter of `trace.TraceIDFromHex`. -func TraceIDFromHex(h string) (TraceID, error) { - t := TraceID{} - if len(h) != 32 { - return t, errInvalidTraceIDLength - } - - if err := decodeHex(h, t[:]); err != nil { - return t, err - } - - if !t.IsValid() { - return t, errNilTraceID - } - return t, nil -} - -// SpanIDFromHex returns a SpanID from a hex string if it is compliant -// with the w3c trace-context specification. -// See more at https://www.w3.org/TR/trace-context/#parent-id -func SpanIDFromHex(h string) (SpanID, error) { - s := SpanID{} - if len(h) != 16 { - return s, errInvalidSpanIDLength - } - - if err := decodeHex(h, s[:]); err != nil { - return s, err - } - - if !s.IsValid() { - return s, errNilSpanID - } - return s, nil -} - -func decodeHex(h string, b []byte) error { - for _, r := range h { - switch { - case 'a' <= r && r <= 'f': - continue - case '0' <= r && r <= '9': - continue - default: - return errInvalidHexID - } - } - - decoded, err := hex.DecodeString(h) - if err != nil { - return err - } - - copy(b, decoded) - return nil -} - -// TraceFlags contains flags that can be set on a SpanContext. -type TraceFlags byte //nolint:revive // revive complains about stutter of `trace.TraceFlags`. - -// IsSampled returns if the sampling bit is set in the TraceFlags. -func (tf TraceFlags) IsSampled() bool { - return tf&FlagsSampled == FlagsSampled -} - -// WithSampled sets the sampling bit in a new copy of the TraceFlags. -func (tf TraceFlags) WithSampled(sampled bool) TraceFlags { // nolint:revive // sampled is not a control flag. - if sampled { - return tf | FlagsSampled - } - - return tf &^ FlagsSampled -} - -// MarshalJSON implements a custom marshal function to encode TraceFlags -// as a hex string. -func (tf TraceFlags) MarshalJSON() ([]byte, error) { - return json.Marshal(tf.String()) -} - -// String returns the hex string representation form of TraceFlags. -func (tf TraceFlags) String() string { - return hex.EncodeToString([]byte{byte(tf)}[:]) -} - -// SpanContextConfig contains mutable fields usable for constructing -// an immutable SpanContext. -type SpanContextConfig struct { - TraceID TraceID - SpanID SpanID - TraceFlags TraceFlags - TraceState TraceState - Remote bool -} - -// NewSpanContext constructs a SpanContext using values from the provided -// SpanContextConfig. -func NewSpanContext(config SpanContextConfig) SpanContext { - return SpanContext{ - traceID: config.TraceID, - spanID: config.SpanID, - traceFlags: config.TraceFlags, - traceState: config.TraceState, - remote: config.Remote, - } -} - -// SpanContext contains identifying trace information about a Span. -type SpanContext struct { - traceID TraceID - spanID SpanID - traceFlags TraceFlags - traceState TraceState - remote bool -} - -var _ json.Marshaler = SpanContext{} - -// IsValid returns if the SpanContext is valid. A valid span context has a -// valid TraceID and SpanID. -func (sc SpanContext) IsValid() bool { - return sc.HasTraceID() && sc.HasSpanID() -} - -// IsRemote indicates whether the SpanContext represents a remotely-created Span. -func (sc SpanContext) IsRemote() bool { - return sc.remote -} - -// WithRemote returns a copy of sc with the Remote property set to remote. -func (sc SpanContext) WithRemote(remote bool) SpanContext { - return SpanContext{ - traceID: sc.traceID, - spanID: sc.spanID, - traceFlags: sc.traceFlags, - traceState: sc.traceState, - remote: remote, - } -} - -// TraceID returns the TraceID from the SpanContext. -func (sc SpanContext) TraceID() TraceID { - return sc.traceID -} - -// HasTraceID checks if the SpanContext has a valid TraceID. -func (sc SpanContext) HasTraceID() bool { - return sc.traceID.IsValid() -} - -// WithTraceID returns a new SpanContext with the TraceID replaced. -func (sc SpanContext) WithTraceID(traceID TraceID) SpanContext { - return SpanContext{ - traceID: traceID, - spanID: sc.spanID, - traceFlags: sc.traceFlags, - traceState: sc.traceState, - remote: sc.remote, - } -} - -// SpanID returns the SpanID from the SpanContext. -func (sc SpanContext) SpanID() SpanID { - return sc.spanID -} - -// HasSpanID checks if the SpanContext has a valid SpanID. -func (sc SpanContext) HasSpanID() bool { - return sc.spanID.IsValid() -} - -// WithSpanID returns a new SpanContext with the SpanID replaced. -func (sc SpanContext) WithSpanID(spanID SpanID) SpanContext { - return SpanContext{ - traceID: sc.traceID, - spanID: spanID, - traceFlags: sc.traceFlags, - traceState: sc.traceState, - remote: sc.remote, - } -} - -// TraceFlags returns the flags from the SpanContext. -func (sc SpanContext) TraceFlags() TraceFlags { - return sc.traceFlags -} - -// IsSampled returns if the sampling bit is set in the SpanContext's TraceFlags. -func (sc SpanContext) IsSampled() bool { - return sc.traceFlags.IsSampled() -} - -// WithTraceFlags returns a new SpanContext with the TraceFlags replaced. -func (sc SpanContext) WithTraceFlags(flags TraceFlags) SpanContext { - return SpanContext{ - traceID: sc.traceID, - spanID: sc.spanID, - traceFlags: flags, - traceState: sc.traceState, - remote: sc.remote, - } -} - -// TraceState returns the TraceState from the SpanContext. -func (sc SpanContext) TraceState() TraceState { - return sc.traceState -} - -// WithTraceState returns a new SpanContext with the TraceState replaced. -func (sc SpanContext) WithTraceState(state TraceState) SpanContext { - return SpanContext{ - traceID: sc.traceID, - spanID: sc.spanID, - traceFlags: sc.traceFlags, - traceState: state, - remote: sc.remote, - } -} - -// Equal is a predicate that determines whether two SpanContext values are equal. -func (sc SpanContext) Equal(other SpanContext) bool { - return sc.traceID == other.traceID && - sc.spanID == other.spanID && - sc.traceFlags == other.traceFlags && - sc.traceState.String() == other.traceState.String() && - sc.remote == other.remote -} - -// MarshalJSON implements a custom marshal function to encode a SpanContext. -func (sc SpanContext) MarshalJSON() ([]byte, error) { - return json.Marshal(SpanContextConfig{ - TraceID: sc.traceID, - SpanID: sc.spanID, - TraceFlags: sc.traceFlags, - TraceState: sc.traceState, - Remote: sc.remote, - }) -} - -// Span is the individual component of a trace. It represents a single named -// and timed operation of a workflow that is traced. A Tracer is used to -// create a Span and it is then up to the operation the Span represents to -// properly end the Span when the operation itself ends. -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type Span interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.Span - - // End completes the Span. The Span is considered complete and ready to be - // delivered through the rest of the telemetry pipeline after this method - // is called. Therefore, updates to the Span are not allowed after this - // method has been called. - End(options ...SpanEndOption) - - // AddEvent adds an event with the provided name and options. - AddEvent(name string, options ...EventOption) - - // IsRecording returns the recording state of the Span. It will return - // true if the Span is active and events can be recorded. - IsRecording() bool - - // RecordError will record err as an exception span event for this span. An - // additional call to SetStatus is required if the Status of the Span should - // be set to Error, as this method does not change the Span status. If this - // span is not being recorded or err is nil then this method does nothing. - RecordError(err error, options ...EventOption) - - // SpanContext returns the SpanContext of the Span. The returned SpanContext - // is usable even after the End method has been called for the Span. - SpanContext() SpanContext - - // SetStatus sets the status of the Span in the form of a code and a - // description, provided the status hasn't already been set to a higher - // value before (OK > Error > Unset). The description is only included in a - // status when the code is for an error. - SetStatus(code codes.Code, description string) - - // SetName sets the Span name. - SetName(name string) - - // SetAttributes sets kv as attributes of the Span. If a key from kv - // already exists for an attribute of the Span it will be overwritten with - // the value contained in kv. - SetAttributes(kv ...attribute.KeyValue) - - // TracerProvider returns a TracerProvider that can be used to generate - // additional Spans on the same telemetry pipeline as the current Span. - TracerProvider() TracerProvider -} - -// Link is the relationship between two Spans. The relationship can be within -// the same Trace or across different Traces. -// -// For example, a Link is used in the following situations: -// -// 1. Batch Processing: A batch of operations may contain operations -// associated with one or more traces/spans. Since there can only be one -// parent SpanContext, a Link is used to keep reference to the -// SpanContext of all operations in the batch. -// 2. Public Endpoint: A SpanContext for an in incoming client request on a -// public endpoint should be considered untrusted. In such a case, a new -// trace with its own identity and sampling decision needs to be created, -// but this new trace needs to be related to the original trace in some -// form. A Link is used to keep reference to the original SpanContext and -// track the relationship. -type Link struct { - // SpanContext of the linked Span. - SpanContext SpanContext - - // Attributes describe the aspects of the link. - Attributes []attribute.KeyValue -} - -// LinkFromContext returns a link encapsulating the SpanContext in the provided ctx. -func LinkFromContext(ctx context.Context, attrs ...attribute.KeyValue) Link { - return Link{ - SpanContext: SpanContextFromContext(ctx), - Attributes: attrs, - } -} - -// SpanKind is the role a Span plays in a Trace. -type SpanKind int - -// As a convenience, these match the proto definition, see -// https://github.com/open-telemetry/opentelemetry-proto/blob/30d237e1ff3ab7aa50e0922b5bebdd93505090af/opentelemetry/proto/trace/v1/trace.proto#L101-L129 -// -// The unspecified value is not a valid `SpanKind`. Use `ValidateSpanKind()` -// to coerce a span kind to a valid value. -const ( - // SpanKindUnspecified is an unspecified SpanKind and is not a valid - // SpanKind. SpanKindUnspecified should be replaced with SpanKindInternal - // if it is received. - SpanKindUnspecified SpanKind = 0 - // SpanKindInternal is a SpanKind for a Span that represents an internal - // operation within an application. - SpanKindInternal SpanKind = 1 - // SpanKindServer is a SpanKind for a Span that represents the operation - // of handling a request from a client. - SpanKindServer SpanKind = 2 - // SpanKindClient is a SpanKind for a Span that represents the operation - // of client making a request to a server. - SpanKindClient SpanKind = 3 - // SpanKindProducer is a SpanKind for a Span that represents the operation - // of a producer sending a message to a message broker. Unlike - // SpanKindClient and SpanKindServer, there is often no direct - // relationship between this kind of Span and a SpanKindConsumer kind. A - // SpanKindProducer Span will end once the message is accepted by the - // message broker which might not overlap with the processing of that - // message. - SpanKindProducer SpanKind = 4 - // SpanKindConsumer is a SpanKind for a Span that represents the operation - // of a consumer receiving a message from a message broker. Like - // SpanKindProducer Spans, there is often no direct relationship between - // this Span and the Span that produced the message. - SpanKindConsumer SpanKind = 5 -) - -// ValidateSpanKind returns a valid span kind value. This will coerce -// invalid values into the default value, SpanKindInternal. -func ValidateSpanKind(spanKind SpanKind) SpanKind { - switch spanKind { - case SpanKindInternal, - SpanKindServer, - SpanKindClient, - SpanKindProducer, - SpanKindConsumer: - // valid - return spanKind - default: - return SpanKindInternal - } -} - -// String returns the specified name of the SpanKind in lower-case. -func (sk SpanKind) String() string { - switch sk { - case SpanKindInternal: - return "internal" - case SpanKindServer: - return "server" - case SpanKindClient: - return "client" - case SpanKindProducer: - return "producer" - case SpanKindConsumer: - return "consumer" - default: - return "unspecified" - } -} - -// Tracer is the creator of Spans. -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type Tracer interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.Tracer - - // Start creates a span and a context.Context containing the newly-created span. - // - // If the context.Context provided in `ctx` contains a Span then the newly-created - // Span will be a child of that span, otherwise it will be a root span. This behavior - // can be overridden by providing `WithNewRoot()` as a SpanOption, causing the - // newly-created Span to be a root span even if `ctx` contains a Span. - // - // When creating a Span it is recommended to provide all known span attributes using - // the `WithAttributes()` SpanOption as samplers will only have access to the - // attributes provided when a Span is created. - // - // Any Span that is created MUST also be ended. This is the responsibility of the user. - // Implementations of this API may leak memory or other resources if Spans are not ended. - Start(ctx context.Context, spanName string, opts ...SpanStartOption) (context.Context, Span) -} - -// TracerProvider provides Tracers that are used by instrumentation code to -// trace computational workflows. -// -// A TracerProvider is the collection destination of all Spans from Tracers it -// provides, it represents a unique telemetry collection pipeline. How that -// pipeline is defined, meaning how those Spans are collected, processed, and -// where they are exported, depends on its implementation. Instrumentation -// authors do not need to define this implementation, rather just use the -// provided Tracers to instrument code. -// -// Commonly, instrumentation code will accept a TracerProvider implementation -// at runtime from its users or it can simply use the globally registered one -// (see https://pkg.go.dev/go.opentelemetry.io/otel#GetTracerProvider). -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type TracerProvider interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.TracerProvider - - // Tracer returns a unique Tracer scoped to be used by instrumentation code - // to trace computational workflows. The scope and identity of that - // instrumentation code is uniquely defined by the name and options passed. - // - // The passed name needs to uniquely identify instrumentation code. - // Therefore, it is recommended that name is the Go package name of the - // library providing instrumentation (note: not the code being - // instrumented). Instrumentation libraries can have multiple versions, - // therefore, the WithInstrumentationVersion option should be used to - // distinguish these different codebases. Additionally, instrumentation - // libraries may sometimes use traces to communicate different domains of - // workflow data (i.e. using spans to communicate workflow events only). If - // this is the case, the WithScopeAttributes option should be used to - // uniquely identify Tracers that handle the different domains of workflow - // data. - // - // If the same name and options are passed multiple times, the same Tracer - // will be returned (it is up to the implementation if this will be the - // same underlying instance of that Tracer or not). It is not necessary to - // call this multiple times with the same name and options to get an - // up-to-date Tracer. All implementations will ensure any TracerProvider - // configuration changes are propagated to all provided Tracers. - // - // If name is empty, then an implementation defined default name will be - // used instead. - // - // This method is safe to call concurrently. - Tracer(name string, options ...TracerOption) Tracer -} diff --git a/vendor/go.opentelemetry.io/otel/trace/tracestate.go b/vendor/go.opentelemetry.io/otel/trace/tracestate.go deleted file mode 100644 index db936ba5..00000000 --- a/vendor/go.opentelemetry.io/otel/trace/tracestate.go +++ /dev/null @@ -1,331 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package trace // import "go.opentelemetry.io/otel/trace" - -import ( - "encoding/json" - "fmt" - "strings" -) - -const ( - maxListMembers = 32 - - listDelimiters = "," - memberDelimiter = "=" - - errInvalidKey errorConst = "invalid tracestate key" - errInvalidValue errorConst = "invalid tracestate value" - errInvalidMember errorConst = "invalid tracestate list-member" - errMemberNumber errorConst = "too many list-members in tracestate" - errDuplicate errorConst = "duplicate list-member in tracestate" -) - -type member struct { - Key string - Value string -} - -// according to (chr = %x20 / (nblk-char = %x21-2B / %x2D-3C / %x3E-7E) ) -// means (chr = %x20-2B / %x2D-3C / %x3E-7E) . -func checkValueChar(v byte) bool { - return v >= '\x20' && v <= '\x7e' && v != '\x2c' && v != '\x3d' -} - -// according to (nblk-chr = %x21-2B / %x2D-3C / %x3E-7E) . -func checkValueLast(v byte) bool { - return v >= '\x21' && v <= '\x7e' && v != '\x2c' && v != '\x3d' -} - -// based on the W3C Trace Context specification -// -// value = (0*255(chr)) nblk-chr -// nblk-chr = %x21-2B / %x2D-3C / %x3E-7E -// chr = %x20 / nblk-chr -// -// see https://www.w3.org/TR/trace-context-1/#value -func checkValue(val string) bool { - n := len(val) - if n == 0 || n > 256 { - return false - } - for i := 0; i < n-1; i++ { - if !checkValueChar(val[i]) { - return false - } - } - return checkValueLast(val[n-1]) -} - -func checkKeyRemain(key string) bool { - // ( lcalpha / DIGIT / "_" / "-"/ "*" / "/" ) - for _, v := range key { - if isAlphaNum(byte(v)) { - continue - } - switch v { - case '_', '-', '*', '/': - continue - } - return false - } - return true -} - -// according to -// -// simple-key = lcalpha (0*255( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) -// system-id = lcalpha (0*13( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) -// -// param n is remain part length, should be 255 in simple-key or 13 in system-id. -func checkKeyPart(key string, n int) bool { - if len(key) == 0 { - return false - } - first := key[0] // key's first char - ret := len(key[1:]) <= n - ret = ret && first >= 'a' && first <= 'z' - return ret && checkKeyRemain(key[1:]) -} - -func isAlphaNum(c byte) bool { - if c >= 'a' && c <= 'z' { - return true - } - return c >= '0' && c <= '9' -} - -// according to -// -// tenant-id = ( lcalpha / DIGIT ) 0*240( lcalpha / DIGIT / "_" / "-"/ "*" / "/" ) -// -// param n is remain part length, should be 240 exactly. -func checkKeyTenant(key string, n int) bool { - if len(key) == 0 { - return false - } - return isAlphaNum(key[0]) && len(key[1:]) <= n && checkKeyRemain(key[1:]) -} - -// based on the W3C Trace Context specification -// -// key = simple-key / multi-tenant-key -// simple-key = lcalpha (0*255( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) -// multi-tenant-key = tenant-id "@" system-id -// tenant-id = ( lcalpha / DIGIT ) (0*240( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) -// system-id = lcalpha (0*13( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) -// lcalpha = %x61-7A ; a-z -// -// see https://www.w3.org/TR/trace-context-1/#tracestate-header. -func checkKey(key string) bool { - tenant, system, ok := strings.Cut(key, "@") - if !ok { - return checkKeyPart(key, 255) - } - return checkKeyTenant(tenant, 240) && checkKeyPart(system, 13) -} - -func newMember(key, value string) (member, error) { - if !checkKey(key) { - return member{}, errInvalidKey - } - if !checkValue(value) { - return member{}, errInvalidValue - } - return member{Key: key, Value: value}, nil -} - -func parseMember(m string) (member, error) { - key, val, ok := strings.Cut(m, memberDelimiter) - if !ok { - return member{}, fmt.Errorf("%w: %s", errInvalidMember, m) - } - key = strings.TrimLeft(key, " \t") - val = strings.TrimRight(val, " \t") - result, e := newMember(key, val) - if e != nil { - return member{}, fmt.Errorf("%w: %s", errInvalidMember, m) - } - return result, nil -} - -// String encodes member into a string compliant with the W3C Trace Context -// specification. -func (m member) String() string { - return m.Key + "=" + m.Value -} - -// TraceState provides additional vendor-specific trace identification -// information across different distributed tracing systems. It represents an -// immutable list consisting of key/value pairs, each pair is referred to as a -// list-member. -// -// TraceState conforms to the W3C Trace Context specification -// (https://www.w3.org/TR/trace-context-1). All operations that create or copy -// a TraceState do so by validating all input and will only produce TraceState -// that conform to the specification. Specifically, this means that all -// list-member's key/value pairs are valid, no duplicate list-members exist, -// and the maximum number of list-members (32) is not exceeded. -type TraceState struct { //nolint:revive // revive complains about stutter of `trace.TraceState` - // list is the members in order. - list []member -} - -var _ json.Marshaler = TraceState{} - -// ParseTraceState attempts to decode a TraceState from the passed -// string. It returns an error if the input is invalid according to the W3C -// Trace Context specification. -func ParseTraceState(ts string) (TraceState, error) { - if ts == "" { - return TraceState{}, nil - } - - wrapErr := func(err error) error { - return fmt.Errorf("failed to parse tracestate: %w", err) - } - - var members []member - found := make(map[string]struct{}) - for ts != "" { - var memberStr string - memberStr, ts, _ = strings.Cut(ts, listDelimiters) - if len(memberStr) == 0 { - continue - } - - m, err := parseMember(memberStr) - if err != nil { - return TraceState{}, wrapErr(err) - } - - if _, ok := found[m.Key]; ok { - return TraceState{}, wrapErr(errDuplicate) - } - found[m.Key] = struct{}{} - - members = append(members, m) - if n := len(members); n > maxListMembers { - return TraceState{}, wrapErr(errMemberNumber) - } - } - - return TraceState{list: members}, nil -} - -// MarshalJSON marshals the TraceState into JSON. -func (ts TraceState) MarshalJSON() ([]byte, error) { - return json.Marshal(ts.String()) -} - -// String encodes the TraceState into a string compliant with the W3C -// Trace Context specification. The returned string will be invalid if the -// TraceState contains any invalid members. -func (ts TraceState) String() string { - if len(ts.list) == 0 { - return "" - } - var n int - n += len(ts.list) // member delimiters: '=' - n += len(ts.list) - 1 // list delimiters: ',' - for _, mem := range ts.list { - n += len(mem.Key) - n += len(mem.Value) - } - - var sb strings.Builder - sb.Grow(n) - _, _ = sb.WriteString(ts.list[0].Key) - _ = sb.WriteByte('=') - _, _ = sb.WriteString(ts.list[0].Value) - for i := 1; i < len(ts.list); i++ { - _ = sb.WriteByte(listDelimiters[0]) - _, _ = sb.WriteString(ts.list[i].Key) - _ = sb.WriteByte('=') - _, _ = sb.WriteString(ts.list[i].Value) - } - return sb.String() -} - -// Get returns the value paired with key from the corresponding TraceState -// list-member if it exists, otherwise an empty string is returned. -func (ts TraceState) Get(key string) string { - for _, member := range ts.list { - if member.Key == key { - return member.Value - } - } - - return "" -} - -// Insert adds a new list-member defined by the key/value pair to the -// TraceState. If a list-member already exists for the given key, that -// list-member's value is updated. The new or updated list-member is always -// moved to the beginning of the TraceState as specified by the W3C Trace -// Context specification. -// -// If key or value are invalid according to the W3C Trace Context -// specification an error is returned with the original TraceState. -// -// If adding a new list-member means the TraceState would have more members -// then is allowed, the new list-member will be inserted and the right-most -// list-member will be dropped in the returned TraceState. -func (ts TraceState) Insert(key, value string) (TraceState, error) { - m, err := newMember(key, value) - if err != nil { - return ts, err - } - n := len(ts.list) - found := n - for i := range ts.list { - if ts.list[i].Key == key { - found = i - } - } - cTS := TraceState{} - if found == n && n < maxListMembers { - cTS.list = make([]member, n+1) - } else { - cTS.list = make([]member, n) - } - cTS.list[0] = m - // When the number of members exceeds capacity, drop the "right-most". - copy(cTS.list[1:], ts.list[0:found]) - if found < n { - copy(cTS.list[1+found:], ts.list[found+1:]) - } - return cTS, nil -} - -// Delete returns a copy of the TraceState with the list-member identified by -// key removed. -func (ts TraceState) Delete(key string) TraceState { - members := make([]member, ts.Len()) - copy(members, ts.list) - for i, member := range ts.list { - if member.Key == key { - members = append(members[:i], members[i+1:]...) - // TraceState should contain no duplicate members. - break - } - } - return TraceState{list: members} -} - -// Len returns the number of list-members in the TraceState. -func (ts TraceState) Len() int { - return len(ts.list) -} diff --git a/vendor/go.opentelemetry.io/otel/verify_examples.sh b/vendor/go.opentelemetry.io/otel/verify_examples.sh deleted file mode 100644 index dbb61a42..00000000 --- a/vendor/go.opentelemetry.io/otel/verify_examples.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/bash - -# Copyright The OpenTelemetry Authors -# -# 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. - -set -euo pipefail - -cd $(dirname $0) -TOOLS_DIR=$(pwd)/.tools - -if [ -z "${GOPATH}" ] ; then - printf "GOPATH is not defined.\n" - exit -1 -fi - -if [ ! -d "${GOPATH}" ] ; then - printf "GOPATH ${GOPATH} is invalid \n" - exit -1 -fi - -# Pre-requisites -if ! git diff --quiet; then \ - git status - printf "\n\nError: working tree is not clean\n" - exit -1 -fi - -if [ "$(git tag --contains $(git log -1 --pretty=format:"%H"))" = "" ] ; then - printf "$(git log -1)" - printf "\n\nError: HEAD is not pointing to a tagged version" -fi - -make ${TOOLS_DIR}/gojq - -DIR_TMP="${GOPATH}/src/oteltmp/" -rm -rf $DIR_TMP -mkdir -p $DIR_TMP - -printf "Copy examples to ${DIR_TMP}\n" -cp -a ./example ${DIR_TMP} - -# Update go.mod files -printf "Update go.mod: rename module and remove replace\n" - -PACKAGE_DIRS=$(find . -mindepth 2 -type f -name 'go.mod' -exec dirname {} \; | egrep 'example' | sed 's/^\.\///' | sort) - -for dir in $PACKAGE_DIRS; do - printf " Update go.mod for $dir\n" - (cd "${DIR_TMP}/${dir}" && \ - # replaces is ("mod1" "mod2" …) - replaces=($(go mod edit -json | ${TOOLS_DIR}/gojq '.Replace[].Old.Path')) && \ - # strip double quotes - replaces=("${replaces[@]%\"}") && \ - replaces=("${replaces[@]#\"}") && \ - # make an array (-dropreplace=mod1 -dropreplace=mod2 …) - dropreplaces=("${replaces[@]/#/-dropreplace=}") && \ - go mod edit -module "oteltmp/${dir}" "${dropreplaces[@]}" && \ - go mod tidy) -done -printf "Update done:\n\n" - -# Build directories that contain main package. These directories are different than -# directories that contain go.mod files. -printf "Build examples:\n" -EXAMPLES=$(./get_main_pkgs.sh ./example) -for ex in $EXAMPLES; do - printf " Build $ex in ${DIR_TMP}/${ex}\n" - (cd "${DIR_TMP}/${ex}" && \ - go build .) -done - -# Cleanup -printf "Remove copied files.\n" -rm -rf $DIR_TMP diff --git a/vendor/go.opentelemetry.io/otel/version.go b/vendor/go.opentelemetry.io/otel/version.go deleted file mode 100644 index 7b2993a1..00000000 --- a/vendor/go.opentelemetry.io/otel/version.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// 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. - -package otel // import "go.opentelemetry.io/otel" - -// Version is the current release version of OpenTelemetry in use. -func Version() string { - return "1.24.0" -} diff --git a/vendor/go.opentelemetry.io/otel/versions.yaml b/vendor/go.opentelemetry.io/otel/versions.yaml deleted file mode 100644 index 1b556e67..00000000 --- a/vendor/go.opentelemetry.io/otel/versions.yaml +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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. - -module-sets: - stable-v1: - version: v1.24.0 - modules: - - go.opentelemetry.io/otel - - go.opentelemetry.io/otel/bridge/opencensus - - go.opentelemetry.io/otel/bridge/opencensus/test - - go.opentelemetry.io/otel/bridge/opentracing - - go.opentelemetry.io/otel/bridge/opentracing/test - - go.opentelemetry.io/otel/example/dice - - go.opentelemetry.io/otel/example/namedtracer - - go.opentelemetry.io/otel/example/opencensus - - go.opentelemetry.io/otel/example/otel-collector - - go.opentelemetry.io/otel/example/passthrough - - go.opentelemetry.io/otel/example/zipkin - - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc - - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp - - go.opentelemetry.io/otel/exporters/otlp/otlptrace - - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc - - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp - - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric - - go.opentelemetry.io/otel/exporters/stdout/stdouttrace - - go.opentelemetry.io/otel/exporters/zipkin - - go.opentelemetry.io/otel/metric - - go.opentelemetry.io/otel/sdk - - go.opentelemetry.io/otel/sdk/metric - - go.opentelemetry.io/otel/trace - experimental-metrics: - version: v0.46.0 - modules: - - go.opentelemetry.io/otel/example/prometheus - - go.opentelemetry.io/otel/exporters/prometheus - experimental-logs: - version: v0.0.1-alpha - modules: - - go.opentelemetry.io/otel/log - experimental-schema: - version: v0.0.7 - modules: - - go.opentelemetry.io/otel/schema -excluded-modules: - - go.opentelemetry.io/otel/internal/tools diff --git a/vendor/golang.org/x/sync/LICENSE b/vendor/golang.org/x/sync/LICENSE deleted file mode 100644 index 6a66aea5..00000000 --- a/vendor/golang.org/x/sync/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/sync/PATENTS b/vendor/golang.org/x/sync/PATENTS deleted file mode 100644 index 73309904..00000000 --- a/vendor/golang.org/x/sync/PATENTS +++ /dev/null @@ -1,22 +0,0 @@ -Additional IP Rights Grant (Patents) - -"This implementation" means the copyrightable works distributed by -Google as part of the Go project. - -Google hereby grants to You a perpetual, worldwide, non-exclusive, -no-charge, royalty-free, irrevocable (except as stated in this section) -patent license to make, have made, use, offer to sell, sell, import, -transfer and otherwise run, modify and propagate the contents of this -implementation of Go, where such license applies only to those patent -claims, both currently owned or controlled by Google and acquired in -the future, licensable by Google that are necessarily infringed by this -implementation of Go. This grant does not include claims that would be -infringed only as a consequence of further modification of this -implementation. If you or your agent or exclusive licensee institute or -order or agree to the institution of patent litigation against any -entity (including a cross-claim or counterclaim in a lawsuit) alleging -that this implementation of Go or any code incorporated within this -implementation of Go constitutes direct or contributory patent -infringement, or inducement of patent infringement, then any patent -rights granted to you under this License for this implementation of Go -shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/sync/errgroup/errgroup.go b/vendor/golang.org/x/sync/errgroup/errgroup.go deleted file mode 100644 index 948a3ee6..00000000 --- a/vendor/golang.org/x/sync/errgroup/errgroup.go +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package errgroup provides synchronization, error propagation, and Context -// cancelation for groups of goroutines working on subtasks of a common task. -// -// [errgroup.Group] is related to [sync.WaitGroup] but adds handling of tasks -// returning errors. -package errgroup - -import ( - "context" - "fmt" - "sync" -) - -type token struct{} - -// A Group is a collection of goroutines working on subtasks that are part of -// the same overall task. -// -// A zero Group is valid, has no limit on the number of active goroutines, -// and does not cancel on error. -type Group struct { - cancel func(error) - - wg sync.WaitGroup - - sem chan token - - errOnce sync.Once - err error -} - -func (g *Group) done() { - if g.sem != nil { - <-g.sem - } - g.wg.Done() -} - -// WithContext returns a new Group and an associated Context derived from ctx. -// -// The derived Context is canceled the first time a function passed to Go -// returns a non-nil error or the first time Wait returns, whichever occurs -// first. -func WithContext(ctx context.Context) (*Group, context.Context) { - ctx, cancel := withCancelCause(ctx) - return &Group{cancel: cancel}, ctx -} - -// Wait blocks until all function calls from the Go method have returned, then -// returns the first non-nil error (if any) from them. -func (g *Group) Wait() error { - g.wg.Wait() - if g.cancel != nil { - g.cancel(g.err) - } - return g.err -} - -// Go calls the given function in a new goroutine. -// It blocks until the new goroutine can be added without the number of -// active goroutines in the group exceeding the configured limit. -// -// The first call to return a non-nil error cancels the group's context, if the -// group was created by calling WithContext. The error will be returned by Wait. -func (g *Group) Go(f func() error) { - if g.sem != nil { - g.sem <- token{} - } - - g.wg.Add(1) - go func() { - defer g.done() - - if err := f(); err != nil { - g.errOnce.Do(func() { - g.err = err - if g.cancel != nil { - g.cancel(g.err) - } - }) - } - }() -} - -// TryGo calls the given function in a new goroutine only if the number of -// active goroutines in the group is currently below the configured limit. -// -// The return value reports whether the goroutine was started. -func (g *Group) TryGo(f func() error) bool { - if g.sem != nil { - select { - case g.sem <- token{}: - // Note: this allows barging iff channels in general allow barging. - default: - return false - } - } - - g.wg.Add(1) - go func() { - defer g.done() - - if err := f(); err != nil { - g.errOnce.Do(func() { - g.err = err - if g.cancel != nil { - g.cancel(g.err) - } - }) - } - }() - return true -} - -// SetLimit limits the number of active goroutines in this group to at most n. -// A negative value indicates no limit. -// -// Any subsequent call to the Go method will block until it can add an active -// goroutine without exceeding the configured limit. -// -// The limit must not be modified while any goroutines in the group are active. -func (g *Group) SetLimit(n int) { - if n < 0 { - g.sem = nil - return - } - if len(g.sem) != 0 { - panic(fmt.Errorf("errgroup: modify limit while %v goroutines in the group are still active", len(g.sem))) - } - g.sem = make(chan token, n) -} diff --git a/vendor/golang.org/x/sync/errgroup/go120.go b/vendor/golang.org/x/sync/errgroup/go120.go deleted file mode 100644 index f93c740b..00000000 --- a/vendor/golang.org/x/sync/errgroup/go120.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2023 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build go1.20 - -package errgroup - -import "context" - -func withCancelCause(parent context.Context) (context.Context, func(error)) { - return context.WithCancelCause(parent) -} diff --git a/vendor/golang.org/x/sync/errgroup/pre_go120.go b/vendor/golang.org/x/sync/errgroup/pre_go120.go deleted file mode 100644 index 88ce3343..00000000 --- a/vendor/golang.org/x/sync/errgroup/pre_go120.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2023 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !go1.20 - -package errgroup - -import "context" - -func withCancelCause(parent context.Context) (context.Context, func(error)) { - ctx, cancel := context.WithCancel(parent) - return ctx, func(error) { cancel() } -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 45324343..9968fd1f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,17 +1,6 @@ -# dagger.io/dagger v0.11.4 -## explicit; go 1.21 -dagger.io/dagger -dagger.io/dagger/internal/engineconn -dagger.io/dagger/querybuilder # dario.cat/mergo v1.0.0 ## explicit; go 1.13 dario.cat/mergo -# github.com/99designs/gqlgen v0.17.44 -## explicit; go 1.20 -github.com/99designs/gqlgen/graphql -# github.com/Khan/genqlient v0.7.0 -## explicit; go 1.20 -github.com/Khan/genqlient/graphql # github.com/Microsoft/go-winio v0.6.1 ## explicit; go 1.17 github.com/Microsoft/go-winio @@ -39,10 +28,6 @@ github.com/ProtonMail/go-crypto/openpgp/internal/ecc github.com/ProtonMail/go-crypto/openpgp/internal/encoding github.com/ProtonMail/go-crypto/openpgp/packet github.com/ProtonMail/go-crypto/openpgp/s2k -# github.com/adrg/xdg v0.4.0 -## explicit; go 1.14 -github.com/adrg/xdg -github.com/adrg/xdg/internal/pathutil # github.com/bmatcuk/doublestar/v4 v4.6.1 ## explicit; go 1.16 github.com/bmatcuk/doublestar/v4 @@ -139,22 +124,12 @@ github.com/go-git/go-git/v5/utils/merkletrie/internal/frame github.com/go-git/go-git/v5/utils/merkletrie/noder github.com/go-git/go-git/v5/utils/sync github.com/go-git/go-git/v5/utils/trace -# github.com/go-logr/logr v1.4.1 -## explicit; go 1.18 -github.com/go-logr/logr -github.com/go-logr/logr/funcr -# github.com/go-logr/stdr v1.2.2 -## explicit; go 1.16 -github.com/go-logr/stdr # github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da ## explicit github.com/golang/groupcache/lru # github.com/golang/protobuf v1.5.4 ## explicit; go 1.17 github.com/golang/protobuf/proto -# github.com/google/uuid v1.6.0 -## explicit -github.com/google/uuid # github.com/hashicorp/go-cleanhttp v0.5.2 ## explicit; go 1.13 github.com/hashicorp/go-cleanhttp @@ -194,12 +169,11 @@ github.com/launchdarkly/json-patch # github.com/magiconair/properties v1.8.7 ## explicit; go 1.19 github.com/magiconair/properties +# github.com/mattn/go-isatty v0.0.20 +## explicit; go 1.15 # github.com/mattn/go-runewidth v0.0.9 ## explicit; go 1.9 github.com/mattn/go-runewidth -# github.com/mitchellh/go-homedir v1.1.0 -## explicit -github.com/mitchellh/go-homedir # github.com/mitchellh/mapstructure v1.5.0 ## explicit; go 1.14 github.com/mitchellh/mapstructure @@ -239,9 +213,6 @@ github.com/sergi/go-diff/diffmatchpatch # github.com/skeema/knownhosts v1.2.1 ## explicit; go 1.17 github.com/skeema/knownhosts -# github.com/sosodev/duration v1.2.0 -## explicit; go 1.17 -github.com/sosodev/duration # github.com/sourcegraph/conc v0.3.0 ## explicit; go 1.19 github.com/sourcegraph/conc @@ -280,32 +251,9 @@ github.com/stretchr/testify/require # github.com/subosito/gotenv v1.6.0 ## explicit; go 1.18 github.com/subosito/gotenv -# github.com/vektah/gqlparser/v2 v2.5.11 -## explicit; go 1.19 -github.com/vektah/gqlparser/v2/ast -github.com/vektah/gqlparser/v2/gqlerror # github.com/xanzy/ssh-agent v0.3.3 ## explicit; go 1.16 github.com/xanzy/ssh-agent -# go.opentelemetry.io/otel v1.24.0 -## explicit; go 1.20 -go.opentelemetry.io/otel -go.opentelemetry.io/otel/attribute -go.opentelemetry.io/otel/baggage -go.opentelemetry.io/otel/codes -go.opentelemetry.io/otel/internal -go.opentelemetry.io/otel/internal/attribute -go.opentelemetry.io/otel/internal/baggage -go.opentelemetry.io/otel/internal/global -go.opentelemetry.io/otel/propagation -# go.opentelemetry.io/otel/metric v1.24.0 -## explicit; go 1.20 -go.opentelemetry.io/otel/metric -go.opentelemetry.io/otel/metric/embedded -# go.opentelemetry.io/otel/trace v1.24.0 -## explicit; go 1.20 -go.opentelemetry.io/otel/trace -go.opentelemetry.io/otel/trace/embedded # go.uber.org/atomic v1.9.0 ## explicit; go 1.13 go.uber.org/atomic @@ -350,7 +298,6 @@ golang.org/x/oauth2 golang.org/x/oauth2/internal # golang.org/x/sync v0.7.0 ## explicit; go 1.18 -golang.org/x/sync/errgroup # golang.org/x/sys v0.17.0 ## explicit; go 1.18 golang.org/x/sys/cpu