feat(tracing): port trace events sessions to OSS (#7464)
Some checks failed
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Check Documentation Broken Links / Check broken links (push) Has been cancelled
Vulnerability Scan / Detect changes (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
Build uv cache / build-cache (3.10) (push) Has been cancelled
Build uv cache / build-cache (3.11) (push) Has been cancelled
Build uv cache / build-cache (3.12) (push) Has been cancelled
Build uv cache / build-cache (3.13) (push) Has been cancelled
Nightly Canary Release / Check for new commits (push) Has been cancelled
Nightly Canary Release / Build nightly packages (push) Has been cancelled
Nightly Canary Release / Publish nightly to PyPI (push) Has been cancelled

* feat(tracing): port enterprise event sessions to OSS

* fix(tracing): address review findings and verify concurrent exports

* fix(tracing): keep redactor ownership in enterprise integrations

* test(tracing): isolate intentional failures from cleanup assertions
This commit is contained in:
Lorenze Jay
2026-09-15 13:09:40 -07:00
committed by GitHub
parent 756d8d33c8
commit 993a96c4e0
36 changed files with 9411 additions and 1046 deletions

View File

@@ -150,8 +150,8 @@ result = flow.kickoff()
### الخطوة 5: عرض التتبعات في لوحة تحكم CrewAI AMP
بعد تشغيل الطاقم أو التدفق، يمكنك عرض التتبعات التي أنشأها تطبيق CrewAI في لوحة تحكم CrewAI AMP. يجب أن ترى خطوات تفصيلية لتفاعلات الوكلاء واستخدامات الأدوات واستدعاءات LLM.
ما عليك سوى النقر على الرابط أدناه لعرض التتبعات أو التوجه إلى علامة تبويب التتبعات في لوحة التحكم [هنا](https://app.crewai.com/crewai_plus/trace_batches)
لا تُرفع التتبعات إلا بعد نجاح التصدير باستخدام المصادقة أو الرفع المجهول الذي وافقت عليه صراحةً. لا يوجد تتبع مرفوع لأي تشغيل حُذف مخزنه المؤقت المحلي.
للتتبعات المرتبطة بحسابك، افتح [علامة تبويب التتبعات في لوحة تحكم CrewAI AMP](https://app.crewai.com/crewai_plus/trace_batches) لعرض تفاعلات الوكلاء واستخدام الأدوات واستدعاءات LLM.
![واجهة تتبع CrewAI](/images/view-traces.png)
### البديل: إعداد متغير البيئة
@@ -175,13 +175,44 @@ CREWAI_TRACING_ENABLED=true
في المرة الأولى التي تشغّل فيها طاقماً أو تدفقاً، قد يسألك طرف تفاعلي:
```text
Would you like to view your execution traces? [y/N]
Share this execution trace with CrewAI? [y/N]
```
اختر **yes** لفتح رابط العرض. يمكنك تغيير ذلك لاحقاً باستخدام
اختر **yes** لرفع التتبع المخزّن مؤقتاً إلى CrewAI. قد تحتوي التتبعات على
المطالبات والمدخلات والمخرجات. يُحذف المخزن المؤقت عند الرفض أو انتهاء المهلة
أو التشغيل دون مطالبة تفاعلية بالموافقة. يمكنك تغيير إعداد التتبع لاحقاً باستخدام
`crewai traces enable` أو `crewai traces disable`، أو بتعيين `tracing`
على الطاقم أو التدفق.
### التخزين المؤقت المحلي والتصدير بعد المصادقة
يبقى جمع التتبعات في أول تشغيل داخل ذاكرة العملية إلى أن توافق على المشاركة،
حتى إذا كانت لديك بيانات تسجيل دخول محفوظة. يستخدم التتبع دون مصادقة مسار
الموافقة نفسه. قبل الموافقة، لا يطلب CrewAI تصريح رفع ولا يرسل أي مقاطع تنفيذ.
يحتفظ المخزن المؤقت بحد أقصى **1,000 مقطع** و**8 MiB من بيانات OTLP المرمّزة**.
اضبط `CREWAI_EPHEMERAL_TRACE_MAX_SPANS` و
`CREWAI_EPHEMERAL_TRACE_MAX_BYTES` على أعداد صحيحة موجبة لتعديل هذين الحدّين.
عند تجاوز السعة، تُحذف أقدم المقاطع؛ ويُحذف أي مقطع يتجاوز وحده حد البايتات.
يُفرّغ المخزن المؤقت بعد مشاركته أو تجاهله.
عند تفعيل التتبع وتوفّر بيانات الاعتماد، يستبدل CrewAI بيانات تسجيل دخول CLI
أو `CREWAI_USER_PAT` أو بيانات اعتماد تكامل المنصة لدى AMP بتصريح خاص
بالتنفيذ. ثم يصدّر مقاطع OpenTelemetry مباشرةً إلى Wharf باستخدام ذلك التصريح.
لا تؤدي بيانات الاعتماد غير الصالحة إلى الرجوع إلى الرفع المجهول.
### جلسات التنفيذ المستضافة
يمكن للبيئات المضيفة إحاطة التنفيذ بـ `telemetry_session` من
`crewai.telemetry.tracing`. تستخدم الجلسة أحداث دورة حياة CrewAI لإنشاء
المقاطع وإنهائها، مع الحفاظ على طوابعها الزمنية وعلاقاتها بالمقاطع الأصل وروابط
الإيقاف والاستئناف في HITL. مرّر موفّراً موجوداً عبر `providers=` للاحتفاظ
بمتتبّع البيئة المضيفة وتكامل التسجيل لديها. مرّر معالجات المقاطع عبر
`processors=` ودالة تسجيل للمضيف عبر `log_emitter=`. يتولى المضيف أي تنقيح
للبيانات في هذه التكاملات.
تدير كل جلسة دورة حياة التتبع الخاصة بها وتترك موفّر OpenTelemetry العام
للتطبيق دون تغيير.
## عرض التتبعات
### الوصول إلى لوحة تحكم CrewAI AMP
@@ -222,5 +253,5 @@ Would you like to view your execution traces? [y/N]
1. تأكد من تعيين `tracing=True` في الطاقم/التدفق
2. تحقق من `CREWAI_TRACING_ENABLED=true` إذا كنت تستخدم متغيرات البيئة
3. تأكد من المصادقة عبر `crewai login`
4. تحقق من أن الطاقم/التدفق قيد التنفيذ فعلاً
3. للتصدير باستخدام المصادقة، تحقّق من تسجيل دخول CLI أو `CREWAI_USER_PAT` أو بيانات اعتماد تكامل المنصة. للمشاركة المجهولة، وافق صراحةً على مطالبة الموافقة؛ لا يلزم تسجيل الدخول
4. تحقّق من تنفيذ الطاقم/التدفق ونجاح تصدير التتبع. يؤدي رفض الموافقة أو انتهاء المهلة أو التشغيل دون مطالبة تفاعلية بالموافقة إلى حذف المخزن المؤقت المحلي دون رفعه

View File

@@ -150,8 +150,8 @@ result = flow.kickoff()
### Step 5: View Traces in the CrewAI AMP Dashboard
After running the crew or flow, you can view the traces generated by your CrewAI application in the CrewAI AMP dashboard. You should see detailed steps of the agent interactions, tool usages, and LLM calls.
Just click on the link below to view the traces or head over to the traces tab in the dashboard [here](https://app.crewai.com/crewai_plus/trace_batches)
Traces are uploaded only after a successful authenticated export or an explicitly approved anonymous upload. A run whose local buffer is discarded has no uploaded trace.
For traces associated with your account, open the [Traces tab in the CrewAI AMP dashboard](https://app.crewai.com/crewai_plus/trace_batches) to view agent interactions, tool usage, and LLM calls.
![CrewAI Tracing Interface](/images/view-traces.png)
### Alternative: Environment Variable Configuration
@@ -175,13 +175,45 @@ When this environment variable is set, all Crews and Flows will automatically ha
The first time you run a Crew or Flow, an interactive terminal may ask:
```text
Would you like to view your execution traces? [y/N]
Share this execution trace with CrewAI? [y/N]
```
Choose **yes** to open a view link. You can change this later with
`crewai traces enable` or `crewai traces disable`, or by setting `tracing`
Choose **yes** to upload the buffered trace to CrewAI. Traces may contain
prompts, inputs, and outputs. Declining, timing out, or running without an
interactive consent prompt discards the buffer. You can change tracing later
with `crewai traces enable` or `crewai traces disable`, or by setting `tracing`
on the Crew or Flow.
### Local buffering and authenticated export
First-run trace collection stays in process memory until you agree to share,
even if you have saved login credentials. Unauthenticated tracing uses the same
consent flow. Before consent, CrewAI requests no upload grant and sends no
execution spans.
The buffer retains up to **1,000 spans** and **8 MiB of encoded OTLP data**.
Set `CREWAI_EPHEMERAL_TRACE_MAX_SPANS` and
`CREWAI_EPHEMERAL_TRACE_MAX_BYTES` to positive integers to adjust these limits.
Overflow drops the oldest spans; a span larger than the byte limit is dropped.
The buffer is cleared after sharing or discarding it.
When tracing is enabled and credentials are available, CrewAI exchanges your
CLI login, `CREWAI_USER_PAT`, or platform integration credential with AMP for
an execution-specific grant. It then exports OpenTelemetry spans directly to
Wharf using that grant. Invalid credentials do not fall back to anonymous upload.
### Hosted execution sessions
Hosts can wrap execution with `telemetry_session` from
`crewai.telemetry.tracing`. The session uses CrewAI lifecycle events to create
and finish spans, preserving their timestamps, parent relationships, and HITL
pause/resume links. Pass an existing provider with `providers=` to retain the
host's tracer and logging integration. Pass span processors with `processors=`
and a host logging callback with `log_emitter=`. The host owns any redaction
in these integrations.
Each session owns its tracing lifecycle and leaves the application's global
OpenTelemetry provider unchanged.
## Viewing Your Traces
### Access the CrewAI AMP Dashboard
@@ -222,5 +254,5 @@ If traces aren't showing up in the dashboard:
1. Confirm `tracing=True` is set in your Crew/Flow
2. Check that `CREWAI_TRACING_ENABLED=true` if using environment variables
3. Ensure you're authenticated with `crewai login`
4. Verify your crew/flow is actually executing
3. For authenticated export, verify your CLI login, `CREWAI_USER_PAT`, or platform integration credential. For anonymous sharing, explicitly approve the consent prompt; login is not required
4. Verify your crew/flow executed and the trace export succeeded. Declining consent, timing out, or running without an interactive consent prompt discards the local buffer without uploading it

View File

@@ -150,8 +150,8 @@ result = flow.kickoff()
### 5단계: CrewAI AMP 대시보드에서 추적 보기
crew 또는 flow를 실행한 후 CrewAI AMP 대시보드에서 CrewAI 애플리케이션이 생성한 추적을 볼 수 있습니다. agent 상호 작용, 도구 사용 및 LLM 호출의 세부 단계를 볼 수 있습니다.
아래 링크를 클릭하여 추적을 보거나 대시보드의 추적 탭으로 이동하세요 [여기](https://app.crewai.com/crewai_plus/trace_batches)
추적은 인증된 내보내기 또는 명시적으로 동의한 익명 업로드가 성공한 경우에만 업로드됩니다. 로컬 버퍼가 삭제된 실행에는 업로드된 추적이 없습니다.
계정에 연결된 추적은 [CrewAI AMP 대시보드의 Traces 탭](https://app.crewai.com/crewai_plus/trace_batches)에서 agent 상호 작용, 도구 사용 및 LLM 호출을 확인하세요.
![CrewAI Tracing Interface](/images/view-traces.png)
### 대안: 환경 변수 구성
@@ -175,11 +175,45 @@ CREWAI_TRACING_ENABLED=true
Crew 또는 Flow를 처음 실행하면 대화형 터미널에서 다음을 물을 수 있습니다:
```text
Would you like to view your execution traces? [y/N]
Share this execution trace with CrewAI? [y/N]
```
보기 링크를 열려면 **yes**를 선택하세요. 나중에 `crewai traces enable` 또는
`crewai traces disable`로 바꾸거나, Crew 또는 Flow에서 `tracing`을 설정할 수 있습니다.
버퍼에 저장된 추적을 CrewAI에 업로드하려면 **yes**를 선택하세요. 추적에는
프롬프트, 입력, 출력이 포함될 수 있습니다. 거절하거나 시간이 초과되거나
대화형 동의 프롬프트 없이 실행하면 버퍼가 삭제됩니다. 나중에
`crewai traces enable` 또는 `crewai traces disable`을 사용하거나 Crew 또는
Flow에서 `tracing`을 설정하여 추적 설정을 변경할 수 있습니다.
### 로컬 버퍼링 및 인증된 내보내기
첫 실행에서 수집한 추적은 저장된 로그인 자격 증명이 있어도 공유에 동의할
때까지 프로세스 메모리에 보관됩니다. 인증되지 않은 추적도 같은 동의 절차를
사용합니다. 동의하기 전에는 CrewAI가 업로드 권한을 요청하거나 실행 span을
전송하지 않습니다.
버퍼는 최대 **1,000개의 span**과 **8 MiB의 인코딩된 OTLP 데이터**를
보관합니다. `CREWAI_EPHEMERAL_TRACE_MAX_SPANS`와
`CREWAI_EPHEMERAL_TRACE_MAX_BYTES`를 양의 정수로 설정하여 한도를 조정할
수 있습니다. 한도를 초과하면 가장 오래된 span부터 삭제하며, 개별 span이
바이트 한도보다 크면 해당 span을 삭제합니다. 공유하거나 폐기한 후에는
버퍼를 비웁니다.
추적이 활성화되고 자격 증명을 사용할 수 있으면 CrewAI는 CLI 로그인,
`CREWAI_USER_PAT` 또는 플랫폼 통합 자격 증명을 AMP에서 실행별 권한으로
교환합니다. 그런 다음 해당 권한을 사용하여 OpenTelemetry span을 Wharf로
직접 내보냅니다. 유효하지 않은 자격 증명으로는 익명 업로드로 전환하지 않습니다.
### 호스팅된 실행 세션
호스트는 `crewai.telemetry.tracing`의 `telemetry_session`으로 실행을 감쌀
수 있습니다. 세션은 CrewAI 수명 주기 이벤트를 사용하여 span을 생성하고
종료하며 타임스탬프, 부모 관계, HITL 일시 중지/재개 링크를 유지합니다.
`providers=`에 기존 공급자를 전달하면 호스트의 tracer와 로깅 통합을
유지할 수 있습니다. `processors=`로 span 프로세서를 전달하고
`log_emitter=`로 호스트 로깅 콜백을 전달할 수 있습니다. 이러한 통합에서
데이터 마스킹은 호스트가 담당합니다.
각 세션은 자체 추적 수명 주기를 관리하며 애플리케이션의 전역
OpenTelemetry 공급자를 변경하지 않습니다.
## 추적 보기
@@ -221,5 +255,5 @@ CrewAI 추적은 다음에 대한 포괄적인 가시성을 제공합니다:
1. Crew/Flow에서 `tracing=True`가 설정되어 있는지 확인하세요
2. 환경 변수를 사용하는 경우 `CREWAI_TRACING_ENABLED=true`인지 확인하세요
3. `crewai login`으로 인증되었는지 확인하세요
4. crew/flow가 실제로 실행되고 있는지 확인하세요
3. 인증된 내보내기의 경우 CLI 로그인, `CREWAI_USER_PAT` 또는 플랫폼 통합 자격 증명을 확인하세요. 익명으로 공유하려면 동의 프롬프트에서 명시적으로 동의하세요. 로그인은 필요하지 않습니다
4. crew/flow가 실행되었고 추적 내보내기가 성공했는지 확인하세요. 동의를 거절하거나 시간이 초과되거나 대화형 동의 프롬프트 없이 실행하면 로컬 버퍼가 업로드되지 않고 삭제됩니다

View File

@@ -150,8 +150,8 @@ result = flow.kickoff()
### Passo 5: Visualize os Rastreamentos no Painel CrewAI AMP
Após executar o crew ou flow, você pode visualizar os rastreamentos gerados pela sua aplicação CrewAI no painel CrewAI AMP. Você verá etapas detalhadas das interações dos agentes, usos de ferramentas e chamadas de LLM.
Basta clicar no link abaixo para visualizar os rastreamentos ou ir para a aba de rastreamentos no painel [aqui](https://app.crewai.com/crewai_plus/trace_batches)
Os rastreamentos são enviados somente após uma exportação autenticada bem-sucedida ou um upload anônimo explicitamente aprovado e concluído com sucesso. Uma execução cujo buffer local foi descartado não tem rastreamento enviado.
Para rastreamentos associados à sua conta, abra a [aba Traces no painel CrewAI AMP](https://app.crewai.com/crewai_plus/trace_batches) para visualizar interações dos agentes, uso de ferramentas e chamadas de LLM.
![CrewAI Tracing Interface](/images/view-traces.png)
### Alternativa: Configuração de Variável de Ambiente
@@ -175,13 +175,47 @@ Quando esta variável de ambiente estiver definida, todos os Crews e Flows terã
Na primeira vez que você executa um Crew ou Flow, um terminal interativo pode perguntar:
```text
Would you like to view your execution traces? [y/N]
Share this execution trace with CrewAI? [y/N]
```
Escolha **yes** para abrir um link de visualização. Você pode alterar isso depois com
Escolha **yes** para enviar o rastreamento armazenado no buffer ao CrewAI.
Os rastreamentos podem conter prompts, entradas e saídas. Recusar, deixar o
prazo expirar ou executar sem uma solicitação interativa de consentimento
descarta o buffer. Você pode alterar o rastreamento depois com
`crewai traces enable` ou `crewai traces disable`, ou definindo `tracing`
no Crew ou Flow.
### Buffer local e exportação autenticada
A coleta de rastreamentos da primeira execução permanece na memória do processo
até você concordar em compartilhar, mesmo com credenciais de login salvas.
O rastreamento sem autenticação usa o mesmo fluxo de consentimento. Antes do
consentimento, o CrewAI não solicita autorização de upload nem envia spans de execução.
O buffer retém até **1.000 spans** e **8 MiB de dados OTLP codificados**.
Defina `CREWAI_EPHEMERAL_TRACE_MAX_SPANS` e
`CREWAI_EPHEMERAL_TRACE_MAX_BYTES` como inteiros positivos para ajustar esses limites.
Ao exceder o limite, os spans mais antigos são descartados; um span maior que o
limite de bytes é descartado. O buffer é esvaziado após o compartilhamento ou descarte.
Quando o rastreamento está habilitado e há credenciais disponíveis, o CrewAI troca
seu login da CLI, `CREWAI_USER_PAT` ou credencial de integração da plataforma
com o AMP por uma autorização específica para a execução. Em seguida, exporta
spans OpenTelemetry diretamente para o Wharf usando essa autorização.
Credenciais inválidas não resultam em upload anônimo como alternativa.
### Sessões de execução hospedadas
Os hosts podem envolver a execução com `telemetry_session` de
`crewai.telemetry.tracing`. A sessão usa eventos do ciclo de vida do CrewAI
para criar e finalizar spans, preservando timestamps, relações de parentesco e
links de pausa/retomada de HITL. Passe um provedor existente com `providers=`
para manter o tracer e a integração de logs do host. Passe processadores de
spans com `processors=` e um callback de logs do host com `log_emitter=`.
O host é responsável por qualquer remoção de dados sensíveis nessas integrações. Cada sessão gerencia
seu próprio ciclo de vida de rastreamento e mantém o provedor OpenTelemetry
global da aplicação inalterado.
## Visualizando seus Rastreamentos
### Acesse o Painel CrewAI AMP
@@ -222,5 +256,5 @@ Se os rastreamentos não estiverem aparecendo no painel:
1. Confirme que `tracing=True` está definido em seu Crew/Flow
2. Verifique se `CREWAI_TRACING_ENABLED=true` se estiver usando variáveis de ambiente
3. Certifique-se de estar autenticado com `crewai login`
4. Verifique se seu crew/flow está realmente executando
3. Para exportação autenticada, verifique seu login da CLI, `CREWAI_USER_PAT` ou credencial de integração da plataforma. Para compartilhamento anônimo, aprove explicitamente a solicitação de consentimento; não é necessário fazer login
4. Verifique se seu crew/flow foi executado e se a exportação do rastreamento foi bem-sucedida. Recusar o consentimento, deixar o prazo expirar ou executar sem uma solicitação interativa de consentimento descarta o buffer local sem enviá-lo