Back to Dify

Dify Enterprise Telemetry Data Dictionary

api/enterprise/telemetry/DATA_DICTIONARY.md

1.14.023.3 KB
Original Source

Dify Enterprise Telemetry Data Dictionary

Quick reference for all telemetry signals emitted by Dify Enterprise. For configuration and architecture details, see README.md.

Resource Attributes

Attached to every signal (Span, Metric, Log).

AttributeTypeExample
service.namestringdify
host.namestringdify-api-7f8b

Traces (Spans)

dify.workflow.run

AttributeTypeDescription
dify.trace_idstringBusiness trace ID (Workflow Run ID)
dify.tenant_idstringTenant identifier
dify.app_idstringApplication identifier
dify.workflow.idstringWorkflow definition ID
dify.workflow.run_idstringUnique ID for this run
dify.workflow.statusstringsucceeded, failed, stopped, etc.
dify.workflow.errorstringError message if failed
dify.workflow.elapsed_timefloatTotal execution time (seconds)
dify.invoke_fromstringapi, webapp, debug
dify.conversation.idstringConversation ID (optional)
dify.message.idstringMessage ID (optional)
dify.invoked_bystringUser ID who triggered the run
gen_ai.usage.total_tokensintTotal tokens across all nodes (optional)
gen_ai.user.idstringEnd-user identifier (optional)
dify.parent.trace_idstringParent workflow trace ID (optional)
dify.parent.workflow.run_idstringParent workflow run ID (optional)
dify.parent.node.execution_idstringParent node execution ID (optional)
dify.parent.app.idstringParent app ID (optional)

dify.node.execution

AttributeTypeDescription
dify.trace_idstringBusiness trace ID
dify.tenant_idstringTenant identifier
dify.app_idstringApplication identifier
dify.workflow.idstringWorkflow definition ID
dify.workflow.run_idstringWorkflow Run ID
dify.message.idstringMessage ID (optional)
dify.conversation.idstringConversation ID (optional)
dify.node.execution_idstringUnique node execution ID
dify.node.idstringNode ID in workflow graph
dify.node.typestringNode type (see appendix)
dify.node.titlestringDisplay title
dify.node.statusstringsucceeded, failed
dify.node.errorstringError message if failed
dify.node.elapsed_timefloatExecution time (seconds)
dify.node.indexintExecution order index
dify.node.predecessor_node_idstringTriggering node ID
dify.node.iteration_idstringIteration ID (optional)
dify.node.loop_idstringLoop ID (optional)
dify.node.parallel_idstringParallel branch ID (optional)
dify.node.invoked_bystringUser ID who triggered execution
gen_ai.usage.input_tokensintPrompt tokens (LLM nodes only)
gen_ai.usage.output_tokensintCompletion tokens (LLM nodes only)
gen_ai.usage.total_tokensintTotal tokens (LLM nodes only)
gen_ai.request.modelstringLLM model name (LLM nodes only)
gen_ai.provider.namestringLLM provider name (LLM nodes only)
gen_ai.user.idstringEnd-user identifier (optional)

dify.node.execution.draft

Same attributes as dify.node.execution. Emitted during Preview/Debug runs.

Counters

All counters are cumulative and emitted at 100% accuracy.

Token Counters

MetricUnitDescription
dify.tokens.total{token}Total tokens consumed
dify.tokens.input{token}Input (prompt) tokens
dify.tokens.output{token}Output (completion) tokens

Labels:

  • tenant_id, app_id, operation_type, model_provider, model_name, node_type (if node_execution)

⚠️ Warning: dify.tokens.total at workflow level includes all node tokens. Filter by operation_type to avoid double-counting.

Token Hierarchy & Query Patterns

Token metrics are emitted at multiple layers. Understanding the hierarchy prevents double-counting:

