Skip to content

ai-statistics 采集指标异常 || ai-statistics Acquisition indicator abnormality #2335

Open
@zjun-sudo

Description

@zjun-sudo

Why do you need it?

  • 开启流式响应后,ai-statistics 采集不到 input_token、output_token等值
  1. 未开启流式访问,ai-log值
    Image

  2. 开启流式访问,ai-log 值

Image

Other related information

  1. 流式请求访问

Image
2. 非流式请求访问

Image
3. 插件配置

    attributes:
      - apply_to_log: true
        apply_to_span: true
        key: model
        value: model
        value_source: response_body
      - apply_to_log: true
        apply_to_span: true
        key: input_token
        value: usage.prompt_tokens
        value_source: response_body
      - apply_to_log: true
        apply_to_span: true
        key: output_token
        value: usage.completion_tokens
        value_source: response_body
      - apply_to_log: true
        key: question
        value: [email protected]
        value_source: request_body
      - apply_to_log: true
        key: answer
        rule: append
        value: choices.0.delta.content
        value_source: response_streaming_body
      - apply_to_log: true
        key: consumer
        value: x-mse-consumer
        value_source: request_header

Why do you need it?

  • After turning on streaming response, ai-statistics cannot collect input_token, output_token and other values
  1. Streaming access is not enabled, ai-log value
    Image

  2. Turn on streaming access, ai-log value

Image

Other related information

  1. Streaming request access

Image
2. Non-streaming request access

Image
3. Plug-in configuration

    attributes:
      - apply_to_log: true
        apply_to_span: true
        key: model
        value: model
        value_source: response_body
      - apply_to_log: true
        apply_to_span: true
        key: input_token
        value: usage.prompt_tokens
        value_source: response_body
      - apply_to_log: true
        apply_to_span: true
        key: output_token
        value: usage.completion_tokens
        value_source: response_body
      - apply_to_log: true
        key: question
        value: [email protected]
        value_source: request_body
      - apply_to_log: true
        key: answer
        rule: append
        value: choices.0.delta.content
        value_source: response_streaming_body
      - apply_to_log: true
        key: consumer
        value: x-mse-consumer
        value_source: request_header

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions