@llmops/app 1.0.0-beta.23 → 1.0.0-beta.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -14317,6 +14317,7 @@ function createTraceBatchWriter(deps, config$1 = {}) {
14317
14317
  log(`[TraceBatchWriter] Flushing ${batch.length} items`);
14318
14318
  const traceMap = /* @__PURE__ */ new Map();
14319
14319
  for (const item of batch) {
14320
+ if (!item.trace) continue;
14320
14321
  const existing = traceMap.get(item.trace.traceId);
14321
14322
  if (existing) {
14322
14323
  existing.spanCount = (existing.spanCount ?? 0) + (item.trace.spanCount ?? 1);
@@ -14552,6 +14553,7 @@ function createCostTrackingMiddleware(config$1 = {}) {
14552
14553
  return;
14553
14554
  }
14554
14555
  const waitUntil = c.get("llmopsConfig")?.waitUntil;
14556
+ const isInternalRequest = c.req.header(__llmops_core.LLMOPS_INTERNAL_HEADER) === "1";
14555
14557
  const batchWriter = getGlobalBatchWriter({ batchInsertRequests: (requests) => db.batchInsertRequests(requests) }, {
14556
14558
  flushIntervalMs,
14557
14559
  debug
@@ -14595,6 +14597,7 @@ function createCostTrackingMiddleware(config$1 = {}) {
14595
14597
  traceContext,
14596
14598
  batchWriter,
14597
14599
  traceBatchWriter,
14600
+ isInternalRequest,
14598
14601
  waitUntil,
14599
14602
  trackErrors,
14600
14603
  log
@@ -14661,6 +14664,7 @@ function createCostTrackingMiddleware(config$1 = {}) {
14661
14664
  traceContext,
14662
14665
  batchWriter,
14663
14666
  traceBatchWriter,
14667
+ isInternalRequest,
14664
14668
  waitUntil,
14665
14669
  trackErrors,
14666
14670
  log
@@ -14672,7 +14676,7 @@ function createCostTrackingMiddleware(config$1 = {}) {
14672
14676
  * Process usage data and log to batch writer
14673
14677
  */
14674
14678
  async function processUsageAndLog(params) {
14675
- const { requestId, provider, model, configId, variantId, environmentId, providerConfigId, endpoint, statusCode, latencyMs, isStreaming, usage, guardrailResults, tags = {}, input, output, traceContext, batchWriter, traceBatchWriter, waitUntil, trackErrors, log } = params;
14679
+ const { requestId, provider, model, configId, variantId, environmentId, providerConfigId, endpoint, statusCode, latencyMs, isStreaming, usage, guardrailResults, tags = {}, input, output, traceContext, batchWriter, traceBatchWriter, isInternalRequest = false, waitUntil, trackErrors, log } = params;
14676
14680
  if (!trackErrors && statusCode >= 400) {
14677
14681
  log(`Skipping error response (${statusCode})`);
14678
14682
  return;
@@ -14811,7 +14815,8 @@ async function processUsageAndLog(params) {
14811
14815
  tags,
14812
14816
  metadata: {}
14813
14817
  };
14814
- traceBatchWriter.enqueue({
14818
+ if (isInternalRequest) traceBatchWriter.enqueue({ span: spanData });
14819
+ else traceBatchWriter.enqueue({
14815
14820
  span: spanData,
14816
14821
  trace: traceData
14817
14822
  });
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Hono } from "hono";
2
- import { LLMOPS_REQUEST_ID_HEADER, LLMOPS_SESSION_ID_HEADER, LLMOPS_SPAN_ID_HEADER, LLMOPS_SPAN_NAME_HEADER, LLMOPS_TRACE_ID_HEADER, LLMOPS_TRACE_NAME_HEADER, LLMOPS_USER_ID_HEADER, SupportedProviders, calculateCacheAwareCost, getDefaultPricingProvider, logger, validateLLMOpsConfig } from "@llmops/core";
2
+ import { LLMOPS_INTERNAL_HEADER, LLMOPS_REQUEST_ID_HEADER, LLMOPS_SESSION_ID_HEADER, LLMOPS_SPAN_ID_HEADER, LLMOPS_SPAN_NAME_HEADER, LLMOPS_TRACE_ID_HEADER, LLMOPS_TRACE_NAME_HEADER, LLMOPS_USER_ID_HEADER, SupportedProviders, calculateCacheAwareCost, getDefaultPricingProvider, logger, validateLLMOpsConfig } from "@llmops/core";
3
3
  import { zValidator } from "@hono/zod-validator";
4
4
  import { COST_SUMMARY_GROUP_BY } from "@llmops/sdk";
5
5
  import { prettyJSON } from "hono/pretty-json";
@@ -14291,6 +14291,7 @@ function createTraceBatchWriter(deps, config$1 = {}) {
14291
14291
  log(`[TraceBatchWriter] Flushing ${batch.length} items`);
14292
14292
  const traceMap = /* @__PURE__ */ new Map();
14293
14293
  for (const item of batch) {
14294
+ if (!item.trace) continue;
14294
14295
  const existing = traceMap.get(item.trace.traceId);
14295
14296
  if (existing) {
14296
14297
  existing.spanCount = (existing.spanCount ?? 0) + (item.trace.spanCount ?? 1);
@@ -14526,6 +14527,7 @@ function createCostTrackingMiddleware(config$1 = {}) {
14526
14527
  return;
14527
14528
  }
14528
14529
  const waitUntil = c.get("llmopsConfig")?.waitUntil;
14530
+ const isInternalRequest = c.req.header(LLMOPS_INTERNAL_HEADER) === "1";
14529
14531
  const batchWriter = getGlobalBatchWriter({ batchInsertRequests: (requests) => db.batchInsertRequests(requests) }, {
14530
14532
  flushIntervalMs,
14531
14533
  debug
@@ -14569,6 +14571,7 @@ function createCostTrackingMiddleware(config$1 = {}) {
14569
14571
  traceContext,
14570
14572
  batchWriter,
14571
14573
  traceBatchWriter,
14574
+ isInternalRequest,
14572
14575
  waitUntil,
14573
14576
  trackErrors,
14574
14577
  log
@@ -14635,6 +14638,7 @@ function createCostTrackingMiddleware(config$1 = {}) {
14635
14638
  traceContext,
14636
14639
  batchWriter,
14637
14640
  traceBatchWriter,
14641
+ isInternalRequest,
14638
14642
  waitUntil,
14639
14643
  trackErrors,
14640
14644
  log
@@ -14646,7 +14650,7 @@ function createCostTrackingMiddleware(config$1 = {}) {
14646
14650
  * Process usage data and log to batch writer
14647
14651
  */
14648
14652
  async function processUsageAndLog(params) {
14649
- const { requestId, provider, model, configId, variantId, environmentId, providerConfigId, endpoint, statusCode, latencyMs, isStreaming, usage, guardrailResults, tags = {}, input, output, traceContext, batchWriter, traceBatchWriter, waitUntil, trackErrors, log } = params;
14653
+ const { requestId, provider, model, configId, variantId, environmentId, providerConfigId, endpoint, statusCode, latencyMs, isStreaming, usage, guardrailResults, tags = {}, input, output, traceContext, batchWriter, traceBatchWriter, isInternalRequest = false, waitUntil, trackErrors, log } = params;
14650
14654
  if (!trackErrors && statusCode >= 400) {
14651
14655
  log(`Skipping error response (${statusCode})`);
14652
14656
  return;
@@ -14785,7 +14789,8 @@ async function processUsageAndLog(params) {
14785
14789
  tags,
14786
14790
  metadata: {}
14787
14791
  };
14788
- traceBatchWriter.enqueue({
14792
+ if (isInternalRequest) traceBatchWriter.enqueue({ span: spanData });
14793
+ else traceBatchWriter.enqueue({
14789
14794
  span: spanData,
14790
14795
  trace: traceData
14791
14796
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llmops/app",
3
- "version": "1.0.0-beta.23",
3
+ "version": "1.0.0-beta.25",
4
4
  "description": "LLMOps application with server and client",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -75,9 +75,9 @@
75
75
  "react-hook-form": "^7.68.0",
76
76
  "recharts": "^3.6.0",
77
77
  "uuid": "^13.0.0",
78
- "@llmops/core": "^1.0.0-beta.23",
79
- "@llmops/sdk": "^1.0.0-beta.23",
80
- "@llmops/gateway": "^1.0.0-beta.23"
78
+ "@llmops/core": "^1.0.0-beta.25",
79
+ "@llmops/sdk": "^1.0.0-beta.25",
80
+ "@llmops/gateway": "^1.0.0-beta.25"
81
81
  },
82
82
  "peerDependencies": {
83
83
  "react": "^19.2.1",