App-level total
├── workflow          ← sum of all node_execution tokens (DO NOT add both)
│   └── node_execution ← per-node breakdown
├── message           ← independent (non-workflow chat apps only)
├── rule_generate     ← independent helper LLM call
├── code_generate     ← independent helper LLM call
├── structured_output ← independent helper LLM call
└── instruction_modify← independent helper LLM call

Key rule: workflow tokens already include all node_execution tokens. Never sum both.

Available labels on token metrics: tenant_id, app_id, operation_type, model_provider, model_name, node_type. App name is only available on span attributes (dify.app.name), not metric labels — use app_id for metric queries.

Common queries (PromQL):

promql
# ── Totals ──────────────────────────────────────────────────
# App-level total (exclude node_execution to avoid double-counting)
sum by (app_id) (dify_tokens_total{operation_type!="node_execution"})

# Single app total
sum (dify_tokens_total{app_id="<app_id>", operation_type!="node_execution"})

# Per-tenant totals
sum by (tenant_id) (dify_tokens_total{operation_type!="node_execution"})

# ── Drill-down ──────────────────────────────────────────────
# Workflow-level tokens for an app
sum (dify_tokens_total{app_id="<app_id>", operation_type="workflow"})

# Node-level breakdown within an app
sum by (node_type) (dify_tokens_total{app_id="<app_id>", operation_type="node_execution"})

# Model breakdown for an app
sum by (model_provider, model_name) (dify_tokens_total{app_id="<app_id>"})

# Input vs output per model
sum by (model_name) (dify_tokens_input_total{app_id="<app_id>"})
sum by (model_name) (dify_tokens_output_total{app_id="<app_id>"})

# ── Rates ───────────────────────────────────────────────────
# Token consumption rate (per hour)
sum(rate(dify_tokens_total{operation_type!="node_execution"}[1h]))

# Per-app consumption rate
sum by (app_id) (rate(dify_tokens_total{operation_type!="node_execution"}[1h]))

Finding app_id from app name (trace query — Tempo / Jaeger):

{ resource.dify.app.name = "My Chatbot" } | select(resource.dify.app.id)

Request Counters

MetricUnitDescription
dify.requests.total{request}Total operations count

Labels by type:

typeAdditional Labels
workflowtenant_id, app_id, status, invoke_from
nodetenant_id, app_id, node_type, model_provider, model_name, status
draft_nodetenant_id, app_id, node_type, model_provider, model_name, status
messagetenant_id, app_id, model_provider, model_name, status, invoke_from
tooltenant_id, app_id, tool_name
moderationtenant_id, app_id
suggested_questiontenant_id, app_id, model_provider, model_name
dataset_retrievaltenant_id, app_id
generate_nametenant_id, app_id
prompt_generationtenant_id, app_id, operation_type, model_provider, model_name, status

Error Counters

MetricUnitDescription
dify.errors.total{error}Total failed operations

Labels by type:

typeAdditional Labels
workflowtenant_id, app_id
nodetenant_id, app_id, node_type, model_provider, model_name
draft_nodetenant_id, app_id, node_type, model_provider, model_name
messagetenant_id, app_id, model_provider, model_name
tooltenant_id, app_id, tool_name
prompt_generationtenant_id, app_id, operation_type, model_provider, model_name

Other Counters

MetricUnitLabels
dify.feedback.total{feedback}tenant_id, app_id, rating
dify.dataset.retrievals.total{retrieval}tenant_id, app_id, dataset_id, embedding_model_provider, embedding_model, rerank_model_provider, rerank_model
dify.app.created.total{app}tenant_id, app_id, mode
dify.app.updated.total{app}tenant_id, app_id
dify.app.deleted.total{app}tenant_id, app_id

Histograms

MetricUnitLabels
dify.workflow.durationstenant_id, app_id, status
dify.node.durationstenant_id, app_id, node_type, model_provider, model_name, plugin_name
dify.message.durationstenant_id, app_id, model_provider, model_name
dify.message.time_to_first_tokenstenant_id, app_id, model_provider, model_name
dify.tool.durationstenant_id, app_id, tool_name
dify.prompt_generation.durationstenant_id, app_id, operation_type, model_provider, model_name

