@@ -29,217 +29,13 @@ public AsyncRawMetricsV2Client withRawResponse() {
2929
3030 /**
3131 * Get metrics from the Langfuse project using a query object. V2 endpoint with optimized performance.
32- * <h2>V2 Differences</h2>
33- * <ul>
34- * <li>Supports <code>observations</code>, <code>scores-numeric</code>, and <code>scores-categorical</code> views only (traces view not supported)</li>
35- * <li>Direct access to tags and release fields on observations</li>
36- * <li>Backwards-compatible: traceName, traceRelease, traceVersion dimensions are still available on observations view</li>
37- * <li>High cardinality dimensions are not supported and will return a 400 error (see below)</li>
38- * </ul>
39- * <p>For more details, see the <a href="https://langfuse.com/docs/metrics/features/metrics-api">Metrics API documentation</a>.</p>
40- * <h2>Available Views</h2>
41- * <h3>observations</h3>
42- * <p>Query observation-level data (spans, generations, events).</p>
43- * <p><strong>Dimensions:</strong></p>
44- * <ul>
45- * <li><code>environment</code> - Deployment environment (e.g., production, staging)</li>
46- * <li><code>type</code> - Type of observation (SPAN, GENERATION, EVENT)</li>
47- * <li><code>name</code> - Name of the observation</li>
48- * <li><code>level</code> - Logging level of the observation</li>
49- * <li><code>version</code> - Version of the observation</li>
50- * <li><code>tags</code> - User-defined tags</li>
51- * <li><code>release</code> - Release version</li>
52- * <li><code>traceName</code> - Name of the parent trace (backwards-compatible)</li>
53- * <li><code>traceRelease</code> - Release version of the parent trace (backwards-compatible, maps to release)</li>
54- * <li><code>traceVersion</code> - Version of the parent trace (backwards-compatible, maps to version)</li>
55- * <li><code>providedModelName</code> - Name of the model used</li>
56- * <li><code>promptName</code> - Name of the prompt used</li>
57- * <li><code>promptVersion</code> - Version of the prompt used</li>
58- * <li><code>startTimeMonth</code> - Month of start_time in YYYY-MM format</li>
59- * </ul>
60- * <p><strong>Measures:</strong></p>
61- * <ul>
62- * <li><code>count</code> - Total number of observations</li>
63- * <li><code>latency</code> - Observation latency (milliseconds)</li>
64- * <li><code>streamingLatency</code> - Generation latency from completion start to end (milliseconds)</li>
65- * <li><code>inputTokens</code> - Sum of input tokens consumed</li>
66- * <li><code>outputTokens</code> - Sum of output tokens produced</li>
67- * <li><code>totalTokens</code> - Sum of all tokens consumed</li>
68- * <li><code>outputTokensPerSecond</code> - Output tokens per second</li>
69- * <li><code>tokensPerSecond</code> - Total tokens per second</li>
70- * <li><code>inputCost</code> - Input cost (USD)</li>
71- * <li><code>outputCost</code> - Output cost (USD)</li>
72- * <li><code>totalCost</code> - Total cost (USD)</li>
73- * <li><code>timeToFirstToken</code> - Time to first token (milliseconds)</li>
74- * <li><code>countScores</code> - Number of scores attached to the observation</li>
75- * </ul>
76- * <h3>scores-numeric</h3>
77- * <p>Query numeric and boolean score data.</p>
78- * <p><strong>Dimensions:</strong></p>
79- * <ul>
80- * <li><code>environment</code> - Deployment environment</li>
81- * <li><code>name</code> - Name of the score (e.g., accuracy, toxicity)</li>
82- * <li><code>source</code> - Origin of the score (API, ANNOTATION, EVAL)</li>
83- * <li><code>dataType</code> - Data type (NUMERIC, BOOLEAN)</li>
84- * <li><code>configId</code> - Identifier of the score config</li>
85- * <li><code>timestampMonth</code> - Month in YYYY-MM format</li>
86- * <li><code>timestampDay</code> - Day in YYYY-MM-DD format</li>
87- * <li><code>value</code> - Numeric value of the score</li>
88- * <li><code>traceName</code> - Name of the parent trace</li>
89- * <li><code>tags</code> - Tags</li>
90- * <li><code>traceRelease</code> - Release version</li>
91- * <li><code>traceVersion</code> - Version</li>
92- * <li><code>observationName</code> - Name of the associated observation</li>
93- * <li><code>observationModelName</code> - Model name of the associated observation</li>
94- * <li><code>observationPromptName</code> - Prompt name of the associated observation</li>
95- * <li><code>observationPromptVersion</code> - Prompt version of the associated observation</li>
96- * </ul>
97- * <p><strong>Measures:</strong></p>
98- * <ul>
99- * <li><code>count</code> - Total number of scores</li>
100- * <li><code>value</code> - Score value (for aggregations)</li>
101- * </ul>
102- * <h3>scores-categorical</h3>
103- * <p>Query categorical score data. Same dimensions as scores-numeric except uses <code>stringValue</code> instead of <code>value</code>.</p>
104- * <p><strong>Measures:</strong></p>
105- * <ul>
106- * <li><code>count</code> - Total number of scores</li>
107- * </ul>
108- * <h2>High Cardinality Dimensions</h2>
109- * <p>The following dimensions cannot be used as grouping dimensions in v2 metrics API as they can cause performance issues.
110- * Use them in filters instead.</p>
111- * <p><strong>observations view:</strong></p>
112- * <ul>
113- * <li><code>id</code> - Use traceId filter to narrow down results</li>
114- * <li><code>traceId</code> - Use traceId filter instead</li>
115- * <li><code>userId</code> - Use userId filter instead</li>
116- * <li><code>sessionId</code> - Use sessionId filter instead</li>
117- * <li><code>parentObservationId</code> - Use parentObservationId filter instead</li>
118- * </ul>
119- * <p><strong>scores-numeric / scores-categorical views:</strong></p>
120- * <ul>
121- * <li><code>id</code> - Use specific filters to narrow down results</li>
122- * <li><code>traceId</code> - Use traceId filter instead</li>
123- * <li><code>userId</code> - Use userId filter instead</li>
124- * <li><code>sessionId</code> - Use sessionId filter instead</li>
125- * <li><code>observationId</code> - Use observationId filter instead</li>
126- * </ul>
127- * <h2>Aggregations</h2>
128- * <p>Available aggregation functions: <code>sum</code>, <code>avg</code>, <code>count</code>, <code>max</code>, <code>min</code>, <code>p50</code>, <code>p75</code>, <code>p90</code>, <code>p95</code>, <code>p99</code>, <code>histogram</code></p>
129- * <h2>Time Granularities</h2>
130- * <p>Available granularities for timeDimension: <code>auto</code>, <code>minute</code>, <code>hour</code>, <code>day</code>, <code>week</code>, <code>month</code></p>
131- * <ul>
132- * <li><code>auto</code> bins the data into approximately 50 buckets based on the time range</li>
133- * </ul>
13432 */
13533 public CompletableFuture <MetricsV2Response > metrics (GetMetricsV2Request request ) {
13634 return this .rawClient .metrics (request ).thenApply (response -> response .body ());
13735 }
13836
13937 /**
14038 * Get metrics from the Langfuse project using a query object. V2 endpoint with optimized performance.
141- * <h2>V2 Differences</h2>
142- * <ul>
143- * <li>Supports <code>observations</code>, <code>scores-numeric</code>, and <code>scores-categorical</code> views only (traces view not supported)</li>
144- * <li>Direct access to tags and release fields on observations</li>
145- * <li>Backwards-compatible: traceName, traceRelease, traceVersion dimensions are still available on observations view</li>
146- * <li>High cardinality dimensions are not supported and will return a 400 error (see below)</li>
147- * </ul>
148- * <p>For more details, see the <a href="https://langfuse.com/docs/metrics/features/metrics-api">Metrics API documentation</a>.</p>
149- * <h2>Available Views</h2>
150- * <h3>observations</h3>
151- * <p>Query observation-level data (spans, generations, events).</p>
152- * <p><strong>Dimensions:</strong></p>
153- * <ul>
154- * <li><code>environment</code> - Deployment environment (e.g., production, staging)</li>
155- * <li><code>type</code> - Type of observation (SPAN, GENERATION, EVENT)</li>
156- * <li><code>name</code> - Name of the observation</li>
157- * <li><code>level</code> - Logging level of the observation</li>
158- * <li><code>version</code> - Version of the observation</li>
159- * <li><code>tags</code> - User-defined tags</li>
160- * <li><code>release</code> - Release version</li>
161- * <li><code>traceName</code> - Name of the parent trace (backwards-compatible)</li>
162- * <li><code>traceRelease</code> - Release version of the parent trace (backwards-compatible, maps to release)</li>
163- * <li><code>traceVersion</code> - Version of the parent trace (backwards-compatible, maps to version)</li>
164- * <li><code>providedModelName</code> - Name of the model used</li>
165- * <li><code>promptName</code> - Name of the prompt used</li>
166- * <li><code>promptVersion</code> - Version of the prompt used</li>
167- * <li><code>startTimeMonth</code> - Month of start_time in YYYY-MM format</li>
168- * </ul>
169- * <p><strong>Measures:</strong></p>
170- * <ul>
171- * <li><code>count</code> - Total number of observations</li>
172- * <li><code>latency</code> - Observation latency (milliseconds)</li>
173- * <li><code>streamingLatency</code> - Generation latency from completion start to end (milliseconds)</li>
174- * <li><code>inputTokens</code> - Sum of input tokens consumed</li>
175- * <li><code>outputTokens</code> - Sum of output tokens produced</li>
176- * <li><code>totalTokens</code> - Sum of all tokens consumed</li>
177- * <li><code>outputTokensPerSecond</code> - Output tokens per second</li>
178- * <li><code>tokensPerSecond</code> - Total tokens per second</li>
179- * <li><code>inputCost</code> - Input cost (USD)</li>
180- * <li><code>outputCost</code> - Output cost (USD)</li>
181- * <li><code>totalCost</code> - Total cost (USD)</li>
182- * <li><code>timeToFirstToken</code> - Time to first token (milliseconds)</li>
183- * <li><code>countScores</code> - Number of scores attached to the observation</li>
184- * </ul>
185- * <h3>scores-numeric</h3>
186- * <p>Query numeric and boolean score data.</p>
187- * <p><strong>Dimensions:</strong></p>
188- * <ul>
189- * <li><code>environment</code> - Deployment environment</li>
190- * <li><code>name</code> - Name of the score (e.g., accuracy, toxicity)</li>
191- * <li><code>source</code> - Origin of the score (API, ANNOTATION, EVAL)</li>
192- * <li><code>dataType</code> - Data type (NUMERIC, BOOLEAN)</li>
193- * <li><code>configId</code> - Identifier of the score config</li>
194- * <li><code>timestampMonth</code> - Month in YYYY-MM format</li>
195- * <li><code>timestampDay</code> - Day in YYYY-MM-DD format</li>
196- * <li><code>value</code> - Numeric value of the score</li>
197- * <li><code>traceName</code> - Name of the parent trace</li>
198- * <li><code>tags</code> - Tags</li>
199- * <li><code>traceRelease</code> - Release version</li>
200- * <li><code>traceVersion</code> - Version</li>
201- * <li><code>observationName</code> - Name of the associated observation</li>
202- * <li><code>observationModelName</code> - Model name of the associated observation</li>
203- * <li><code>observationPromptName</code> - Prompt name of the associated observation</li>
204- * <li><code>observationPromptVersion</code> - Prompt version of the associated observation</li>
205- * </ul>
206- * <p><strong>Measures:</strong></p>
207- * <ul>
208- * <li><code>count</code> - Total number of scores</li>
209- * <li><code>value</code> - Score value (for aggregations)</li>
210- * </ul>
211- * <h3>scores-categorical</h3>
212- * <p>Query categorical score data. Same dimensions as scores-numeric except uses <code>stringValue</code> instead of <code>value</code>.</p>
213- * <p><strong>Measures:</strong></p>
214- * <ul>
215- * <li><code>count</code> - Total number of scores</li>
216- * </ul>
217- * <h2>High Cardinality Dimensions</h2>
218- * <p>The following dimensions cannot be used as grouping dimensions in v2 metrics API as they can cause performance issues.
219- * Use them in filters instead.</p>
220- * <p><strong>observations view:</strong></p>
221- * <ul>
222- * <li><code>id</code> - Use traceId filter to narrow down results</li>
223- * <li><code>traceId</code> - Use traceId filter instead</li>
224- * <li><code>userId</code> - Use userId filter instead</li>
225- * <li><code>sessionId</code> - Use sessionId filter instead</li>
226- * <li><code>parentObservationId</code> - Use parentObservationId filter instead</li>
227- * </ul>
228- * <p><strong>scores-numeric / scores-categorical views:</strong></p>
229- * <ul>
230- * <li><code>id</code> - Use specific filters to narrow down results</li>
231- * <li><code>traceId</code> - Use traceId filter instead</li>
232- * <li><code>userId</code> - Use userId filter instead</li>
233- * <li><code>sessionId</code> - Use sessionId filter instead</li>
234- * <li><code>observationId</code> - Use observationId filter instead</li>
235- * </ul>
236- * <h2>Aggregations</h2>
237- * <p>Available aggregation functions: <code>sum</code>, <code>avg</code>, <code>count</code>, <code>max</code>, <code>min</code>, <code>p50</code>, <code>p75</code>, <code>p90</code>, <code>p95</code>, <code>p99</code>, <code>histogram</code></p>
238- * <h2>Time Granularities</h2>
239- * <p>Available granularities for timeDimension: <code>auto</code>, <code>minute</code>, <code>hour</code>, <code>day</code>, <code>week</code>, <code>month</code></p>
240- * <ul>
241- * <li><code>auto</code> bins the data into approximately 50 buckets based on the time range</li>
242- * </ul>
24339 */
24440 public CompletableFuture <MetricsV2Response > metrics (GetMetricsV2Request request ,
24541 RequestOptions requestOptions ) {
0 commit comments