Skip to content

Commit

Permalink
wip: debugging prose filter and presidio
Browse files Browse the repository at this point in the history
  • Loading branch information
qlonik committed Apr 29, 2024
1 parent 86e5a89 commit 086bbf0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions presidio/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from typing import Tuple

from flask import Flask, Response, jsonify, request
from opentelemetry import trace
from presidio_analyzer.analyzer_engine import AnalyzerEngine
from presidio_analyzer.analyzer_request import AnalyzerRequest
from presidio_analyzer.batch_analyzer_engine import BatchAnalyzerEngine
Expand Down Expand Up @@ -142,6 +143,14 @@ def http_exception(e):
@self.app.route("/batchanalyze", methods=["POST"])
def batch_analyze() -> Tuple[Response, int]:
"""Execute the batch analyzer function."""

print("Headers received as part of batchanalyze:")
for k, v in request.headers.items():
print(f"{k}: {v}")

current_span = trace.get_current_span()
print("current_span:", current_span)

# Parse the request params
try:
request_obj = request.get_json()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ func PiiAnalysis(ctx context.Context, presidioSvcURL string, svcName string, buf
req.Header.Set("Content-Type", "application/json")
GlobalOtelPropagator.Inject(ctx, propagation.HeaderCarrier(req.Header))

fmt.Println("injected headers before sending to presidio:")
for k, v := range req.Header {
fmt.Printf(" %s:\n", k)
for _, vv := range v {
fmt.Printf(" %s\n", vv)
}
}

resp, err := http.DefaultClient.Do(req)
if err != nil {
return empty, fmt.Errorf("presidio post error: %w", err)
Expand Down

0 comments on commit 086bbf0

Please sign in to comment.