Structured Logs

Span Companion Logs

Logs that accompany spans. Signal type: span_detail

dify.workflow.run Companion Log

Common attributes: All span attributes (see Traces section) plus:

Additional AttributeTypeAlways PresentDescription
dify.app.namestringNoApplication display name
dify.workspace.namestringNoWorkspace display name
dify.workflow.versionstringYesWorkflow definition version
dify.workflow.inputsstring/JSONYesInput parameters (content-gated)
dify.workflow.outputsstring/JSONYesOutput results (content-gated)
dify.workflow.querystringNoUser query text (content-gated)

Event attributes:

  • dify.event.name: "dify.workflow.run"
  • dify.event.signal: "span_detail"
  • trace_id, span_id, tenant_id, user_id

dify.node.execution and dify.node.execution.draft Companion Logs

Common attributes: All span attributes (see Traces section) plus:

Additional AttributeTypeAlways PresentDescription
dify.app.namestringNoApplication display name
dify.workspace.namestringNoWorkspace display name
dify.invoke_fromstringNoInvocation source
gen_ai.tool.namestringNoTool name (tool nodes only)
dify.node.total_pricefloatNoCost (LLM nodes only)
dify.node.currencystringNoCurrency code (LLM nodes only)
dify.node.iteration_indexintNoIteration index (iteration nodes)
dify.node.loop_indexintNoLoop index (loop nodes)
dify.plugin.namestringNoPlugin name (tool/knowledge nodes)
dify.credential.namestringNoCredential name (plugin nodes)
dify.credential.idstringNoCredential ID (plugin nodes)
dify.dataset.idsJSON arrayNoDataset IDs (knowledge nodes)
dify.dataset.namesJSON arrayNoDataset names (knowledge nodes)
dify.node.inputsstring/JSONYesNode inputs (content-gated)
dify.node.outputsstring/JSONYesNode outputs (content-gated)
dify.node.process_datastring/JSONNoProcessing data (content-gated)

Event attributes:

  • dify.event.name: "dify.node.execution" or "dify.node.execution.draft"
  • dify.event.signal: "span_detail"
  • trace_id, span_id, tenant_id, user_id

Standalone Logs

Logs without structural spans. Signal type: metric_only

dify.message.run

AttributeTypeDescription
dify.event.namestring"dify.message.run"
dify.event.signalstring"metric_only"
trace_idstringOTEL trace ID (32-char hex)
span_idstringOTEL span ID (16-char hex)
tenant_idstringTenant identifier
user_idstringUser identifier (optional)
dify.app_idstringApplication identifier
dify.message.idstringMessage identifier
dify.conversation.idstringConversation ID (optional)
dify.workflow.run_idstringWorkflow run ID (optional)
dify.invoke_fromstringservice-api, web-app, debugger, explore
gen_ai.provider.namestringLLM provider
gen_ai.request.modelstringLLM model
gen_ai.usage.input_tokensintInput tokens
gen_ai.usage.output_tokensintOutput tokens
gen_ai.usage.total_tokensintTotal tokens
dify.message.statusstringsucceeded, failed
dify.message.errorstringError message (if failed)
dify.message.durationfloatDuration (seconds)
dify.message.time_to_first_tokenfloatTTFT (seconds)
dify.message.inputsstring/JSONInputs (content-gated)
dify.message.outputsstring/JSONOutputs (content-gated)

dify.tool.execution

AttributeTypeDescription
dify.event.namestring"dify.tool.execution"
dify.event.signalstring"metric_only"
trace_idstringOTEL trace ID
span_idstringOTEL span ID
tenant_idstringTenant identifier
dify.app_idstringApplication identifier
dify.message.idstringMessage identifier
dify.tool.namestringTool name
dify.tool.durationfloatDuration (seconds)
dify.tool.statusstringsucceeded, failed
dify.tool.errorstringError message (if failed)
dify.tool.inputsstring/JSONInputs (content-gated)
dify.tool.outputsstring/JSONOutputs (content-gated)
dify.tool.parametersstring/JSONParameters (content-gated)
dify.tool.configstring/JSONConfiguration (content-gated)

