OpenAI

Monitoring your OpenAI requests via Dynatrace, you can get cost analysis and forecast estimation via Davis AI, prompt and completion recording, error tracking, performance metrics of your AI services, and more.

OpenAI Observability

Configuration

Follow Ingest OpenTelemetry metrics to see how OpenTelemetry metrics are mapped to Dynatrace metric types.

Create a Dynatrace token

To create a Dynatrace token

  1. In Dynatrace, go to Access Tokens.
    To find Access Tokens, press Ctrl/Cmd+K to search for and select Access Tokens.
  2. In Access Tokens, select Generate new token.
  3. Enter a Token name for your new token.
  4. Give your new token the following permissions:
  5. Search for and select all of the following scopes.
    • Ingest metrics (metrics.ingest)
    • Ingest logs (logs.ingest)
    • Ingest events (events.ingest)
    • Ingest OpenTelemetry traces (openTelemetryTrace.ingest)
    • Read metrics (metrics.read)
    • Write settings (settings.write)
  6. Select Generate token.
  7. Copy the generated token to the clipboard. Store the token in a password manager for future use.

    You can only access your token once upon creation. You can't reveal it afterward.

Instrumentation

Spans

The following attributes are available for GenAI Spans.

Attribute
Type
Description
gen_ai.completion.0.content
string
The full response received from the GenAI model.
gen_ai.completion.0.content_filter_results
string
The filter results of the response received from the GenAI model.
gen_ai.completion.0.finish_reason
string
The reason the GenAI model stopped producing tokens.
gen_ai.completion.0.role
string
The role used by the GenAI model.
gen_ai.openai.api_base
string
GenAI server address.
gen_ai.openai.api_version
string
GenAI API version.
gen_ai.openai.system_fingerprint
string
The fingerprint of the response generated by the GenAI model.
gen_ai.prompt.0.content
string
The full prompt sent to the GenAI model.
gen_ai.prompt.0.role
string
The role setting for the GenAI request.
gen_ai.prompt.prompt_filter_results
string
The filter results of the prompt sent to the GenAI model.
gen_ai.request.max_tokens
integer
The maximum number of tokens the model generates for a request.
gen_ai.request.model
string
The name of the GenAI model a request is being made to.
gen_ai.request.temperature
double
The temperature setting for the GenAI request.
gen_ai.request.top_p
double
The top_p sampling setting for the GenAI request.
gen_ai.response.model
string
The name of the model that generated the response.
gen_ai.system
string
The GenAI product as identified by the client or server instrumentation.
gen_ai.usage.completion_tokens
integer
The number of tokens used in the GenAI response (completion).
gen_ai.usage.prompt_tokens
integer
The number of tokens used in the GenAI input (prompt).
llm.request.type
string
The type of the operation being performed.

Metrics

Metric
Type
Unit
Description
gen_ai.client.generation.choices
counter
none
The number of choices returned by chat completions call.
gen_ai.client.operation.duration
histogram
s
The GenAI operation duration.
gen_ai.client.token.usage
histogram
none
The number of input and output tokens used.
llm.openai.embeddings.vector_size
counter
none
The size of returned vector.