diff --git a/presidio/server/server.py b/presidio/server/server.py index 847ae7c9..c4eb610d 100644 --- a/presidio/server/server.py +++ b/presidio/server/server.py @@ -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 @@ -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() diff --git a/privacy-profile-composer/pkg/envoyfilter/internal/common/pii_analysis.go b/privacy-profile-composer/pkg/envoyfilter/internal/common/pii_analysis.go index db0d3623..25885495 100644 --- a/privacy-profile-composer/pkg/envoyfilter/internal/common/pii_analysis.go +++ b/privacy-profile-composer/pkg/envoyfilter/internal/common/pii_analysis.go @@ -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)