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

Add limitador tracing-endpoint command #130

Merged
merged 2 commits into from
Apr 16, 2024
Merged

Conversation

adam-cattermole
Copy link
Member

Changes

A new --tracing-endpoint command was added to limitador in Kuadrant/limitador#261. I have used a struct to match the spec in Authorino (eventually to contain an Insecure boolean once limitador supports TLS tracing endpoint).

docker run --rm -t quay.io/kuadrant/limitador:latest limitador-server --help

Rate Limiting Server

Usage: limitador-server [OPTIONS] <LIMITS_FILE> [STORAGE]

STORAGES:
  memory        Counters are held in Limitador (ephemeral)
  disk          Counters are held on disk (persistent)
  redis         Uses Redis to store counters
  redis_cached  Uses Redis to store counters, with an in-memory cache

Arguments:
  <LIMITS_FILE>  The limit file to use

Options:
  -b, --rls-ip <ip>
          The IP to listen on for RLS [default: 0.0.0.0]
  -p, --rls-port <port>
          The port to listen on for RLS [default: 8081]
  -B, --http-ip <http_ip>
          The IP to listen on for HTTP [default: 0.0.0.0]
  -P, --http-port <http_port>
          The port to listen on for HTTP [default: 8080]
  -l, --limit-name-in-labels
          Include the Limit Name in prometheus label
      --tracing-endpoint <tracing_endpoint>
          The host for the tracing service [default: ]
  -v...
          Sets the level of verbosity
      --validate
          Validates the LIMITS_FILE and exits
  -H, --rate-limit-headers <rate_limit_headers>
          Enables rate limit response headers [default: NONE] [possible values: NONE, DRAFT_VERSION_03]
      --grpc-reflection-service
          Enables gRPC server reflection service
  -h, --help
          Print help
  -V, --version
          Print version

Verification Steps

Deploy cluster:

make local-setup

Create limitador CR with .spec.tracing.endpoint set:

kubectl apply -f - <<EOF
---
apiVersion: limitador.kuadrant.io/v1alpha1
kind: Limitador
metadata:
  name: limitador
spec:
  listener:
    http:
      port: 8080
    grpc:
      port: 8081
  tracing:
    endpoint: rpc://tracing-endpoint:4317
  limits:
    - conditions: ["get_toy == 'yes'"]
      max_value: 2
      namespace: toystore-app
      seconds: 30
      variables: []
EOF

Wait for deployment:

kubectl wait --timeout=300s --for=condition=Ready limitador limitador

Check limitador deployment command:

kubectl get deployment/limitador-limitador  -o yaml | yq '.spec.template.spec.containers[0].command'
- limitador-server
- --tracing-endpoint
- rpc://tracing-endpoint:4317
- --http-port
- "8080"
- --rls-port
- "8081"
- /home/limitador/etc/limitador-config.yaml
- memory

@adam-cattermole adam-cattermole self-assigned this Apr 9, 2024
@codecov-commenter
Copy link

codecov-commenter commented Apr 9, 2024

Codecov Report

Merging #130 (e7ae162) into main (c4802c5) will decrease coverage by 1.09%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #130      +/-   ##
==========================================
- Coverage   86.03%   84.94%   -1.09%     
==========================================
  Files          19       19              
  Lines         988      990       +2     
==========================================
- Hits          850      841       -9     
- Misses         91       97       +6     
- Partials       47       52       +5     
Flag Coverage Δ
integration 78.88% <0.00%> (-1.89%) ⬇️
unit 66.81% <100.00%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
api/v1alpha1 (u) 100.00% <ø> (ø)
pkg/helpers (u) 83.87% <ø> (ø)
pkg/log (u) 94.73% <ø> (ø)
pkg/reconcilers (u) 74.67% <ø> (ø)
pkg/limitador (u) 98.74% <100.00%> (+<0.01%) ⬆️
controllers (i) 74.32% <ø> (-3.72%) ⬇️
pkg/upgrades 88.88% <ø> (ø)
Files Coverage Δ
api/v1alpha1/limitador_types.go 100.00% <ø> (ø)
pkg/limitador/deployment_options.go 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

@adam-cattermole
Copy link
Member Author

cc @david-martin

Copy link
Contributor

@eguzki eguzki left a comment

Choose a reason for hiding this comment

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

Just one comment/question, but LGTM as it is now

@@ -324,6 +327,10 @@ type Ports struct {
GRPC int32 `json:"grpc,omitempty"`
}

type Tracing struct {
Endpoint *string `json:"endpoint,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Should endpoint be optional or required?

spec.tracing is optional, but spec.tracing.endpoint?

Copy link
Member Author

@adam-cattermole adam-cattermole Apr 12, 2024

Choose a reason for hiding this comment

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

Yeah that's a good point actually, if the tracing struct is provided the endpoint should be required I guess

@eguzki
Copy link
Contributor

eguzki commented Apr 12, 2024

Should we add come documentation regarding tracing?? Any requirement on the tracing backend side?? Opentelemetry compatible service?

@adam-cattermole
Copy link
Member Author

Yep I think I should definitely add some docs about configuring here, I'll add a follow up commit with that change

@adam-cattermole adam-cattermole force-pushed the tracing-endpoint branch 2 times, most recently from cbdf3d8 to 0e48f7b Compare April 15, 2024 10:42
@adam-cattermole
Copy link
Member Author

@eguzki - I'm going to merge this if you're happy with the latest changes

@adam-cattermole adam-cattermole merged commit 6026be8 into main Apr 16, 2024
11 checks passed
@adam-cattermole adam-cattermole deleted the tracing-endpoint branch April 16, 2024 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request size/small
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants