Class UserAgentInterceptor

java.lang.Object
com.alibaba.dashscope.transport.UserAgentInterceptor
All Implemented Interfaces:
okhttp3.Interceptor

public final class UserAgentInterceptor extends Object implements okhttp3.Interceptor
Attaches SDK telemetry headers (design §6): User-Agent (version), x-dashscope-sdk-session-id (shared with 2.x via the neutral layer, so one process reports one session id across generations), and x-dashscope-sdk-client in the client/version/module form. The module segment names the functional area issuing the request (aigc / embeddings / audio / ...) and carries a trailing MODULE_MARKER so the 3.0 surface stays separable from 2.x: one artifact ships both the legacy_2x transport and this 3.0 transport and both read the same SdkInfo.VERSION, so the version segment alone cannot tell them apart. With the marker 3.0 emits aigc3 while 2.x stays aigc, mirroring the Python SDK's V2_MODULE_MARKER. The two tracking headers honor the 2.x DASHSCOPE_DISABLE_SDK_HEADERS opt-out (1/true); User-Agent itself is not a tracking header and stays.
  • Field Details

  • Constructor Details

    • UserAgentInterceptor

      public UserAgentInterceptor()
  • Method Details

    • intercept

      public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException
      Specified by:
      intercept in interface okhttp3.Interceptor
      Throws:
      IOException