Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Integrate Traefik API proxy with Aperture #1977

Closed
wants to merge 2 commits into from

Conversation

slayer321
Copy link
Contributor

@slayer321 slayer321 commented May 18, 2023

@openai ignore

Description of change

closes #1804

Checklist
  • Tested in playground or other setup
  • Screenshot (Grafana) from playground added to PR for 15+ minute run
  • Documentation is changed or added
  • Tests and/or benchmarks are included
  • Breaking changes

Summary by OpenAI

New Feature:

  • Added Traefik API proxy integration with Aperture middleware plugin
    • Implemented http.Handler interface for TraefikPlugin
    • Provided utility functions for gRPC client connection and environment variables handling
    • Included test data and summary of the change

Chore:

  • Updated .gitignore for backoff/v4 package
  • Added .golangci.yaml configuration file for CI/CD pipeline

🎉 A new integration takes flight, 🚀
Connecting Traefik and Aperture just right. 🌐
Middleware magic, code so fine, ✨
Together they'll shine, in perfect design! 🤖🎊

@github-actions
Copy link
Contributor

github-actions bot commented May 18, 2023

🤖 OpenAI

Here is the summary of changes:

The diff adds a new middleware plugin to integrate Traefik API proxy with Aperture, including a package traefikplugin with a Config struct, a TraefikPlugin struct implementing http.Handler, utility functions, and constants. The changes also include test data, CI/CD pipeline configuration, and Git ignore rules.

Files Summary
integrations/traefik-plugin/.traefik.yml, traefik.go, utils.go Adds a new middleware plugin for Traefik API proxy integration with Aperture, including structs, utility functions, and constants. Requires thorough review for security vulnerabilities and logic issues.
integrations/traefik-plugin/vendor/github.com/cenkalti/backoff/v4/.gitignore Adds Git ignore rules for the backoff library. No impact on code logic or functionality.
integrations/traefik-plugin/vendor/github.com/go-logr/logr/.golangci.yaml Adds a new configuration file for CI/CD pipeline, enabling and disabling linters and setting options for issue tracking. Minor changes with no impact on code logic or functionality.

