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

Basic Streaming and In-Memory Guard Support #45

Merged
merged 50 commits into from
Jun 13, 2024

Conversation

CalebCourier
Copy link
Contributor

  • + Adds basic streaming support for guards
  • + Adds an In-Memory store for guards
  • + Adds config support for In-Memory guards
  • + Makes OTEL optional
  • + Makes Postgres optional
  • - Breaks /validation endpoints's custom telemetry (because of streaming)

CalebCourier and others added 30 commits April 15, 2024 16:16
* make guard_client interface, add memory client

* modify tests to use pgguard

* selectively spin up postgres if pg_host is set

* dont support write operations

* use non serialized guards for memory guard client

* add union types

* handle difference between guardstruct and guard in API routes

* restore previous pg functionality

* fix delete route

* return 501s for mutations for in memory guard, fix health check, add second guard to config file

* Make Telemetry Optional (#41)

* start making otel optional

* test on/off, tracer initialization

* setup metrics, refactor

* update lock

* cleanup prints

* turn off console traces

* remove auto-instr from docker files

* compress otel init

* add restrict to topic to custom install

* setup custom function demo with restrict to topic

---------

Co-authored-by: Caleb Courier <[email protected]>
Co-authored-by: Caleb Courier <[email protected]>
@CalebCourier CalebCourier changed the title Feat/streaming and in mem Basic Streaming and In-Memory Guard Support Jun 7, 2024
@CalebCourier CalebCourier requested review from nichwch and zsimjee June 7, 2024 14:18
@CalebCourier
Copy link
Contributor Author

Renaming the branch closed the old PR: #30

@CalebCourier CalebCourier mentioned this pull request Jun 7, 2024
1 task
@AlejandroEsquivel
Copy link
Contributor

When running docker compose --profile all up --build I seem to get:

guardrails-api-1       |   File "/opt/venv/lib/python3.11/site-packages/gunicorn/util.py", line 424, in import_app
guardrails-api-1       |     app = app(*args, **kwargs)
guardrails-api-1       |           ^^^^^^^^^^^^^^^^^^^^
guardrails-api-1       |   File "/app/app.py", line 43, in create_app
guardrails-api-1       |     initialize()
guardrails-api-1       |   File "/app/src/otel/__init__.py", line 25, in initialize
guardrails-api-1       |     initialize_tracer()
guardrails-api-1       |   File "/app/src/otel/traces.py", line 69, in initialize_tracer
guardrails-api-1       |     set_span_processors(tracer_provider, exporter, use_batch)
guardrails-api-1       |   File "/app/src/otel/traces.py", line 53, in set_span_processors
guardrails-api-1       |     tracer_provider.add_span_processor(span_processor)
guardrails-api-1       |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
guardrails-api-1       | AttributeError: 'ProxyTracerProvider' object has no attribute 'add_span_processor'

@CalebCourier
Copy link
Contributor Author

When running docker compose --profile all up --build I seem to get:

guardrails-api-1       |   File "/opt/venv/lib/python3.11/site-packages/gunicorn/util.py", line 424, in import_app
guardrails-api-1       |     app = app(*args, **kwargs)
guardrails-api-1       |           ^^^^^^^^^^^^^^^^^^^^
guardrails-api-1       |   File "/app/app.py", line 43, in create_app
guardrails-api-1       |     initialize()
guardrails-api-1       |   File "/app/src/otel/__init__.py", line 25, in initialize
guardrails-api-1       |     initialize_tracer()
guardrails-api-1       |   File "/app/src/otel/traces.py", line 69, in initialize_tracer
guardrails-api-1       |     set_span_processors(tracer_provider, exporter, use_batch)
guardrails-api-1       |   File "/app/src/otel/traces.py", line 53, in set_span_processors
guardrails-api-1       |     tracer_provider.add_span_processor(span_processor)
guardrails-api-1       |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
guardrails-api-1       | AttributeError: 'ProxyTracerProvider' object has no attribute 'add_span_processor'

Fixed in ea1dbec

@CalebCourier CalebCourier merged commit 51e5530 into main Jun 13, 2024
1 check failed
@CalebCourier CalebCourier deleted the feat/streaming-and-in-mem branch June 13, 2024 16:50
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.

4 participants