dify.moderation.check

AttributeTypeDescription
dify.event.namestring"dify.moderation.check"
dify.event.signalstring"metric_only"
trace_idstringOTEL trace ID
span_idstringOTEL span ID
tenant_idstringTenant identifier
dify.app_idstringApplication identifier
dify.message.idstringMessage identifier
dify.moderation.typestringinput, output
dify.moderation.actionstringpass, block, flag
dify.moderation.flaggedbooleanWhether flagged
dify.moderation.categoriesJSON arrayFlagged categories
dify.moderation.querystringContent (content-gated)

dify.suggested_question.generation

AttributeTypeDescription
dify.event.namestring"dify.suggested_question.generation"
dify.event.signalstring"metric_only"
trace_idstringOTEL trace ID
span_idstringOTEL span ID
tenant_idstringTenant identifier
dify.app_idstringApplication identifier
dify.message.idstringMessage identifier
dify.suggested_question.countintNumber of questions
dify.suggested_question.durationfloatDuration (seconds)
dify.suggested_question.statusstringsucceeded, failed
dify.suggested_question.errorstringError message (if failed)
dify.suggested_question.questionsJSON arrayQuestions (content-gated)

dify.dataset.retrieval

AttributeTypeDescription
dify.event.namestring"dify.dataset.retrieval"
dify.event.signalstring"metric_only"
trace_idstringOTEL trace ID
span_idstringOTEL span ID
tenant_idstringTenant identifier
dify.app_idstringApplication identifier
dify.message.idstringMessage identifier
dify.dataset.idstringDataset identifier
dify.dataset.namestringDataset name
dify.dataset.embedding_providersJSON arrayEmbedding model providers (one per dataset)
dify.dataset.embedding_modelsJSON arrayEmbedding models (one per dataset)
dify.retrieval.rerank_providerstringRerank model provider
dify.retrieval.rerank_modelstringRerank model name
dify.retrieval.querystringSearch query (content-gated)
dify.retrieval.document_countintDocuments retrieved
dify.retrieval.durationfloatDuration (seconds)
dify.retrieval.statusstringsucceeded, failed
dify.retrieval.errorstringError message (if failed)
dify.dataset.documentsJSON arrayDocuments (content-gated)

dify.generate_name.execution

AttributeTypeDescription
dify.event.namestring"dify.generate_name.execution"
dify.event.signalstring"metric_only"
trace_idstringOTEL trace ID
span_idstringOTEL span ID
tenant_idstringTenant identifier
dify.app_idstringApplication identifier
dify.conversation.idstringConversation identifier
dify.generate_name.durationfloatDuration (seconds)
dify.generate_name.statusstringsucceeded, failed
dify.generate_name.errorstringError message (if failed)
dify.generate_name.inputsstring/JSONInputs (content-gated)
dify.generate_name.outputsstringGenerated name (content-gated)

dify.prompt_generation.execution

AttributeTypeDescription
dify.event.namestring"dify.prompt_generation.execution"
dify.event.signalstring"metric_only"
trace_idstringOTEL trace ID
span_idstringOTEL span ID
tenant_idstringTenant identifier
dify.app_idstringApplication identifier
dify.prompt_generation.operation_typestringOperation type (see appendix)
gen_ai.provider.namestringLLM provider
gen_ai.request.modelstringLLM model
gen_ai.usage.input_tokensintInput tokens
gen_ai.usage.output_tokensintOutput tokens
gen_ai.usage.total_tokensintTotal tokens
dify.prompt_generation.durationfloatDuration (seconds)
dify.prompt_generation.statusstringsucceeded, failed
dify.prompt_generation.errorstringError message (if failed)
dify.prompt_generation.instructionstringInstruction (content-gated)
dify.prompt_generation.outputstring/JSONOutput (content-gated)