Chat with 🤖 OpenAI Bot (@openai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @openai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Ignoring further reviews

  • Type @openai: ignore anywhere in the PR description to ignore further reviews from the bot.

Files ignored due to filter (287)

Ignored files

  • integrations/traefik-config/dynamic-rule-config.yaml
  • integrations/traefik-config/static-config.yaml
  • integrations/traefik-plugin/go.mod
  • integrations/traefik-plugin/vendor/github.com/cenkalti/backoff/v4/LICENSE
  • integrations/traefik-plugin/vendor/github.com/cenkalti/backoff/v4/README.md
  • integrations/traefik-plugin/vendor/github.com/cenkalti/backoff/v4/backoff.go
  • integrations/traefik-plugin/vendor/github.com/cenkalti/backoff/v4/context.go
  • integrations/traefik-plugin/vendor/github.com/cenkalti/backoff/v4/exponential.go
  • integrations/traefik-plugin/vendor/github.com/cenkalti/backoff/v4/retry.go
  • integrations/traefik-plugin/vendor/github.com/cenkalti/backoff/v4/ticker.go
  • integrations/traefik-plugin/vendor/github.com/cenkalti/backoff/v4/timer.go
  • integrations/traefik-plugin/vendor/github.com/cenkalti/backoff/v4/tries.go
  • integrations/traefik-plugin/vendor/github.com/envoyproxy/protoc-gen-validate/LICENSE
  • integrations/traefik-plugin/vendor/github.com/envoyproxy/protoc-gen-validate/NOTICE
  • integrations/traefik-plugin/vendor/github.com/envoyproxy/protoc-gen-validate/validate/BUILD
  • integrations/traefik-plugin/vendor/github.com/envoyproxy/protoc-gen-validate/validate/validate.h
  • integrations/traefik-plugin/vendor/github.com/envoyproxy/protoc-gen-validate/validate/validate.pb.go
  • integrations/traefik-plugin/vendor/github.com/envoyproxy/protoc-gen-validate/validate/validate.proto
  • integrations/traefik-plugin/vendor/github.com/fluxninja/aperture-go/v2/LICENSE.txt
  • integrations/traefik-plugin/vendor/github.com/fluxninja/aperture-go/v2/gen/proto/flowcontrol/check/v1/check.pb.go
  • integrations/traefik-plugin/vendor/github.com/fluxninja/aperture-go/v2/gen/proto/flowcontrol/check/v1/check.pb.json.go
  • integrations/traefik-plugin/vendor/github.com/fluxninja/aperture-go/v2/gen/proto/flowcontrol/check/v1/check.pb.validate.go
  • integrations/traefik-plugin/vendor/github.com/fluxninja/aperture-go/v2/gen/proto/flowcontrol/check/v1/check_deepcopy.gen.go
  • integrations/traefik-plugin/vendor/github.com/fluxninja/aperture-go/v2/gen/proto/flowcontrol/check/v1/check_grpc.pb.go
  • integrations/traefik-plugin/vendor/github.com/fluxninja/aperture-go/v2/gen/proto/flowcontrol/checkhttp/v1/checkhttp.pb.go
  • integrations/traefik-plugin/vendor/github.com/fluxninja/aperture-go/v2/gen/proto/flowcontrol/checkhttp/v1/checkhttp.pb.gw.go
  • integrations/traefik-plugin/vendor/github.com/fluxninja/aperture-go/v2/gen/proto/flowcontrol/checkhttp/v1/checkhttp.pb.json.go
  • integrations/traefik-plugin/vendor/github.com/fluxninja/aperture-go/v2/gen/proto/flowcontrol/checkhttp/v1/checkhttp.pb.validate.go
  • integrations/traefik-plugin/vendor/github.com/fluxninja/aperture-go/v2/gen/proto/flowcontrol/checkhttp/v1/checkhttp_deepcopy.gen.go
  • integrations/traefik-plugin/vendor/github.com/fluxninja/aperture-go/v2/gen/proto/flowcontrol/checkhttp/v1/checkhttp_grpc.pb.go
  • integrations/traefik-plugin/vendor/github.com/fluxninja/aperture-go/v2/sdk/client.go
  • integrations/traefik-plugin/vendor/github.com/fluxninja/aperture-go/v2/sdk/const.go
  • integrations/traefik-plugin/vendor/github.com/fluxninja/aperture-go/v2/sdk/flow-status-string.go
  • integrations/traefik-plugin/vendor/github.com/fluxninja/aperture-go/v2/sdk/flow.go
  • integrations/traefik-plugin/vendor/github.com/fluxninja/aperture-go/v2/sdk/flowstatus.go
  • integrations/traefik-plugin/vendor/github.com/fluxninja/aperture-go/v2/sdk/httpflow.go
  • integrations/traefik-plugin/vendor/github.com/fluxninja/aperture-go/v2/sdk/middlewares/grpc.go
  • integrations/traefik-plugin/vendor/github.com/fluxninja/aperture-go/v2/sdk/middlewares/http.go
  • integrations/traefik-plugin/vendor/github.com/fluxninja/aperture-go/v2/sdk/middlewares/utils.go
  • integrations/traefik-plugin/vendor/github.com/go-logr/logr/CHANGELOG.md
  • integrations/traefik-plugin/vendor/github.com/go-logr/logr/CONTRIBUTING.md
  • integrations/traefik-plugin/vendor/github.com/go-logr/logr/LICENSE
  • integrations/traefik-plugin/vendor/github.com/go-logr/logr/README.md
  • integrations/traefik-plugin/vendor/github.com/go-logr/logr/discard.go
  • integrations/traefik-plugin/vendor/github.com/go-logr/logr/funcr/funcr.go
  • integrations/traefik-plugin/vendor/github.com/go-logr/logr/logr.go
  • integrations/traefik-plugin/vendor/github.com/go-logr/stdr/LICENSE
  • integrations/traefik-plugin/vendor/github.com/go-logr/stdr/README.md
  • integrations/traefik-plugin/vendor/github.com/go-logr/stdr/stdr.go
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/AUTHORS
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/CONTRIBUTORS
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/LICENSE
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/jsonpb/decode.go
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/jsonpb/encode.go
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/jsonpb/json.go
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/proto/buffer.go
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/proto/defaults.go
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/proto/deprecated.go
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/proto/discard.go
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/proto/extensions.go
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/proto/properties.go
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/proto/proto.go
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/proto/registry.go
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/proto/text_decode.go
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/proto/text_encode.go
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/proto/wire.go
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/proto/wrappers.go
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/ptypes/any.go
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/ptypes/doc.go
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/ptypes/duration.go
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/ptypes/timestamp.go
  • integrations/traefik-plugin/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go
  • integrations/traefik-plugin/vendor/github.com/gorilla/mux/AUTHORS
  • integrations/traefik-plugin/vendor/github.com/gorilla/mux/LICENSE
  • integrations/traefik-plugin/vendor/github.com/gorilla/mux/README.md
  • integrations/traefik-plugin/vendor/github.com/gorilla/mux/doc.go
  • integrations/traefik-plugin/vendor/github.com/gorilla/mux/middleware.go
  • integrations/traefik-plugin/vendor/github.com/gorilla/mux/mux.go
  • integrations/traefik-plugin/vendor/github.com/gorilla/mux/regexp.go
  • integrations/traefik-plugin/vendor/github.com/gorilla/mux/route.go
  • integrations/traefik-plugin/vendor/github.com/gorilla/mux/test_helpers.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/LICENSE.txt
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/BUILD.bazel
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/compile.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/fuzz.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/parse.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/types.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/BUILD.bazel
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/annotations.pb.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/annotations.proto
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/annotations.swagger.json
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/openapiv2.pb.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/openapiv2.proto
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/openapiv2.swagger.json
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/BUILD.bazel
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/context.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/convert.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/doc.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/errors.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/fieldmask.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/handler.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_httpbodyproto.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_json.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_jsonpb.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_proto.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshaler.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshaler_registry.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/mux.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/pattern.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/proto2_convert.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/query.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/BUILD.bazel
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/doc.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/pattern.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/readerfactory.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/string_array_flag.go
  • integrations/traefik-plugin/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/trie.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/CHANGELOG.md
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/CODEOWNERS
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/LICENSE
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/Makefile
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/README.md
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/RELEASING.md
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/attribute/doc.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/attribute/encoder.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/attribute/iterator.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/attribute/key.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/attribute/kv.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/attribute/set.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/attribute/type_string.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/attribute/value.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/baggage/baggage.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/baggage/context.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/baggage/doc.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/codes/codes.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/codes/doc.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/doc.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/error_handler.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/exporters/otlp/internal/config.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/exporters/otlp/internal/envconfig/envconfig.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/exporters/otlp/internal/partialsuccess.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/exporters/otlp/internal/retry/LICENSE
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/exporters/otlp/internal/retry/retry.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/exporters/otlp/internal/wrappederror.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/LICENSE
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/README.md
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/clients.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/exporter.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/header.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/options.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/tls.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/attribute.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/resource.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/span.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/LICENSE
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/exporter.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/options.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/get_main_pkgs.sh
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/handler.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/internal/attribute/attribute.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/internal/baggage/context.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/internal/global/handler.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/internal/global/propagator.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/internal/global/state.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/internal/global/trace.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/internal/rawhelpers.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/internal_logging.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/propagation.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/propagation/baggage.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/propagation/doc.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/propagation/propagation.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/propagation/trace_context.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/LICENSE
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/instrumentation/doc.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/instrumentation/library.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/instrumentation/scope.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/internal/env/env.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/internal/internal.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/resource/auto.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/resource/config.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/resource/container.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/resource/doc.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/resource/env.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/resource/host_id.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_bsd.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_darwin.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_exec.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_linux.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_readfile.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_unsupported.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_windows.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/resource/os.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/resource/os_release_darwin.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/resource/os_release_unix.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/resource/os_unix.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/resource/os_unsupported.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/resource/os_windows.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/resource/process.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/trace/batch_span_processor.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/trace/doc.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/trace/event.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/trace/evictedqueue.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/trace/id_generator.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/trace/link.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/trace/sampler_env.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/trace/sampling.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/trace/simple_span_processor.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/trace/snapshot.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/trace/span.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/trace/span_exporter.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/trace/span_limits.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/trace/span_processor.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/trace/tracer.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/sdk/version.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/semconv/internal/http.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/doc.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/event.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/exception.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/http.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/resource.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/schema.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/trace.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/semconv/v1.4.0/doc.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/semconv/v1.4.0/exception.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/semconv/v1.4.0/http.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/semconv/v1.4.0/resource.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/semconv/v1.4.0/schema.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/semconv/v1.4.0/trace.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/trace.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/trace/LICENSE
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/trace/config.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/trace/context.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/trace/doc.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/trace/nonrecording.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/trace/noop.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/trace/trace.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/trace/tracestate.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/verify_examples.sh
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/version.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/versions.yaml
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/proto/otlp/LICENSE
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/proto/otlp/collector/trace/v1/trace_service.pb.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/proto/otlp/collector/trace/v1/trace_service.pb.gw.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/proto/otlp/collector/trace/v1/trace_service_grpc.pb.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/proto/otlp/common/v1/common.pb.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/proto/otlp/resource/v1/resource.pb.go
  • integrations/traefik-plugin/vendor/go.opentelemetry.io/proto/otlp/trace/v1/trace.pb.go
  • integrations/traefik-plugin/vendor/golang.org/x/exp/LICENSE
  • integrations/traefik-plugin/vendor/golang.org/x/exp/PATENTS
  • integrations/traefik-plugin/vendor/golang.org/x/exp/maps/maps.go
  • integrations/traefik-plugin/vendor/golang.org/x/net/LICENSE
  • integrations/traefik-plugin/vendor/golang.org/x/net/PATENTS
  • integrations/traefik-plugin/vendor/golang.org/x/net/http/httpguts/guts.go
  • integrations/traefik-plugin/vendor/golang.org/x/net/http/httpguts/httplex.go
  • integrations/traefik-plugin/vendor/golang.org/x/net/http2/Dockerfile
  • integrations/traefik-plugin/vendor/golang.org/x/net/http2/Makefile
  • integrations/traefik-plugin/vendor/golang.org/x/net/http2/ascii.go
  • integrations/traefik-plugin/vendor/golang.org/x/net/http2/ciphers.go
  • integrations/traefik-plugin/vendor/golang.org/x/net/http2/client_conn_pool.go
  • integrations/traefik-plugin/vendor/golang.org/x/net/http2/databuffer.go
  • integrations/traefik-plugin/vendor/golang.org/x/net/http2/errors.go
  • integrations/traefik-plugin/vendor/golang.org/x/net/http2/flow.go
  • integrations/traefik-plugin/vendor/golang.org/x/net/http2/frame.go
  • integrations/traefik-plugin/vendor/golang.org/x/net/http2/go111.go
  • integrations/traefik-plugin/vendor/golang.org/x/net/http2/go115.go
  • integrations/traefik-plugin/vendor/golang.org/x/net/http2/go118.go
  • integrations/traefik-plugin/vendor/golang.org/x/net/http2/gotrack.go
  • integrations/traefik-plugin/vendor/golang.org/x/net/http2/headermap.go
  • integrations/traefik-plugin/vendor/golang.org/x/net/http2/hpack/encode.go
  • integrations/traefik-plugin/vendor/golang.org/x/net/http2/hpack/hpack.go
  • integrations/traefik-plugin/vendor/golang.org/x/net/http2/hpack/huffman.go
  • integrations/traefik-plugin/vendor/golang.org/x/net/http2/hpack/static_table.go
  • integrations/traefik-plugin/vendor/golang.org/x/net/http2/hpack/tables.go

In the recent run, only the files that changed from the base of the PR and between b11e06cddd5702457ec4f7c0605033bee7b9c48f and eb5cd83fca8c6b78d26d65f798395dcca1c5f1b6 commits were reviewed.

Files not reviewed due to simple changes (3)

Skipped review in the recent run

  • integrations/traefik-plugin/utils.go
  • integrations/traefik-plugin/vendor/github.com/cenkalti/backoff/v4/.gitignore
  • integrations/traefik-plugin/vendor/github.com/go-logr/logr/.golangci.yaml

Comment on lines 44 to 49
ctx := context.Background()

apertureAgentGRPCClient, err := grpcClient(ctx, net.JoinHostPort(agentHost, agentPort))
if err != nil {
log.Fatalf("failed to create flow control client: %v", err)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 OpenAI

There is a potential issue with the use of log.Fatalf here. If there's an error creating the gRPC client, it will cause the entire process to exit. Instead, you should return an error and let the caller handle it.

Suggested change
ctx := context.Background()
apertureAgentGRPCClient, err := grpcClient(ctx, net.JoinHostPort(agentHost, agentPort))
if err != nil {
log.Fatalf("failed to create flow control client: %v", err)
}
func (a *TraefikPlugin) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
// ...
apertureAgentGRPCClient, err := grpcClient(ctx, net.JoinHostPort(agentHost, agentPort))
if err != nil {
rw.WriteHeader(http.StatusInternalServerError)
rw.Write([]byte("failed to create flow control client"))
return
}
// ...
}

Comment on lines +59 to +64

//initialize Aperture Client with the provided options.
apertureClient, err := aperture.NewClient(ctx, opts)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 OpenAI

Similar to the previous issue, using log.Fatalf here will cause the entire process to exit if there's an error creating the Aperture client. You should return an error and let the caller handle it.

Suggested change
//initialize Aperture Client with the provided options.
apertureClient, err := aperture.NewClient(ctx, opts)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
func (a *TraefikPlugin) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
// ...
apertureClient, err := aperture.NewClient(ctx, opts)
if err != nil {
rw.WriteHeader(http.StatusInternalServerError)
rw.Write([]byte("failed to create client"))
return
}
// ...
}

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