dify.app.created

AttributeTypeDescription
dify.event.namestring"dify.app.created"
dify.event.signalstring"metric_only"
tenant_idstringTenant identifier
dify.app_idstringApplication identifier
dify.app.modestringchat, completion, agent-chat, workflow
dify.app.created_atstringTimestamp (ISO 8601)

dify.app.updated

AttributeTypeDescription
dify.event.namestring"dify.app.updated"
dify.event.signalstring"metric_only"
tenant_idstringTenant identifier
dify.app_idstringApplication identifier
dify.app.updated_atstringTimestamp (ISO 8601)

dify.app.deleted

AttributeTypeDescription
dify.event.namestring"dify.app.deleted"
dify.event.signalstring"metric_only"
tenant_idstringTenant identifier
dify.app_idstringApplication identifier
dify.app.deleted_atstringTimestamp (ISO 8601)

dify.feedback.created

AttributeTypeDescription
dify.event.namestring"dify.feedback.created"
dify.event.signalstring"metric_only"
trace_idstringOTEL trace ID
span_idstringOTEL span ID
tenant_idstringTenant identifier
dify.app_idstringApplication identifier
dify.message.idstringMessage identifier
dify.feedback.ratingstringlike, dislike, null
dify.feedback.contentstringFeedback text (content-gated)
dify.feedback.created_atstringTimestamp (ISO 8601)

dify.telemetry.rehydration_failed

Diagnostic event for telemetry system health monitoring.

AttributeTypeDescription
dify.event.namestring"dify.telemetry.rehydration_failed"
dify.event.signalstring"metric_only"
tenant_idstringTenant identifier
dify.telemetry.errorstringError message
dify.telemetry.payload_typestringPayload type (see appendix)
dify.telemetry.correlation_idstringCorrelation ID

Content-Gated Attributes

When ENTERPRISE_INCLUDE_CONTENT=false, these attributes are replaced with reference strings (ref:{id_type}={uuid}).

AttributeSignal
dify.workflow.inputsdify.workflow.run
dify.workflow.outputsdify.workflow.run
dify.workflow.querydify.workflow.run
dify.node.inputsdify.node.execution
dify.node.outputsdify.node.execution
dify.node.process_datadify.node.execution
dify.message.inputsdify.message.run
dify.message.outputsdify.message.run
dify.tool.inputsdify.tool.execution
dify.tool.outputsdify.tool.execution
dify.tool.parametersdify.tool.execution
dify.tool.configdify.tool.execution
dify.moderation.querydify.moderation.check
dify.suggested_question.questionsdify.suggested_question.generation
dify.retrieval.querydify.dataset.retrieval
dify.dataset.documentsdify.dataset.retrieval
dify.generate_name.inputsdify.generate_name.execution
dify.generate_name.outputsdify.generate_name.execution
dify.prompt_generation.instructiondify.prompt_generation.execution
dify.prompt_generation.outputdify.prompt_generation.execution
dify.feedback.contentdify.feedback.created

Appendix

Operation Types

  • workflow, node_execution, message, rule_generate, code_generate, structured_output, instruction_modify

Node Types

  • start, end, answer, llm, knowledge-retrieval, knowledge-index, if-else, code, template-transform, question-classifier, http-request, tool, datasource, variable-aggregator, loop, iteration, parameter-extractor, assigner, document-extractor, list-operator, agent, trigger-webhook, trigger-schedule, trigger-plugin, human-input

Workflow Statuses

  • running, succeeded, failed, stopped, partial-succeeded, paused

Payload Types

  • workflow, node, message, tool, moderation, suggested_question, dataset_retrieval, generate_name, prompt_generation, app, feedback

Null Value Behavior

Spans: Attributes with null values are omitted.

Logs: Attributes with null values appear as null in JSON.

Content-Gated: Replaced with reference strings, not set to null.