LanguageTool

integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/RELEASING.md|101 col 1| A comma may be missing after the conjunctive/linking adverb ‘Finally’. (SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA[1])
Suggestions: Finally,
URL: https://languagetool.org/insights/post/linking-words/
Rule: https://community.languagetool.org/rule/show/SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA?lang=en-US&subId=1
Category: PUNCTUATION
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/RELEASING.md|107 col 6| Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA)
Suggestions: releasing,
Rule: https://community.languagetool.org/rule/show/AI_HYDRA_LEO_MISSING_COMMA?lang=en-US
Category: MISC
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/RELEASING.md|107 col 43| This phrase is redundant. Consider using “outside”. (OUTSIDE_OF[1])
Suggestions: outside
URL: https://languagetool.org/insights/post/wordiness/
Rule: https://community.languagetool.org/rule/show/OUTSIDE_OF?lang=en-US&subId=1
Category: REDUNDANCY
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/RELEASING.md|113 col 44| A comma might be missing here. (AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)
Suggestions: directory,
Rule: https://community.languagetool.org/rule/show/AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA?lang=en-US
Category: MISC
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/RELEASING.md|120 col 5| A comma might be missing here. (AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)
Suggestions: verified,
Rule: https://community.languagetool.org/rule/show/AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA?lang=en-US
Category: MISC
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|4 col 11| Use a comma before ‘so’ if it connects two independent clauses (unless they are closely connected and short). (COMMA_COMPOUND_SENTENCE_2[1])
Suggestions: , so
URL: https://languagetool.org/insights/post/comma-before-and/
Rule: https://community.languagetool.org/rule/show/COMMA_COMPOUND_SENTENCE_2?lang=en-US&subId=1
Category: PUNCTUATION
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|17 col 45| This phrase is redundant (‘I’ stands for ‘interfaces’). Use simply “APIs”. (ACRONYM_TAUTOLOGY[8])
Suggestions: APIs
Rule: https://community.languagetool.org/rule/show/ACRONYM_TAUTOLOGY?lang=en-US&subId=8
Category: REDUNDANCY
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|24 col 26| Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’. (EN_A_VS_AN)
Suggestions: an
URL: https://languagetool.org/insights/post/indefinite-articles/
Rule: https://community.languagetool.org/rule/show/EN_A_VS_AN?lang=en-US
Category: MISC
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|25 col 27| Two consecutive commas (DOUBLE_PUNCTUATION)
Suggestions: ,
URL: https://languagetool.org/insights/post/punctuation-guide/#what-are-periods
Rule: https://community.languagetool.org/rule/show/DOUBLE_PUNCTUATION?lang=en-US
Category: PUNCTUATION
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|28 col 43| Did you just mean “,” or “.”? (COMMA_PERIOD[1])
Suggestions: ,, .
Rule: https://community.languagetool.org/rule/show/COMMA_PERIOD?lang=en-US&subId=1
Category: PUNCTUATION
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|29 col 75| Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’. (EN_A_VS_AN)
Suggestions: an
URL: https://languagetool.org/insights/post/indefinite-articles/
Rule: https://community.languagetool.org/rule/show/EN_A_VS_AN?lang=en-US
Category: MISC
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|31 col 24| Articles like ‘the’ are rarely followed by punctuation. A word may be missing after ‘the’, or the punctuation mark may not be necessary. (THE_PUNCT[1])
Suggestions: the
Rule: https://community.languagetool.org/rule/show/THE_PUNCT?lang=en-US&subId=1
Category: GRAMMAR
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|49 col 54| If this is a compound adjective that modifies the following noun, use a hyphen. (EN_COMPOUND_ADJECTIVE_INTERNAL)
Suggestions: backwards-compatible
Rule: https://community.languagetool.org/rule/show/EN_COMPOUND_ADJECTIVE_INTERNAL?lang=en-US
Category: MISC
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|100 col 54| If this is a compound adjective that modifies the following noun, use a hyphen. (EN_COMPOUND_ADJECTIVE_INTERNAL)
Suggestions: backwards-compatible
Rule: https://community.languagetool.org/rule/show/EN_COMPOUND_ADJECTIVE_INTERNAL?lang=en-US
Category: MISC
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|57 col 44| A comma might be missing here. (AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)
Suggestions: stable,
Rule: https://community.languagetool.org/rule/show/AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA?lang=en-US
Category: MISC
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|71 col 54| Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’. (EN_A_VS_AN)
Suggestions: an
URL: https://languagetool.org/insights/post/indefinite-articles/
Rule: https://community.languagetool.org/rule/show/EN_A_VS_AN?lang=en-US
Category: MISC
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|72 col 49| Two consecutive commas (DOUBLE_PUNCTUATION)
Suggestions: ,
URL: https://languagetool.org/insights/post/punctuation-guide/#what-are-periods
Rule: https://community.languagetool.org/rule/show/DOUBLE_PUNCTUATION?lang=en-US
Category: PUNCTUATION
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|77 col 47| Did you just mean “,” or “.”? (COMMA_PERIOD[1])
Suggestions: ,, .
Rule: https://community.languagetool.org/rule/show/COMMA_PERIOD?lang=en-US&subId=1
Category: PUNCTUATION
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|79 col 26| Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’. (EN_A_VS_AN)
Suggestions: an
URL: https://languagetool.org/insights/post/indefinite-articles/
Rule: https://community.languagetool.org/rule/show/EN_A_VS_AN?lang=en-US
Category: MISC
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|80 col 46| Articles like ‘the’ are rarely followed by punctuation. A word may be missing after ‘the’, or the punctuation mark may not be necessary. (THE_PUNCT[1])
Suggestions: the
Rule: https://community.languagetool.org/rule/show/THE_PUNCT?lang=en-US&subId=1
Category: GRAMMAR
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|107 col 69| A comma may be missing after the conjunctive/linking adverb ‘Instead’. (SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA[1])
Suggestions: Instead,
URL: https://languagetool.org/insights/post/linking-words/
Rule: https://community.languagetool.org/rule/show/SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA?lang=en-US&subId=1
Category: PUNCTUATION
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|109 col 8| It looks like there might be a possessive apostrophe missing. Consider inserting it. (AI_EN_LECTOR_MISSING_NOUN_POSSESSIVE)
Suggestions: modules'
URL: https://languagetool.org/insights/post/possessive-apostrophe/
Rule: https://community.languagetool.org/rule/show/AI_EN_LECTOR_MISSING_NOUN_POSSESSIVE?lang=en-US
Category: MISC
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|110 col 55| A comma might be missing here. (AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)
Suggestions: stable,
Rule: https://community.languagetool.org/rule/show/AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA?lang=en-US
Category: MISC
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|118 col 16| A comma might be missing here. (AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)
Suggestions: modules,
Rule: https://community.languagetool.org/rule/show/AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA?lang=en-US
Category: MISC
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|120 col 66| It seems likely that a singular genitive (’s) apostrophe is missing. (AI_HYDRA_LEO_APOSTROPHE_S_XS)
Suggestions: project's
Rule: https://community.languagetool.org/rule/show/AI_HYDRA_LEO_APOSTROPHE_S_XS?lang=en-US
Category: MISC
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|121 col 6| Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA)
Suggestions: release,
Rule: https://community.languagetool.org/rule/show/AI_HYDRA_LEO_MISSING_COMMA?lang=en-US
Category: MISC
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|126 col 13| Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA)
Suggestions: release,
Rule: https://community.languagetool.org/rule/show/AI_HYDRA_LEO_MISSING_COMMA?lang=en-US
Category: MISC
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|132 col 53| A comma might be missing here. (AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)
Suggestions: policy,
Rule: https://community.languagetool.org/rule/show/AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA?lang=en-US
Category: MISC
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|143 col 51| Articles like ‘the’ are rarely followed by punctuation. A word may be missing after ‘the’, or the punctuation mark may not be necessary. (THE_PUNCT[1])
Suggestions: the
Rule: https://community.languagetool.org/rule/show/THE_PUNCT?lang=en-US&subId=1
Category: GRAMMAR
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|143 col 68| Two consecutive commas (DOUBLE_PUNCTUATION)
Suggestions: ,
URL: https://languagetool.org/insights/post/punctuation-guide/#what-are-periods
Rule: https://community.languagetool.org/rule/show/DOUBLE_PUNCTUATION?lang=en-US
Category: PUNCTUATION
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|145 col 43| It appears that a noun is missing after “The”. (THE_CC[1])
Rule: https://community.languagetool.org/rule/show/THE_CC?lang=en-US&subId=1
Category: GRAMMAR
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|146 col 41| Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA)
Suggestions: development,
Rule: https://community.languagetool.org/rule/show/AI_HYDRA_LEO_MISSING_COMMA?lang=en-US
Category: MISC
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|149 col 62| Use a comma before ‘so’ if it connects two independent clauses (unless they are closely connected and short). (COMMA_COMPOUND_SENTENCE[1])
Suggestions: , so
URL: https://languagetool.org/insights/post/grammar-what-are-compound-sentences/
Rule: https://community.languagetool.org/rule/show/COMMA_COMPOUND_SENTENCE?lang=en-US&subId=1
Category: PUNCTUATION
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|150 col 48| A comma might be missing here. (AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)
Suggestions: done,
Rule: https://community.languagetool.org/rule/show/AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA?lang=en-US
Category: MISC
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|157 col 1| It appears that a noun is missing after “The”. (THE_CC[1])
Rule: https://community.languagetool.org/rule/show/THE_CC?lang=en-US&subId=1
Category: GRAMMAR
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|169 col 39| You have used the passive voice repeatedly in nearby sentences. To make your writing clearer and easier to read, consider using active voice. (REP_PASSIVE_VOICE[6])
URL: https://languagetool.org/insights/post/what-is-passive-voice/
Rule: https://community.languagetool.org/rule/show/REP_PASSIVE_VOICE?lang=en-US&subId=6
Category: REPETITIONS_STYLE
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|172 col 36| You have used the passive voice repeatedly in nearby sentences. To make your writing clearer and easier to read, consider using active voice. (REP_PASSIVE_VOICE[7])
URL: https://languagetool.org/insights/post/what-is-passive-voice/
Rule: https://community.languagetool.org/rule/show/REP_PASSIVE_VOICE?lang=en-US&subId=7
Category: REPETITIONS_STYLE
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|173 col 12| Possible missing article found. (AI_HYDRA_LEO_MISSING_A)
Suggestions: a version
Rule: https://community.languagetool.org/rule/show/AI_HYDRA_LEO_MISSING_A?lang=en-US
Category: MISC
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|187 col 66| Use a comma before “and” if it connects two independent clauses (unless they are closely connected and short). (COMMA_COMPOUND_SENTENCE_2[4])
Suggestions: , and
Rule: https://community.languagetool.org/rule/show/COMMA_COMPOUND_SENTENCE_2?lang=en-US&subId=4
Category: PUNCTUATION
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|204 col 16| It appears that a noun is missing after “the”. (THE_CC[1])
Rule: https://community.languagetool.org/rule/show/THE_CC?lang=en-US&subId=1
Category: GRAMMAR
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|216 col 21| The grammatical number of this noun doesn’t look right. Consider replacing it. (AI_EN_LECTOR_REPLACEMENT_NOUN_NUMBER)
Suggestions: versions
Rule: https://community.languagetool.org/rule/show/AI_EN_LECTOR_REPLACEMENT_NOUN_NUMBER?lang=en-US
Category: MISC
integrations/traefik-plugin/vendor/go.opentelemetry.io/otel/VERSIONING.md|217 col 25| Possible missing article found. (AI_HYDRA_LEO_MISSING_A)
Suggestions: a new
Rule: https://community.languagetool.org/rule/show/AI_HYDRA_LEO_MISSING_A?lang=en-US
Category: MISC

This is a Go port of the exponential backoff algorithm from [Google's HTTP Client Library for Java][google-http-java-client].

[Exponential backoff][exponential backoff wiki]
is an algorithm that uses feedback to multiplicatively decrease the rate of some process,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[LanguageTool] reported by reviewdog 🐶
Consider a shorter alternative to avoid wordiness. (IN_ORDER_TO_PREMIUM[1])
Suggestions: to
URL: https://languagetool.org/insights/post/synonyms-of-in-order-to/
Rule: https://community.languagetool.org/rule/show/IN_ORDER_TO_PREMIUM?lang=en-US&subId=1
Category: REDUNDANCY

# 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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[LanguageTool] reported by reviewdog 🐶
As an alternative to the over-used intensifier ‘very’, consider replacing this phrase. (EN_WEAK_ADJECTIVE)
Suggestions: Minimal, Tiny, Petite, Small
URL: https://languagetool.org/insights/post/style-another-word-for-very/
Rule: https://community.languagetool.org/rule/show/EN_WEAK_ADJECTIVE?lang=en-US
Category: STYLE

# 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)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[LanguageTool] reported by reviewdog 🐶
This sentence does not start with an uppercase letter. (UPPERCASE_SENTENCE_START)
Suggestions: Logr
URL: https://languagetool.org/insights/post/spelling-capital-letters/
Rule: https://community.languagetool.org/rule/show/UPPERCASE_SENTENCE_START?lang=en-US
Category: CASING


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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[LanguageTool] reported by reviewdog 🐶
Consider inserting a comma here: “In fact,” (IN_FACT_COMMA[1])
Suggestions: In fact,
URL: https://dictionary.cambridge.org/grammar/british-grammar/in-fact
Rule: https://community.languagetool.org/rule/show/IN_FACT_COMMA?lang=en-US&subId=1
Category: PUNCTUATION

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[LanguageTool] reported by reviewdog 🐶
‘In the meantime’ might be wordy. Consider a shorter alternative. (EN_WORDINESS_PREMIUM)
Suggestions: Meanwhile, Simultaneously
URL: https://languagetool.org/insights/post/wordiness/
Rule: https://community.languagetool.org/rule/show/EN_WORDINESS_PREMIUM?lang=en-US
Category: STYLE

Ensure things look correct before submitting a pull request to include the addition.

**Note**, the generation code was changed to generate versions >= 1.13.
To generate versions prior to this, checkout the old release of this repository (i.e. [2fe8861](https://github.com/open-telemetry/opentelemetry-go/commit/2fe8861a24e20088c065b116089862caf9e3cd8b)).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[LanguageTool] reported by reviewdog 🐶
‘prior to’ might be wordy. Consider a shorter alternative. (EN_WORDINESS_PREMIUM)
Suggestions: before
URL: https://languagetool.org/insights/post/wordiness/
Rule: https://community.languagetool.org/rule/show/EN_WORDINESS_PREMIUM?lang=en-US
Category: STYLE

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[LanguageTool] reported by reviewdog 🐶
If a new sentence starts here, add a space and start with an uppercase letter. (LC_AFTER_PERIOD[1])
Suggestions: Mod, mod
Rule: https://community.languagetool.org/rule/show/LC_AFTER_PERIOD?lang=en-US&subId=1
Category: CASING

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[LanguageTool] reported by reviewdog 🐶
Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA)
Suggestions: release,
Rule: https://community.languagetool.org/rule/show/AI_HYDRA_LEO_MISSING_COMMA?lang=en-US
Category: MISC


## Tag

Once the Pull Request with all the version changes has been approved and merged it is time to tag the merged commit.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[LanguageTool] reported by reviewdog 🐶
A comma might be missing here. (AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)
Suggestions: merged,
Rule: https://community.languagetool.org/rule/show/AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA?lang=en-US
Category: MISC

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[LanguageTool] reported by reviewdog 🐶
This word is normally spelled as one. (EN_COMPOUNDS)
Suggestions: submodules
URL: https://languagetool.org/insights/post/hyphen/
Rule: https://community.languagetool.org/rule/show/EN_COMPOUNDS?lang=en-US
Category: MISC

Comment on lines +44 to +67

func (a TraefikPlugin) ServeHTTP(rw http.ResponseWriter, r *http.Request) {

ctx := context.Background()

apertureAgentGRPCClient, err := grpcClient(ctx, net.JoinHostPort(a.AgentHost, a.AgentPort))
if err != nil {
log.Fatalf("failed to create flow control client: %v", err)
}

// Initialize the logger
logger := stdr.New(log.Default()).WithName("aperture-traefik-plugin")

opts := aperture.Options{
ApertureAgentGRPCClientConn: apertureAgentGRPCClient,
CheckTimeout: 200 * time.Millisecond,
Logger: &logger,
}

//initialize Aperture Client with the provided options.
apertureClient, err := aperture.NewClient(ctx, opts)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 OpenAI

In the ServeHTTP method, you are creating a new gRPC client and initializing an Aperture client for every incoming request. This can be inefficient and lead to performance issues. Instead, consider initializing these clients in the New function and storing them as fields in the TraefikPlugin struct.

Suggested change
func (a TraefikPlugin) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
ctx := context.Background()
apertureAgentGRPCClient, err := grpcClient(ctx, net.JoinHostPort(a.AgentHost, a.AgentPort))
if err != nil {
log.Fatalf("failed to create flow control client: %v", err)
}
// Initialize the logger
logger := stdr.New(log.Default()).WithName("aperture-traefik-plugin")
opts := aperture.Options{
ApertureAgentGRPCClientConn: apertureAgentGRPCClient,
CheckTimeout: 200 * time.Millisecond,
Logger: &logger,
}
//initialize Aperture Client with the provided options.
apertureClient, err := aperture.NewClient(ctx, opts)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
type TraefikPlugin struct {
next http.Handler
ControlPoint string
AgentHost string
AgentPort string
apertureClient *aperture.Client
}
func New(ctx context.Context, next http.Handler, config *Config, name string) (http.Handler, error) {
apertureAgentGRPCClient, err := grpcClient(ctx, net.JoinHostPort(config.AgentHost, config.AgentPort))
if err != nil {
return nil, fmt.Errorf("failed to create flow control client: %v", err)
}
logger := stdr.New(log.Default()).WithName("aperture-traefik-plugin")
opts := aperture.Options{
ApertureAgentGRPCClientConn: apertureAgentGRPCClient,
CheckTimeout: 200 * time.Millisecond,
Logger: &logger,
}
apertureClient, err := aperture.NewClient(ctx, opts)
if err != nil {
return nil, fmt.Errorf("failed to create client: %v", err)
}
return &TraefikPlugin{
next: next,
ControlPoint: config.ControlPoint,
AgentHost: config.AgentHost,
AgentPort: config.AgentPort,
apertureClient: apertureClient,
}, nil
}

Comment on lines +68 to +150

labels := aperture.LabelsFromCtx(r.Context())

for key, value := range r.Header {
if strings.HasPrefix(key, ":") {
continue
}
labels[key] = strings.Join(value, ",")
}

protocol := flowcontrolhttp.SocketAddress_TCP

sourceHost, sourcePort := aperturemiddlewares.SplitAddress(apertureClient.GetLogger(), r.RemoteAddr)

destinationPort := uint32(0)
destinationHost := aperturemiddlewares.GetLocalIP(apertureClient.GetLogger())

bodyBytes, err := aperturemiddlewares.ReadClonedBody(r)
if err != nil {
apertureClient.GetLogger().V(2).Info("Error reading body", "error", err)
}

req := &flowcontrolhttp.CheckHTTPRequest{
Source: &flowcontrolhttp.SocketAddress{
Protocol: protocol,
Address: sourceHost,
Port: sourcePort,
},
Destination: &flowcontrolhttp.SocketAddress{
Protocol: protocol,
Address: destinationHost,
Port: destinationPort,
},
ControlPoint: a.ControlPoint,
Request: &flowcontrolhttp.CheckHTTPRequest_HttpRequest{
Method: r.Method,
Path: r.URL.Path,
Host: r.Host,
Headers: labels,
Scheme: r.URL.Scheme,
Size: r.ContentLength,
Protocol: r.Proto,
Body: string(bodyBytes),
},
}

flow, err := apertureClient.StartHTTPFlow(r.Context(), req)
if err != nil {
apertureClient.GetLogger().Info("Aperture flow control got error. Returned flow defaults to Allowed.", "flow.Accepted()", flow.Accepted())
}

if flow.Accepted() {
a.next.ServeHTTP(rw, r)
// Need to call End() on the Flow in order to provide telemetry to Aperture Agent for completing the control loop.
// The first argument captures whether the feature captured by the Flow was successful or resulted in an error.
// The second argument is error message for further diagnosis.
err := flow.End(aperture.OK)
if err != nil {
apertureClient.GetLogger().Info("Aperture flow control end got error.", "error", err)
}
} else {
resp := flow.CheckResponse().GetDeniedResponse()

if resp == nil {
rw.WriteHeader(http.StatusServiceUnavailable)
} else {
rw.WriteHeader(int(resp.GetStatus()))
for key, value := range resp.GetHeaders() {
rw.Header().Set(key, value)
}

_, err := fmt.Fprint(rw, resp.GetBody())
if err != nil {
apertureClient.GetLogger().Info("Aperture flow control respond body got an error.", "error", err)
}
}

err = flow.End(aperture.OK)
if err != nil {
apertureClient.GetLogger().Info("Aperture flow control end got error.", "error", err)
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 OpenAI

Now that the Aperture client is initialized in the New function, you can remove the initialization code from the ServeHTTP method and use the apertureClient field directly.

Suggested change
labels := aperture.LabelsFromCtx(r.Context())
for key, value := range r.Header {
if strings.HasPrefix(key, ":") {
continue
}
labels[key] = strings.Join(value, ",")
}
protocol := flowcontrolhttp.SocketAddress_TCP
sourceHost, sourcePort := aperturemiddlewares.SplitAddress(apertureClient.GetLogger(), r.RemoteAddr)
destinationPort := uint32(0)
destinationHost := aperturemiddlewares.GetLocalIP(apertureClient.GetLogger())
bodyBytes, err := aperturemiddlewares.ReadClonedBody(r)
if err != nil {
apertureClient.GetLogger().V(2).Info("Error reading body", "error", err)
}
req := &flowcontrolhttp.CheckHTTPRequest{
Source: &flowcontrolhttp.SocketAddress{
Protocol: protocol,
Address: sourceHost,
Port: sourcePort,
},
Destination: &flowcontrolhttp.SocketAddress{
Protocol: protocol,
Address: destinationHost,
Port: destinationPort,
},
ControlPoint: a.ControlPoint,
Request: &flowcontrolhttp.CheckHTTPRequest_HttpRequest{
Method: r.Method,
Path: r.URL.Path,
Host: r.Host,
Headers: labels,
Scheme: r.URL.Scheme,
Size: r.ContentLength,
Protocol: r.Proto,
Body: string(bodyBytes),
},
}
flow, err := apertureClient.StartHTTPFlow(r.Context(), req)
if err != nil {
apertureClient.GetLogger().Info("Aperture flow control got error. Returned flow defaults to Allowed.", "flow.Accepted()", flow.Accepted())
}
if flow.Accepted() {
a.next.ServeHTTP(rw, r)
// Need to call End() on the Flow in order to provide telemetry to Aperture Agent for completing the control loop.
// The first argument captures whether the feature captured by the Flow was successful or resulted in an error.
// The second argument is error message for further diagnosis.
err := flow.End(aperture.OK)
if err != nil {
apertureClient.GetLogger().Info("Aperture flow control end got error.", "error", err)
}
} else {
resp := flow.CheckResponse().GetDeniedResponse()
if resp == nil {
rw.WriteHeader(http.StatusServiceUnavailable)
} else {
rw.WriteHeader(int(resp.GetStatus()))
for key, value := range resp.GetHeaders() {
rw.Header().Set(key, value)
}
_, err := fmt.Fprint(rw, resp.GetBody())
if err != nil {
apertureClient.GetLogger().Info("Aperture flow control respond body got an error.", "error", err)
}
}
err = flow.End(aperture.OK)
if err != nil {
apertureClient.GetLogger().Info("Aperture flow control end got error.", "error", err)
}
}
}
func (a TraefikPlugin) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
ctx := context.Background()
labels := aperture.LabelsFromCtx(r.Context())
for key, value := range r.Header {
if strings.HasPrefix(key, ":") {
continue
}
labels[key] = strings.Join(value, ",")
}
protocol := flowcontrolhttp.SocketAddress_TCP
sourceHost, sourcePort := aperturemiddlewares.SplitAddress(a.apertureClient.GetLogger(), r.RemoteAddr)
destinationPort := uint32(0)
destinationHost := aperturemiddlewares.GetLocalIP(a.apertureClient.GetLogger())
bodyBytes, err := aperturemiddlewares.ReadClonedBody(r)
if err != nil {
a.apertureClient.GetLogger().V(2).Info("Error reading body", "error", err)
}
req := &flowcontrolhttp.CheckHTTPRequest{
Source: &flowcontrolhttp.SocketAddress{
Protocol: protocol,
Address: sourceHost,
Port: sourcePort,
},
Destination: &flowcontrolhttp.SocketAddress{
Protocol: protocol,
Address: destinationHost,
Port: destinationPort,
},
ControlPoint: a.ControlPoint,
Request: &flowcontrolhttp.CheckHTTPRequest_HttpRequest{
Method: r.Method,
Path: r.URL.Path,
Host: r.Host,
Headers: labels,
Scheme: r.URL.Scheme,
Size: r.ContentLength,
Protocol: r.Proto,
Body: string(bodyBytes),
},
}
flow, err := a.apertureClient.StartHTTPFlow(r.Context(), req)
if err != nil {
a.apertureClient.GetLogger().Info("Aperture flow control got error. Returned flow defaults to Allowed.", "flow.Accepted()", flow.Accepted())
}
if flow.Accepted() {
a.next.ServeHTTP(rw, r)
err := flow.End(aperture.OK)
if err != nil {
a.apertureClient.GetLogger().Info("Aperture flow control end got error.", "error", err)
}
} else {
resp := flow.CheckResponse().GetDeniedResponse()
if resp == nil {
rw.WriteHeader(http.StatusServiceUnavailable)
} else {
rw.WriteHeader(int(resp.GetStatus()))
for key, value := range resp.GetHeaders() {
rw.Header().Set(key, value)
}
_, err := fmt.Fprint(rw, resp.GetBody())
if err != nil {
a.apertureClient.GetLogger().Info("Aperture flow control respond body got an error.", "error", err)
}
}
err = flow.End(aperture.OK)
if err != nil {
a.apertureClient.GetLogger().Info("Aperture flow control end got error.", "error", err)
}
}
}

@kwapik
Copy link
Contributor

kwapik commented May 19, 2023

This PR - #1971 may be useful for you.

@harjotgill harjotgill closed this Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add integration for Traefik API proxy
3 participants