@inkeep/agents-manage-ui 0.1.0
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/.env.sample +5 -0
- package/.turbo/turbo-build.log +93 -0
- package/.turbo/turbo-test.log +33 -0
- package/.turbo/turbo-typecheck.log +5 -0
- package/README.md +81 -0
- package/components.json +21 -0
- package/eslint.config.mjs +14 -0
- package/next.config.ts +23 -0
- package/package.json +93 -0
- package/postcss.config.mjs +5 -0
- package/public/assets/logo-outline.svg +4 -0
- package/public/assets/logo.svg +10 -0
- package/public/assets/provider-icons/1password.svg +6 -0
- package/public/assets/provider-icons/accelo.svg +1 -0
- package/public/assets/provider-icons/active-campaign.svg +1 -0
- package/public/assets/provider-icons/acuity-scheduling.svg +1 -0
- package/public/assets/provider-icons/adobe.svg +1 -0
- package/public/assets/provider-icons/adp.svg +1 -0
- package/public/assets/provider-icons/adyen.svg +1 -0
- package/public/assets/provider-icons/affinity.svg +1 -0
- package/public/assets/provider-icons/aircall.svg +1 -0
- package/public/assets/provider-icons/airtable.svg +1 -0
- package/public/assets/provider-icons/algolia.svg +1 -0
- package/public/assets/provider-icons/amazon.svg +1 -0
- package/public/assets/provider-icons/amplitude.svg +1 -0
- package/public/assets/provider-icons/anrok.svg +1 -0
- package/public/assets/provider-icons/anthropic.svg +1 -0
- package/public/assets/provider-icons/apaleo.svg +1 -0
- package/public/assets/provider-icons/apollo.svg +1 -0
- package/public/assets/provider-icons/apple-app-store.svg +1 -0
- package/public/assets/provider-icons/appstle-subscriptions.svg +1 -0
- package/public/assets/provider-icons/asana.svg +1 -0
- package/public/assets/provider-icons/ashby.svg +1 -0
- package/public/assets/provider-icons/atlas-so.svg +4 -0
- package/public/assets/provider-icons/atlassian.svg +1 -0
- package/public/assets/provider-icons/attio.svg +1 -0
- package/public/assets/provider-icons/auth0.svg +1 -0
- package/public/assets/provider-icons/autodesk.svg +1 -0
- package/public/assets/provider-icons/avalara.svg +1 -0
- package/public/assets/provider-icons/aws.svg +1 -0
- package/public/assets/provider-icons/azure-blob-storage.svg +1 -0
- package/public/assets/provider-icons/azure-devops.svg +6 -0
- package/public/assets/provider-icons/bamboohr.svg +1 -0
- package/public/assets/provider-icons/basecamp.svg +1 -0
- package/public/assets/provider-icons/battlenet.svg +1 -0
- package/public/assets/provider-icons/beehiiv.svg +1 -0
- package/public/assets/provider-icons/bigcommerce.svg +1 -0
- package/public/assets/provider-icons/bill-sandbox.svg +1 -0
- package/public/assets/provider-icons/bitbucket.svg +1 -0
- package/public/assets/provider-icons/bitdefender.svg +1 -0
- package/public/assets/provider-icons/bitly.svg +1 -0
- package/public/assets/provider-icons/blackbaud.svg +1 -0
- package/public/assets/provider-icons/blandai.svg +9 -0
- package/public/assets/provider-icons/boldsign.svg +1 -0
- package/public/assets/provider-icons/booking-com.svg +1 -0
- package/public/assets/provider-icons/box.svg +1 -0
- package/public/assets/provider-icons/braintree.svg +1 -0
- package/public/assets/provider-icons/braze.svg +1 -0
- package/public/assets/provider-icons/brevo-api-key.svg +3 -0
- package/public/assets/provider-icons/brex.svg +1 -0
- package/public/assets/provider-icons/brightcrowd.svg +1 -0
- package/public/assets/provider-icons/builder-io-public.svg +1 -0
- package/public/assets/provider-icons/buildium.svg +1 -0
- package/public/assets/provider-icons/builtwith.svg +1 -0
- package/public/assets/provider-icons/cal-com-v1.svg +4 -0
- package/public/assets/provider-icons/calendly.svg +1 -0
- package/public/assets/provider-icons/callrail.svg +1 -0
- package/public/assets/provider-icons/canny.svg +1 -0
- package/public/assets/provider-icons/canva-scim.svg +1 -0
- package/public/assets/provider-icons/certn.svg +5 -0
- package/public/assets/provider-icons/chargebee.svg +1 -0
- package/public/assets/provider-icons/chattermill.svg +1 -0
- package/public/assets/provider-icons/checkhq.svg +10 -0
- package/public/assets/provider-icons/checkout-com.svg +1 -0
- package/public/assets/provider-icons/checkr-partner.svg +1 -0
- package/public/assets/provider-icons/chorus.svg +1 -0
- package/public/assets/provider-icons/circle-so.svg +1 -0
- package/public/assets/provider-icons/clari-copilot.svg +1 -0
- package/public/assets/provider-icons/clicksend.svg +11 -0
- package/public/assets/provider-icons/clickup.svg +1 -0
- package/public/assets/provider-icons/close.svg +1 -0
- package/public/assets/provider-icons/cloudentity.svg +1 -0
- package/public/assets/provider-icons/coda.svg +1 -0
- package/public/assets/provider-icons/codeclimate.svg +1 -0
- package/public/assets/provider-icons/codegen.svg +1 -0
- package/public/assets/provider-icons/commercetools.svg +8 -0
- package/public/assets/provider-icons/companycam.svg +1 -0
- package/public/assets/provider-icons/confluence.svg +1 -0
- package/public/assets/provider-icons/connectwise-psa.svg +1 -0
- package/public/assets/provider-icons/contentful.svg +1 -0
- package/public/assets/provider-icons/contentstack.svg +1 -0
- package/public/assets/provider-icons/copper.svg +13 -0
- package/public/assets/provider-icons/coros.svg +20 -0
- package/public/assets/provider-icons/coupa-compass.svg +1 -0
- package/public/assets/provider-icons/cyberimpact.svg +1 -0
- package/public/assets/provider-icons/databricks-account.svg +1 -0
- package/public/assets/provider-icons/datadog.svg +1 -0
- package/public/assets/provider-icons/datev.svg +1 -0
- package/public/assets/provider-icons/deel.svg +1 -0
- package/public/assets/provider-icons/devin.svg +1 -0
- package/public/assets/provider-icons/dialpad.svg +1 -0
- package/public/assets/provider-icons/digitalocean.svg +1 -0
- package/public/assets/provider-icons/discord.svg +1 -0
- package/public/assets/provider-icons/discourse.svg +1 -0
- package/public/assets/provider-icons/dixa.svg +1 -0
- package/public/assets/provider-icons/document360.svg +6 -0
- package/public/assets/provider-icons/docusign.svg +1 -0
- package/public/assets/provider-icons/docuware.svg +1 -0
- package/public/assets/provider-icons/dropbox-sign.svg +6 -0
- package/public/assets/provider-icons/dropbox.svg +1 -0
- package/public/assets/provider-icons/drupal.svg +1 -0
- package/public/assets/provider-icons/e-conomic.svg +1 -0
- package/public/assets/provider-icons/ebay.svg +29 -0
- package/public/assets/provider-icons/egnyte.svg +1 -0
- package/public/assets/provider-icons/elevenlabs.svg +1 -0
- package/public/assets/provider-icons/elevio.svg +1 -0
- package/public/assets/provider-icons/emarsys.svg +1 -0
- package/public/assets/provider-icons/employment-hero.svg +1 -0
- package/public/assets/provider-icons/entrata.svg +1 -0
- package/public/assets/provider-icons/envoy.svg +1 -0
- package/public/assets/provider-icons/epic-games.svg +1 -0
- package/public/assets/provider-icons/evaluagent.svg +1 -0
- package/public/assets/provider-icons/eventbrite.svg +1 -0
- package/public/assets/provider-icons/exa.svg +1 -0
- package/public/assets/provider-icons/exact-online.svg +1 -0
- package/public/assets/provider-icons/exist.svg +1 -0
- package/public/assets/provider-icons/expensify.svg +1 -0
- package/public/assets/provider-icons/facebook.svg +1 -0
- package/public/assets/provider-icons/factorial.svg +1 -0
- package/public/assets/provider-icons/falai.svg +1 -0
- package/public/assets/provider-icons/fathom.svg +1 -0
- package/public/assets/provider-icons/figma.svg +1 -0
- package/public/assets/provider-icons/findymail.svg +1 -0
- package/public/assets/provider-icons/firefish.svg +1 -0
- package/public/assets/provider-icons/fireflies.svg +1 -0
- package/public/assets/provider-icons/fiserv.svg +1 -0
- package/public/assets/provider-icons/fitbit.svg +1 -0
- package/public/assets/provider-icons/fortnox.svg +1 -0
- package/public/assets/provider-icons/freshbooks.svg +1 -0
- package/public/assets/provider-icons/freshdesk.svg +1 -0
- package/public/assets/provider-icons/freshsales.svg +1 -0
- package/public/assets/provider-icons/freshservice.svg +1 -0
- package/public/assets/provider-icons/freshteam.svg +1 -0
- package/public/assets/provider-icons/front.svg +1 -0
- package/public/assets/provider-icons/gainsight-cc.svg +1 -0
- package/public/assets/provider-icons/garmin.svg +1 -0
- package/public/assets/provider-icons/gebruder-weiss.svg +6 -0
- package/public/assets/provider-icons/gem.svg +1 -0
- package/public/assets/provider-icons/gerrit.svg +1 -0
- package/public/assets/provider-icons/ghost-admin.svg +1 -0
- package/public/assets/provider-icons/github.svg +1 -0
- package/public/assets/provider-icons/gitlab.svg +1 -0
- package/public/assets/provider-icons/gong.svg +1 -0
- package/public/assets/provider-icons/google-ads.svg +1 -0
- package/public/assets/provider-icons/google-analytics.svg +1 -0
- package/public/assets/provider-icons/google-calendar.svg +1 -0
- package/public/assets/provider-icons/google-chat.svg +1 -0
- package/public/assets/provider-icons/google-cloud-storage.svg +1 -0
- package/public/assets/provider-icons/google-docs.svg +1 -0
- package/public/assets/provider-icons/google-drive.svg +1 -0
- package/public/assets/provider-icons/google-gemini.svg +1 -0
- package/public/assets/provider-icons/google-mail.svg +1 -0
- package/public/assets/provider-icons/google-play.svg +1 -0
- package/public/assets/provider-icons/google-sheet.svg +1 -0
- package/public/assets/provider-icons/google-slides.svg +97 -0
- package/public/assets/provider-icons/google.svg +1 -0
- package/public/assets/provider-icons/gorgias.svg +1 -0
- package/public/assets/provider-icons/grafana.svg +1 -0
- package/public/assets/provider-icons/grain.svg +1 -0
- package/public/assets/provider-icons/grammarly.svg +1 -0
- package/public/assets/provider-icons/greenhouse.svg +1 -0
- package/public/assets/provider-icons/gumroad.svg +1 -0
- package/public/assets/provider-icons/guru.svg +1 -0
- package/public/assets/provider-icons/gusto.svg +1 -0
- package/public/assets/provider-icons/hackerrank-work.svg +1 -0
- package/public/assets/provider-icons/harvest.svg +1 -0
- package/public/assets/provider-icons/health-gorilla.svg +1 -0
- package/public/assets/provider-icons/helpscout-mailbox.svg +1 -0
- package/public/assets/provider-icons/hibob-service-user.svg +1 -0
- package/public/assets/provider-icons/highlevel.svg +1 -0
- package/public/assets/provider-icons/holded.svg +1 -0
- package/public/assets/provider-icons/hubspot.svg +1 -0
- package/public/assets/provider-icons/incident-io.svg +1 -0
- package/public/assets/provider-icons/insightly.svg +3 -0
- package/public/assets/provider-icons/instagram.svg +1 -0
- package/public/assets/provider-icons/instantly.svg +1 -0
- package/public/assets/provider-icons/intercom.svg +1 -0
- package/public/assets/provider-icons/intuit.svg +1 -0
- package/public/assets/provider-icons/jamf.svg +1 -0
- package/public/assets/provider-icons/jazzhr.svg +9 -0
- package/public/assets/provider-icons/jira.svg +1 -0
- package/public/assets/provider-icons/jobadder.svg +3 -0
- package/public/assets/provider-icons/jobvite.svg +1 -0
- package/public/assets/provider-icons/jotform.svg +1 -0
- package/public/assets/provider-icons/kandji.svg +1 -0
- package/public/assets/provider-icons/keap.svg +1 -0
- package/public/assets/provider-icons/keeper-scim.svg +1 -0
- package/public/assets/provider-icons/klaviyo.svg +1 -0
- package/public/assets/provider-icons/klipfolio.svg +1 -0
- package/public/assets/provider-icons/knowbe4.svg +1 -0
- package/public/assets/provider-icons/kustomer.svg +1 -0
- package/public/assets/provider-icons/lagrowthmachine.svg +1 -0
- package/public/assets/provider-icons/lastpass.svg +1 -0
- package/public/assets/provider-icons/lattice.svg +245 -0
- package/public/assets/provider-icons/lemlist.svg +1 -0
- package/public/assets/provider-icons/lessonly.svg +1 -0
- package/public/assets/provider-icons/lever.svg +1 -0
- package/public/assets/provider-icons/linear.svg +1 -0
- package/public/assets/provider-icons/linkedin.svg +12 -0
- package/public/assets/provider-icons/linkhut.svg +1 -0
- package/public/assets/provider-icons/listmonk.svg +1 -0
- package/public/assets/provider-icons/loom.svg +6 -0
- package/public/assets/provider-icons/loops-so.svg +1 -0
- package/public/assets/provider-icons/lucid.svg +1 -0
- package/public/assets/provider-icons/luma.svg +1 -0
- package/public/assets/provider-icons/mailchimp.svg +1 -0
- package/public/assets/provider-icons/mailgun.svg +1 -0
- package/public/assets/provider-icons/make.svg +1 -0
- package/public/assets/provider-icons/malwarebytes.svg +1 -0
- package/public/assets/provider-icons/manatal.svg +1 -0
- package/public/assets/provider-icons/marketo.svg +1 -0
- package/public/assets/provider-icons/medallia.svg +1 -0
- package/public/assets/provider-icons/metabase.svg +1 -0
- package/public/assets/provider-icons/microsoft-ads.svg +1 -0
- package/public/assets/provider-icons/microsoft-business-central.svg +1 -0
- package/public/assets/provider-icons/microsoft-entra-id.svg +1 -0
- package/public/assets/provider-icons/microsoft-power-bi.svg +1 -0
- package/public/assets/provider-icons/microsoft-teams.svg +1 -0
- package/public/assets/provider-icons/microsoft-tenant-specific.svg +1 -0
- package/public/assets/provider-icons/microsoft.svg +1 -0
- package/public/assets/provider-icons/mindbody.svg +1 -0
- package/public/assets/provider-icons/minimax.svg +12 -0
- package/public/assets/provider-icons/mip-cloud.svg +30 -0
- package/public/assets/provider-icons/mip.svg +30 -0
- package/public/assets/provider-icons/miro.svg +1 -0
- package/public/assets/provider-icons/missive.svg +7 -0
- package/public/assets/provider-icons/mixpanel.svg +1 -0
- package/public/assets/provider-icons/monday.svg +1 -0
- package/public/assets/provider-icons/mural.svg +1 -0
- package/public/assets/provider-icons/namely-pat.svg +1 -0
- package/public/assets/provider-icons/nationbuilder.svg +1 -0
- package/public/assets/provider-icons/netsuite.svg +1 -0
- package/public/assets/provider-icons/next-cloud-ocs.svg +9 -0
- package/public/assets/provider-icons/notion.svg +1 -0
- package/public/assets/provider-icons/odoo.svg +1 -0
- package/public/assets/provider-icons/okta.svg +1 -0
- package/public/assets/provider-icons/one-drive.svg +1 -0
- package/public/assets/provider-icons/one-note.svg +1 -0
- package/public/assets/provider-icons/open-hands.svg +9 -0
- package/public/assets/provider-icons/openai.svg +1 -0
- package/public/assets/provider-icons/oracle-hcm.svg +1 -0
- package/public/assets/provider-icons/ory.svg +1 -0
- package/public/assets/provider-icons/osu.svg +1 -0
- package/public/assets/provider-icons/oura.svg +1 -0
- package/public/assets/provider-icons/outlook.svg +1 -0
- package/public/assets/provider-icons/outreach.svg +1 -0
- package/public/assets/provider-icons/pagerduty.svg +1 -0
- package/public/assets/provider-icons/pandadoc.svg +1 -0
- package/public/assets/provider-icons/paychex.svg +1 -0
- package/public/assets/provider-icons/paycom.svg +1 -0
- package/public/assets/provider-icons/payfit.svg +1 -0
- package/public/assets/provider-icons/paylocity.svg +17 -0
- package/public/assets/provider-icons/paypal.svg +1 -0
- package/public/assets/provider-icons/pendo.svg +1 -0
- package/public/assets/provider-icons/pennylane.svg +1 -0
- package/public/assets/provider-icons/peopledatalabs.svg +1 -0
- package/public/assets/provider-icons/perimeter81.svg +1 -0
- package/public/assets/provider-icons/perplexity.svg +1 -0
- package/public/assets/provider-icons/personio.svg +1 -0
- package/public/assets/provider-icons/pingboard.svg +1 -0
- package/public/assets/provider-icons/pinterest.svg +1 -0
- package/public/assets/provider-icons/pipedrive.svg +1 -0
- package/public/assets/provider-icons/pivotaltracker.svg +1 -0
- package/public/assets/provider-icons/plain.svg +63 -0
- package/public/assets/provider-icons/podium.svg +1 -0
- package/public/assets/provider-icons/posthog.svg +1 -0
- package/public/assets/provider-icons/precisefp.svg +13 -0
- package/public/assets/provider-icons/prive.svg +1 -0
- package/public/assets/provider-icons/productboard.svg +1 -0
- package/public/assets/provider-icons/qualtrics.svg +1 -0
- package/public/assets/provider-icons/quickbase.svg +26 -0
- package/public/assets/provider-icons/quickbooks.svg +1 -0
- package/public/assets/provider-icons/ragieai.svg +1 -0
- package/public/assets/provider-icons/ramp.svg +1 -0
- package/public/assets/provider-icons/rapidapi.svg +1 -0
- package/public/assets/provider-icons/razorpay.svg +1 -0
- package/public/assets/provider-icons/readwise.svg +1 -0
- package/public/assets/provider-icons/recharge.svg +1 -0
- package/public/assets/provider-icons/recruitcrm.svg +1 -0
- package/public/assets/provider-icons/recruiterflow.svg +9 -0
- package/public/assets/provider-icons/reddit.svg +1 -0
- package/public/assets/provider-icons/redtail-crm-sandbox.svg +1 -0
- package/public/assets/provider-icons/refiner.svg +1 -0
- package/public/assets/provider-icons/replicate.svg +1 -0
- package/public/assets/provider-icons/retell-ai.svg +7 -0
- package/public/assets/provider-icons/ring-central.svg +1 -0
- package/public/assets/provider-icons/rippling.svg +1 -0
- package/public/assets/provider-icons/roam-scim.svg +12 -0
- package/public/assets/provider-icons/rock-gym-pro.svg +33 -0
- package/public/assets/provider-icons/rootly.svg +1 -0
- package/public/assets/provider-icons/sage-hr.svg +1 -0
- package/public/assets/provider-icons/sage.svg +1 -0
- package/public/assets/provider-icons/salesforce.svg +1 -0
- package/public/assets/provider-icons/salesloft.svg +1 -0
- package/public/assets/provider-icons/sap-concur.svg +8 -0
- package/public/assets/provider-icons/sap-success-factors.svg +1 -0
- package/public/assets/provider-icons/scrapedo.svg +14 -0
- package/public/assets/provider-icons/sedna.svg +1 -0
- package/public/assets/provider-icons/segment.svg +1 -0
- package/public/assets/provider-icons/sendgrid.svg +1 -0
- package/public/assets/provider-icons/sentry.svg +1 -0
- package/public/assets/provider-icons/servicem8.svg +1 -0
- package/public/assets/provider-icons/servicenow.svg +1 -0
- package/public/assets/provider-icons/setmore.svg +1 -0
- package/public/assets/provider-icons/sharepoint-online.svg +1 -0
- package/public/assets/provider-icons/shipstation.svg +1 -0
- package/public/assets/provider-icons/shopify.svg +1 -0
- package/public/assets/provider-icons/shortcut.svg +1 -0
- package/public/assets/provider-icons/signnow.svg +1 -0
- package/public/assets/provider-icons/slack.svg +1 -0
- package/public/assets/provider-icons/smartlead-ai.svg +1 -0
- package/public/assets/provider-icons/smartrecruiters-api-key.svg +1 -0
- package/public/assets/provider-icons/smartsheet.svg +1 -0
- package/public/assets/provider-icons/smugmug.svg +1 -0
- package/public/assets/provider-icons/snowflake.svg +1 -0
- package/public/assets/provider-icons/splitwise.svg +1 -0
- package/public/assets/provider-icons/spotify.svg +1 -0
- package/public/assets/provider-icons/squarespace.svg +1 -0
- package/public/assets/provider-icons/squareup.svg +1 -0
- package/public/assets/provider-icons/stackexchange.svg +1 -0
- package/public/assets/provider-icons/strava.svg +1 -0
- package/public/assets/provider-icons/stripe-express.svg +1 -0
- package/public/assets/provider-icons/stripe.svg +1 -0
- package/public/assets/provider-icons/supabase.svg +15 -0
- package/public/assets/provider-icons/survey-monkey.svg +1 -0
- package/public/assets/provider-icons/tableau.svg +1 -0
- package/public/assets/provider-icons/tapclicks.svg +1 -0
- package/public/assets/provider-icons/teamtailor.svg +1 -0
- package/public/assets/provider-icons/teamwork.svg +1 -0
- package/public/assets/provider-icons/terraform.svg +1 -0
- package/public/assets/provider-icons/thrivecart-api-key.svg +1 -0
- package/public/assets/provider-icons/thrivecart-oauth.svg +1 -0
- package/public/assets/provider-icons/ticktick.svg +1 -0
- package/public/assets/provider-icons/tiktok-ads.svg +1 -0
- package/public/assets/provider-icons/timely.svg +1 -0
- package/public/assets/provider-icons/tldv.svg +1 -0
- package/public/assets/provider-icons/todoist.svg +1 -0
- package/public/assets/provider-icons/trafft.svg +35 -0
- package/public/assets/provider-icons/trakstar-hire.svg +2 -0
- package/public/assets/provider-icons/trello.svg +1 -0
- package/public/assets/provider-icons/tremendous-sandbox.svg +1 -0
- package/public/assets/provider-icons/tsheetsteam.svg +1 -0
- package/public/assets/provider-icons/tumblr.svg +1 -0
- package/public/assets/provider-icons/twenty-crm.svg +1 -0
- package/public/assets/provider-icons/twilio.svg +1 -0
- package/public/assets/provider-icons/twinfield.svg +1 -0
- package/public/assets/provider-icons/twitch.svg +1 -0
- package/public/assets/provider-icons/twitter.svg +1 -0
- package/public/assets/provider-icons/typeform.svg +1 -0
- package/public/assets/provider-icons/typefully.svg +1 -0
- package/public/assets/provider-icons/uber.svg +1 -0
- package/public/assets/provider-icons/ukg-pro-wfm.svg +2 -0
- package/public/assets/provider-icons/ukg-pro.svg +2 -0
- package/public/assets/provider-icons/ukg-ready.svg +2 -0
- package/public/assets/provider-icons/unanet.svg +1 -0
- package/public/assets/provider-icons/unauthenticated.svg +6 -0
- package/public/assets/provider-icons/unipile.svg +9 -0
- package/public/assets/provider-icons/vercel.svg +1 -0
- package/public/assets/provider-icons/vimeo.svg +1 -0
- package/public/assets/provider-icons/wakatime.svg +1 -0
- package/public/assets/provider-icons/wave-accounting.svg +1 -0
- package/public/assets/provider-icons/wealthbox.svg +1 -0
- package/public/assets/provider-icons/webflow.svg +1 -0
- package/public/assets/provider-icons/whatsapp-business.svg +1 -0
- package/public/assets/provider-icons/whoop.svg +1 -0
- package/public/assets/provider-icons/wildix-pbx.svg +1 -0
- package/public/assets/provider-icons/woocommerce.svg +1 -0
- package/public/assets/provider-icons/wordpress.svg +1 -0
- package/public/assets/provider-icons/workable.svg +1 -0
- package/public/assets/provider-icons/workday.svg +1 -0
- package/public/assets/provider-icons/wrike.svg +1 -0
- package/public/assets/provider-icons/xai.svg +1 -0
- package/public/assets/provider-icons/xero.svg +1 -0
- package/public/assets/provider-icons/yahoo.svg +1 -0
- package/public/assets/provider-icons/yandex.svg +1 -0
- package/public/assets/provider-icons/youtube.svg +1 -0
- package/public/assets/provider-icons/zapier-nla.svg +1 -0
- package/public/assets/provider-icons/zendesk.svg +1 -0
- package/public/assets/provider-icons/zenefits.svg +1 -0
- package/public/assets/provider-icons/zoho-bigin.svg +1 -0
- package/public/assets/provider-icons/zoho-books.svg +1 -0
- package/public/assets/provider-icons/zoho-crm.svg +1 -0
- package/public/assets/provider-icons/zoho-desk.svg +1 -0
- package/public/assets/provider-icons/zoho-inventory.svg +1 -0
- package/public/assets/provider-icons/zoho-invoice.svg +1 -0
- package/public/assets/provider-icons/zoho-mail.svg +1 -0
- package/public/assets/provider-icons/zoho-people.svg +1 -0
- package/public/assets/provider-icons/zoho.svg +1 -0
- package/public/assets/provider-icons/zoom.svg +1 -0
- package/public/assets/provider-icons/zoominfo.svg +1 -0
- package/public/assets/provider-icons/zuora.svg +1 -0
- package/src/app/[tenantId]/page.tsx +8 -0
- package/src/app/[tenantId]/projects/[projectId]/api-keys/error.tsx +7 -0
- package/src/app/[tenantId]/projects/[projectId]/api-keys/page.tsx +62 -0
- package/src/app/[tenantId]/projects/[projectId]/artifact-components/[artifactComponentId]/error.tsx +18 -0
- package/src/app/[tenantId]/projects/[projectId]/artifact-components/[artifactComponentId]/page.tsx +44 -0
- package/src/app/[tenantId]/projects/[projectId]/artifact-components/error.tsx +7 -0
- package/src/app/[tenantId]/projects/[projectId]/artifact-components/loading.tsx +20 -0
- package/src/app/[tenantId]/projects/[projectId]/artifact-components/new/page.tsx +30 -0
- package/src/app/[tenantId]/projects/[projectId]/artifact-components/page.tsx +69 -0
- package/src/app/[tenantId]/projects/[projectId]/credentials/[credentialId]/page.tsx +64 -0
- package/src/app/[tenantId]/projects/[projectId]/credentials/error.tsx +7 -0
- package/src/app/[tenantId]/projects/[projectId]/credentials/new/bearer/page.tsx +28 -0
- package/src/app/[tenantId]/projects/[projectId]/credentials/new/page.tsx +78 -0
- package/src/app/[tenantId]/projects/[projectId]/credentials/new/providers/[providerId]/page.tsx +192 -0
- package/src/app/[tenantId]/projects/[projectId]/credentials/new/providers/page.tsx +60 -0
- package/src/app/[tenantId]/projects/[projectId]/credentials/page.tsx +67 -0
- package/src/app/[tenantId]/projects/[projectId]/data-components/[dataComponentId]/error.tsx +18 -0
- package/src/app/[tenantId]/projects/[projectId]/data-components/[dataComponentId]/page.tsx +40 -0
- package/src/app/[tenantId]/projects/[projectId]/data-components/error.tsx +7 -0
- package/src/app/[tenantId]/projects/[projectId]/data-components/loading.tsx +20 -0
- package/src/app/[tenantId]/projects/[projectId]/data-components/new/page.tsx +27 -0
- package/src/app/[tenantId]/projects/[projectId]/data-components/page.tsx +66 -0
- package/src/app/[tenantId]/projects/[projectId]/graphs/[graphId]/error.tsx +21 -0
- package/src/app/[tenantId]/projects/[projectId]/graphs/[graphId]/loading.tsx +29 -0
- package/src/app/[tenantId]/projects/[projectId]/graphs/[graphId]/page.tsx +52 -0
- package/src/app/[tenantId]/projects/[projectId]/graphs/error.tsx +7 -0
- package/src/app/[tenantId]/projects/[projectId]/graphs/loading.tsx +20 -0
- package/src/app/[tenantId]/projects/[projectId]/graphs/new/page.tsx +45 -0
- package/src/app/[tenantId]/projects/[projectId]/graphs/page.tsx +50 -0
- package/src/app/[tenantId]/projects/[projectId]/mcp-servers/[mcpServerId]/edit/page.tsx +91 -0
- package/src/app/[tenantId]/projects/[projectId]/mcp-servers/[mcpServerId]/page.tsx +38 -0
- package/src/app/[tenantId]/projects/[projectId]/mcp-servers/new/layout.tsx +22 -0
- package/src/app/[tenantId]/projects/[projectId]/mcp-servers/new/page.tsx +24 -0
- package/src/app/[tenantId]/projects/[projectId]/mcp-servers/page.tsx +61 -0
- package/src/app/[tenantId]/projects/[projectId]/page.tsx +12 -0
- package/src/app/[tenantId]/projects/[projectId]/traces/ai-calls/page.tsx +40 -0
- package/src/app/[tenantId]/projects/[projectId]/traces/conversations/[conversationId]/page.tsx +32 -0
- package/src/app/[tenantId]/projects/[projectId]/traces/page.tsx +20 -0
- package/src/app/[tenantId]/projects/error.tsx +7 -0
- package/src/app/[tenantId]/projects/loading.tsx +20 -0
- package/src/app/[tenantId]/projects/page.tsx +61 -0
- package/src/app/api/signoz/conversations/[conversationId]/route.ts +863 -0
- package/src/app/api/signoz/route.ts +115 -0
- package/src/app/favicon.ico +0 -0
- package/src/app/globals.css +261 -0
- package/src/app/icon.svg +5 -0
- package/src/app/layout.tsx +59 -0
- package/src/app/page.tsx +13 -0
- package/src/app/utils/__tests__/format-date.test.ts +133 -0
- package/src/app/utils/active-tools.ts +24 -0
- package/src/app/utils/format-date.ts +95 -0
- package/src/components/api-keys/api-key-display.tsx +57 -0
- package/src/components/api-keys/api-key-item-menu.tsx +54 -0
- package/src/components/api-keys/api-keys-table.tsx +77 -0
- package/src/components/api-keys/delete-api-key-confirmation.tsx +45 -0
- package/src/components/api-keys/expiration-indicator.tsx +86 -0
- package/src/components/api-keys/form/api-key-form.tsx +120 -0
- package/src/components/api-keys/form/form-configuration.tsx +7 -0
- package/src/components/api-keys/form/validation.ts +20 -0
- package/src/components/api-keys/new-api-key-dialog.tsx +84 -0
- package/src/components/artifact-components/artifact-component-item-menu.tsx +61 -0
- package/src/components/artifact-components/artifact-component-item.tsx +42 -0
- package/src/components/artifact-components/artifact-component-list.tsx +27 -0
- package/src/components/artifact-components/delete-artifact-component-confirmation.tsx +45 -0
- package/src/components/artifact-components/form/artifact-component-form.tsx +127 -0
- package/src/components/artifact-components/form/form-configuration.tsx +9 -0
- package/src/components/artifact-components/form/validation.ts +42 -0
- package/src/components/credentials/credential-item.tsx +124 -0
- package/src/components/credentials/credential-tools-list.tsx +111 -0
- package/src/components/credentials/credentials-list.tsx +36 -0
- package/src/components/credentials/views/auth-form-config.ts +202 -0
- package/src/components/credentials/views/credential-form-validation.ts +14 -0
- package/src/components/credentials/views/credential-form.tsx +203 -0
- package/src/components/credentials/views/edit-credential-form.tsx +177 -0
- package/src/components/credentials/views/generic-auth-form.tsx +194 -0
- package/src/components/credentials/views/nango-providers-grid.tsx +136 -0
- package/src/components/credentials/views/new-credential-form.tsx +60 -0
- package/src/components/data-components/data-component-item-menu.tsx +61 -0
- package/src/components/data-components/data-component-item.tsx +42 -0
- package/src/components/data-components/data-components-list.tsx +27 -0
- package/src/components/data-components/delete-data-component-confirmation.tsx +45 -0
- package/src/components/data-components/form/data-component-form.tsx +113 -0
- package/src/components/data-components/form/form-configuration.ts +8 -0
- package/src/components/data-components/form/validation.ts +38 -0
- package/src/components/errors/full-page-error.tsx +37 -0
- package/src/components/form/expandable-field.tsx +72 -0
- package/src/components/form/expandable-json-editor.tsx +139 -0
- package/src/components/form/form-field-wrapper.tsx +47 -0
- package/src/components/form/generic-combo-box.tsx +94 -0
- package/src/components/form/generic-input.tsx +51 -0
- package/src/components/form/generic-key-value-input.tsx +146 -0
- package/src/components/form/generic-select.tsx +56 -0
- package/src/components/form/generic-textarea.tsx +39 -0
- package/src/components/form/json-editor.tsx +47 -0
- package/src/components/form/json-schema-input.tsx +39 -0
- package/src/components/form/standalone-json-editor.tsx +71 -0
- package/src/components/graph/configuration/edge-types.tsx +42 -0
- package/src/components/graph/configuration/graph-types.tsx +51 -0
- package/src/components/graph/configuration/model-options.tsx +39 -0
- package/src/components/graph/configuration/node-types.tsx +95 -0
- package/src/components/graph/edges/agent-to-agent-edge.tsx +146 -0
- package/src/components/graph/edges/default-edge.tsx +38 -0
- package/src/components/graph/error-display/error-indicator.tsx +50 -0
- package/src/components/graph/error-display/graph-error-summary.tsx +181 -0
- package/src/components/graph/graph.tsx +540 -0
- package/src/components/graph/markers/default-marker.tsx +28 -0
- package/src/components/graph/markers/selected-marker.tsx +28 -0
- package/src/components/graph/node-library/node-item.tsx +39 -0
- package/src/components/graph/node-library/node-library.tsx +20 -0
- package/src/components/graph/nodes/agent-node.tsx +125 -0
- package/src/components/graph/nodes/base-node.tsx +88 -0
- package/src/components/graph/nodes/external-agent-node.tsx +55 -0
- package/src/components/graph/nodes/handle.tsx +14 -0
- package/src/components/graph/nodes/mcp-node.tsx +37 -0
- package/src/components/graph/nodes/mcp-placeholder-node.tsx +23 -0
- package/src/components/graph/nodes/node-tab.tsx +21 -0
- package/src/components/graph/playground/chat-widget.tsx +202 -0
- package/src/components/graph/playground/ikp-message.tsx +575 -0
- package/src/components/graph/playground/playground.tsx +66 -0
- package/src/components/graph/sidepane/edges/edge-editor.tsx +135 -0
- package/src/components/graph/sidepane/heading.tsx +17 -0
- package/src/components/graph/sidepane/metadata/context-config.tsx +82 -0
- package/src/components/graph/sidepane/metadata/metadata-editor.tsx +644 -0
- package/src/components/graph/sidepane/nodes/agent-node-editor.tsx +196 -0
- package/src/components/graph/sidepane/nodes/component-selector/component-dropdown.tsx +100 -0
- package/src/components/graph/sidepane/nodes/component-selector/component-header.tsx +18 -0
- package/src/components/graph/sidepane/nodes/component-selector/component-selector.tsx +62 -0
- package/src/components/graph/sidepane/nodes/component-selector/selected-components.tsx +44 -0
- package/src/components/graph/sidepane/nodes/empty-state.tsx +29 -0
- package/src/components/graph/sidepane/nodes/expandable-text-area.tsx +30 -0
- package/src/components/graph/sidepane/nodes/external-agent-node-editor.tsx +76 -0
- package/src/components/graph/sidepane/nodes/form-fields.tsx +117 -0
- package/src/components/graph/sidepane/nodes/mcp-node-editor.tsx +140 -0
- package/src/components/graph/sidepane/nodes/mcp-selector/loading.tsx +20 -0
- package/src/components/graph/sidepane/nodes/mcp-selector/mcp-selector.tsx +93 -0
- package/src/components/graph/sidepane/nodes/mcp-selector/mcp-server-item.tsx +57 -0
- package/src/components/graph/sidepane/nodes/model-section.tsx +202 -0
- package/src/components/graph/sidepane/nodes/model-selector.tsx +157 -0
- package/src/components/graph/sidepane/sidepane.tsx +156 -0
- package/src/components/graph/toolbar/toolbar.tsx +61 -0
- package/src/components/graphs/delete-graph-confirmation.tsx +46 -0
- package/src/components/graphs/graph-item-menu.tsx +54 -0
- package/src/components/graphs/graph-item.tsx +47 -0
- package/src/components/graphs/graph-list.tsx +20 -0
- package/src/components/graphs/new-graph-item.tsx +23 -0
- package/src/components/icons/anthropic.tsx +21 -0
- package/src/components/icons/dashed-spline.tsx +31 -0
- package/src/components/icons/empty-state/conversations.tsx +24 -0
- package/src/components/icons/empty-state/credentials.tsx +85 -0
- package/src/components/icons/empty-state/default.tsx +57 -0
- package/src/components/icons/empty-state/graphs.tsx +58 -0
- package/src/components/icons/mcp-icon.tsx +24 -0
- package/src/components/icons/openai.tsx +14 -0
- package/src/components/icons/provider-icon.tsx +91 -0
- package/src/components/layout/body-template.tsx +19 -0
- package/src/components/layout/empty-state.tsx +56 -0
- package/src/components/layout/main-content.tsx +14 -0
- package/src/components/layout/page-header.tsx +77 -0
- package/src/components/layout/sidepane.tsx +81 -0
- package/src/components/layout/site-content.tsx +7 -0
- package/src/components/layout/site-header.tsx +24 -0
- package/src/components/logo.tsx +48 -0
- package/src/components/mcp-servers/available-tools-card.tsx +122 -0
- package/src/components/mcp-servers/form/active-tools-selector.tsx +256 -0
- package/src/components/mcp-servers/form/mcp-server-form.tsx +161 -0
- package/src/components/mcp-servers/form/validation.ts +32 -0
- package/src/components/mcp-servers/mcp-tool-image.tsx +78 -0
- package/src/components/mcp-servers/mcp-tool-item.tsx +205 -0
- package/src/components/mcp-servers/mcp-tools-list.tsx +21 -0
- package/src/components/mcp-servers/view-mcp-server-details.tsx +261 -0
- package/src/components/projects/delete-project-confirmation.tsx +51 -0
- package/src/components/projects/edit-project-dialog.tsx +51 -0
- package/src/components/projects/form/form-configuration.ts +16 -0
- package/src/components/projects/form/project-form.tsx +122 -0
- package/src/components/projects/form/project-models-section.tsx +175 -0
- package/src/components/projects/form/project-stopwhen-section.tsx +89 -0
- package/src/components/projects/form/validation.ts +39 -0
- package/src/components/projects/new-project-dialog.tsx +68 -0
- package/src/components/projects/project-item-menu.tsx +73 -0
- package/src/components/projects/project-item.tsx +53 -0
- package/src/components/projects/project-list.tsx +17 -0
- package/src/components/sidebar-nav/nav-group.tsx +22 -0
- package/src/components/sidebar-nav/nav-item.tsx +32 -0
- package/src/components/sidebar-nav/project-selector.tsx +113 -0
- package/src/components/sidebar-nav/project-switcher.tsx +73 -0
- package/src/components/sidebar-nav/sidebar-nav.tsx +126 -0
- package/src/components/theme-provider.tsx +8 -0
- package/src/components/theme-toggle.tsx +62 -0
- package/src/components/traces/ai-calls-breakdown.tsx +462 -0
- package/src/components/traces/charts/area-chart-card.tsx +41 -0
- package/src/components/traces/charts/area-chart.tsx +98 -0
- package/src/components/traces/charts/chart-card.tsx +98 -0
- package/src/components/traces/charts/chart-error.tsx +7 -0
- package/src/components/traces/charts/chart-no-results.tsx +7 -0
- package/src/components/traces/charts/stat-card.tsx +45 -0
- package/src/components/traces/charts/stat.tsx +36 -0
- package/src/components/traces/conversation-detail.tsx +275 -0
- package/src/components/traces/conversation-errors.tsx +312 -0
- package/src/components/traces/conversation-stats/conversation-list-item.tsx +91 -0
- package/src/components/traces/conversation-stats/conversation-stats-card.tsx +242 -0
- package/src/components/traces/conversation-stats/loading-skeleton.tsx +31 -0
- package/src/components/traces/filters/date-picker.tsx +173 -0
- package/src/components/traces/filters/filter-trigger.tsx +92 -0
- package/src/components/traces/filters/graph-filter.tsx +71 -0
- package/src/components/traces/signoz-link.tsx +152 -0
- package/src/components/traces/timeline/activity-details-sidepane.tsx +34 -0
- package/src/components/traces/timeline/activity-timeline.tsx +31 -0
- package/src/components/traces/timeline/blocks.tsx +66 -0
- package/src/components/traces/timeline/bubble.tsx +44 -0
- package/src/components/traces/timeline/flow.tsx +16 -0
- package/src/components/traces/timeline/render-panel-content.tsx +362 -0
- package/src/components/traces/timeline/tag-row.tsx +14 -0
- package/src/components/traces/timeline/timeline-item.tsx +394 -0
- package/src/components/traces/timeline/timeline-wrapper.tsx +293 -0
- package/src/components/traces/timeline/types.ts +154 -0
- package/src/components/traces/traces-overview.tsx +730 -0
- package/src/components/ui/alert-dialog.tsx +134 -0
- package/src/components/ui/badge.tsx +46 -0
- package/src/components/ui/breadcrumbs.tsx +35 -0
- package/src/components/ui/button.tsx +66 -0
- package/src/components/ui/calendar.tsx +177 -0
- package/src/components/ui/card-grid.tsx +68 -0
- package/src/components/ui/card.tsx +75 -0
- package/src/components/ui/chart.tsx +322 -0
- package/src/components/ui/checkbox.tsx +29 -0
- package/src/components/ui/clickable-card.tsx +65 -0
- package/src/components/ui/collapsible.tsx +21 -0
- package/src/components/ui/combobox.tsx +145 -0
- package/src/components/ui/command.tsx +163 -0
- package/src/components/ui/copy-button.tsx +43 -0
- package/src/components/ui/copyable-single-line-code.tsx +14 -0
- package/src/components/ui/delete-confirmation.tsx +53 -0
- package/src/components/ui/dialog.tsx +131 -0
- package/src/components/ui/dropdown-menu.tsx +228 -0
- package/src/components/ui/external-link.tsx +22 -0
- package/src/components/ui/form.tsx +151 -0
- package/src/components/ui/inheritance-indicator.tsx +264 -0
- package/src/components/ui/input.tsx +21 -0
- package/src/components/ui/item-card-grid.tsx +101 -0
- package/src/components/ui/item-card.tsx +112 -0
- package/src/components/ui/label.tsx +21 -0
- package/src/components/ui/popover.tsx +51 -0
- package/src/components/ui/resizable.tsx +56 -0
- package/src/components/ui/scroll-area.tsx +56 -0
- package/src/components/ui/select.tsx +170 -0
- package/src/components/ui/separator.tsx +28 -0
- package/src/components/ui/sheet.tsx +130 -0
- package/src/components/ui/sidebar.tsx +695 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/components/ui/sonner.tsx +25 -0
- package/src/components/ui/svg-icon.tsx +49 -0
- package/src/components/ui/switch.tsx +26 -0
- package/src/components/ui/table.tsx +100 -0
- package/src/components/ui/textarea.tsx +18 -0
- package/src/components/ui/tooltip.tsx +57 -0
- package/src/constants/page-descriptions.tsx +53 -0
- package/src/constants/signoz.ts +280 -0
- package/src/features/graph/commands/command-manager.ts +67 -0
- package/src/features/graph/commands/commands.ts +123 -0
- package/src/features/graph/domain/__tests__/roundtrip.test.ts +75 -0
- package/src/features/graph/domain/__tests__/serialize.test.ts +196 -0
- package/src/features/graph/domain/deserialize.ts +266 -0
- package/src/features/graph/domain/index.ts +2 -0
- package/src/features/graph/domain/serialize.ts +314 -0
- package/src/features/graph/state/use-graph-store.ts +208 -0
- package/src/features/graph/ui/use-graph-shortcuts.ts +41 -0
- package/src/hooks/use-ai-calls-query-state.ts +55 -0
- package/src/hooks/use-chat-activities-polling.ts +145 -0
- package/src/hooks/use-copy-to-clipboard.tsx +31 -0
- package/src/hooks/use-cursor-to-end.ts +48 -0
- package/src/hooks/use-disclosure.ts +15 -0
- package/src/hooks/use-graph-errors.ts +98 -0
- package/src/hooks/use-mobile.ts +19 -0
- package/src/hooks/use-nango-connect.ts +42 -0
- package/src/hooks/use-nango-providers.ts +32 -0
- package/src/hooks/use-node-editor.ts +141 -0
- package/src/hooks/use-project-data.ts +47 -0
- package/src/hooks/use-side-pane.ts +20 -0
- package/src/hooks/use-traces-query-state.ts +88 -0
- package/src/hooks/use-traces.ts +240 -0
- package/src/lib/README.md +145 -0
- package/src/lib/actions/api-keys.ts +99 -0
- package/src/lib/actions/artifact-components.ts +143 -0
- package/src/lib/actions/credentials.ts +42 -0
- package/src/lib/actions/data-components.ts +143 -0
- package/src/lib/actions/graph-full.ts +221 -0
- package/src/lib/actions/projects.ts +168 -0
- package/src/lib/actions/tools.ts +42 -0
- package/src/lib/actions/types.ts +7 -0
- package/src/lib/api/api-config.ts +104 -0
- package/src/lib/api/api-keys.ts +117 -0
- package/src/lib/api/artifact-components.ts +146 -0
- package/src/lib/api/credentials.ts +127 -0
- package/src/lib/api/data-components.ts +141 -0
- package/src/lib/api/graph-full-client.ts +109 -0
- package/src/lib/api/projects.ts +104 -0
- package/src/lib/api/resource-validation.ts +109 -0
- package/src/lib/api/signoz-sql.ts +175 -0
- package/src/lib/api/signoz-stats.ts +1018 -0
- package/src/lib/api/tools.ts +221 -0
- package/src/lib/events.ts +34 -0
- package/src/lib/index.ts +48 -0
- package/src/lib/json-schema-validation.ts +363 -0
- package/src/lib/logger.ts +45 -0
- package/src/lib/mcp-tools/nango-types.ts +19 -0
- package/src/lib/mcp-tools/nango.ts +459 -0
- package/src/lib/services/save-graph.ts +14 -0
- package/src/lib/types/errors.ts +18 -0
- package/src/lib/types/graph-full.ts +65 -0
- package/src/lib/types/project.ts +26 -0
- package/src/lib/types/response.ts +13 -0
- package/src/lib/utils/credentials-utils.ts +31 -0
- package/src/lib/utils/graph-error-parser.ts +262 -0
- package/src/lib/utils/mcp-schema-parser.ts +202 -0
- package/src/lib/utils/mcp-urls.ts +63 -0
- package/src/lib/utils/mcp-utils.ts +18 -0
- package/src/lib/utils/project-redirect.ts +39 -0
- package/src/lib/utils.ts +46 -0
- package/src/lib/validation.ts +14 -0
- package/tsconfig.json +27 -0
- package/vitest.config.ts +43 -0
|
@@ -0,0 +1,1018 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SPAN_KEYS, AI_OPERATIONS, SPAN_NAMES, QUERY_FIELD_CONFIGS, UNKNOWN_VALUE, AI_TOOL_TYPES, OPERATORS, QUERY_EXPRESSIONS, REDUCE_OPERATIONS, ORDER_DIRECTIONS, QUERY_DEFAULTS, DATA_SOURCES, AGGREGATE_OPERATORS, QUERY_TYPES, PANEL_TYPES } from '@/constants/signoz';
|
|
3
|
+
import axios from 'axios';
|
|
4
|
+
import axiosRetry from 'axios-retry';
|
|
5
|
+
|
|
6
|
+
// ---------- String Constants for Type Safety
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export interface ConversationStats {
|
|
11
|
+
conversationId: string;
|
|
12
|
+
tenantId: string;
|
|
13
|
+
graphId: string;
|
|
14
|
+
graphName: string;
|
|
15
|
+
totalToolCalls: number;
|
|
16
|
+
toolsUsed: Array<{ name: string; calls: number; description: string }>;
|
|
17
|
+
transfers: Array<{ from: string; to: string; count: number }>;
|
|
18
|
+
totalTransfers: number;
|
|
19
|
+
delegations: Array<{ from: string; to: string; count: number }>;
|
|
20
|
+
totalDelegations: number;
|
|
21
|
+
totalAICalls: number;
|
|
22
|
+
totalErrors: number;
|
|
23
|
+
hasErrors: boolean;
|
|
24
|
+
firstUserMessage?: string;
|
|
25
|
+
startTime?: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface PaginatedConversationStats {
|
|
29
|
+
data: ConversationStats[];
|
|
30
|
+
pagination: {
|
|
31
|
+
page: number;
|
|
32
|
+
limit: number;
|
|
33
|
+
total: number;
|
|
34
|
+
totalPages: number;
|
|
35
|
+
hasNextPage: boolean;
|
|
36
|
+
hasPreviousPage: boolean;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface SpanFilterOptions {
|
|
41
|
+
spanName?: string;
|
|
42
|
+
attributes?: {
|
|
43
|
+
key: string;
|
|
44
|
+
value: string;
|
|
45
|
+
operator?:
|
|
46
|
+
| '=' | '!=' | '<' | '>' | '<=' | '>='
|
|
47
|
+
| 'in' | 'nin'
|
|
48
|
+
| 'contains' | 'ncontains'
|
|
49
|
+
| 'regex' | 'nregex'
|
|
50
|
+
| 'like' | 'nlike'
|
|
51
|
+
| 'exists' | 'nexists';
|
|
52
|
+
}[];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// ---------- Small utilities
|
|
56
|
+
|
|
57
|
+
const nsToMs = (ns: number) => Math.floor(ns / 1_000_000);
|
|
58
|
+
|
|
59
|
+
const asNumberIfNumeric = (v: string) =>
|
|
60
|
+
/^-?\d+(\.\d+)?$/.test(v) ? Number(v) : v;
|
|
61
|
+
|
|
62
|
+
// Type-safe filter value schema and parser
|
|
63
|
+
const FilterValueSchema = z.union([
|
|
64
|
+
z.string(),
|
|
65
|
+
z.number(),
|
|
66
|
+
z.boolean(),
|
|
67
|
+
]);
|
|
68
|
+
|
|
69
|
+
type FilterValue = z.infer<typeof FilterValueSchema>;
|
|
70
|
+
|
|
71
|
+
const asTypedFilterValue = (v: string): FilterValue => {
|
|
72
|
+
try {
|
|
73
|
+
// Handle boolean values
|
|
74
|
+
if (v === 'true') {
|
|
75
|
+
return FilterValueSchema.parse(true);
|
|
76
|
+
}
|
|
77
|
+
if (v === 'false') {
|
|
78
|
+
return FilterValueSchema.parse(false);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Handle numeric values with validation
|
|
82
|
+
const numericValue = asNumberIfNumeric(v);
|
|
83
|
+
if (typeof numericValue === 'number') {
|
|
84
|
+
return FilterValueSchema.parse(numericValue);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Return as validated string
|
|
88
|
+
return FilterValueSchema.parse(v);
|
|
89
|
+
} catch (error) {
|
|
90
|
+
// If validation fails, log the error and return the original string
|
|
91
|
+
console.warn(`Failed to parse filter value "${v}":`, error);
|
|
92
|
+
return FilterValueSchema.parse(v);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const byMostRecent = (a: number = 0, b: number = 0) => b - a;
|
|
97
|
+
|
|
98
|
+
type Series = { labels?: Record<string, string>; values?: Array<{ value?: string }> };
|
|
99
|
+
|
|
100
|
+
const countFromSeries = (s: Series) => parseInt(s.values?.[0]?.value ?? '0', 10) || 0;
|
|
101
|
+
const numberFromSeries = (s: Series) => Number(s.values?.[0]?.value ?? 0) || 0;
|
|
102
|
+
|
|
103
|
+
const datesRange = (startMs: number, endMs: number) => {
|
|
104
|
+
const start = new Date(startMs); start.setHours(0, 0, 0, 0);
|
|
105
|
+
const end = new Date(endMs); end.setHours(0, 0, 0, 0);
|
|
106
|
+
const out: string[] = [];
|
|
107
|
+
for (let d = new Date(start); d <= end; d.setDate(d.getDate() + 1)) {
|
|
108
|
+
out.push(`${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`);
|
|
109
|
+
}
|
|
110
|
+
return out;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// ---------- Client
|
|
114
|
+
|
|
115
|
+
axiosRetry(axios, {
|
|
116
|
+
retries: 3,
|
|
117
|
+
retryDelay: axiosRetry.exponentialDelay
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
class SigNozStatsAPI {
|
|
121
|
+
private async makeRequest<T = any>(payload: any): Promise<T> {
|
|
122
|
+
const response = await axios.post<T>('/api/signoz', payload, {
|
|
123
|
+
timeout: 30000,
|
|
124
|
+
headers: {
|
|
125
|
+
'Content-Type': 'application/json',
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
return response.data;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// --- Helpers to read SigNoz response
|
|
132
|
+
private extractSeries(resp: any, name: string): Series[] {
|
|
133
|
+
return resp?.data?.result?.find((r: any) => r?.queryName === name)?.series ?? [];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// ---------- Public methods (unchanged signatures)
|
|
137
|
+
|
|
138
|
+
async getConversationStats(
|
|
139
|
+
startTime: number,
|
|
140
|
+
endTime: number,
|
|
141
|
+
filters?: SpanFilterOptions,
|
|
142
|
+
projectId?: string,
|
|
143
|
+
pagination?: { page: number; limit: number },
|
|
144
|
+
searchQuery?: string,
|
|
145
|
+
): Promise<ConversationStats[] | PaginatedConversationStats> {
|
|
146
|
+
try {
|
|
147
|
+
const payload = this.buildCombinedPayload(startTime, endTime, filters, projectId);
|
|
148
|
+
const resp = await this.makeRequest(payload);
|
|
149
|
+
|
|
150
|
+
const toolsSeries = this.extractSeries(resp, QUERY_EXPRESSIONS.TOOLS);
|
|
151
|
+
const transfersSeries = this.extractSeries(resp, QUERY_EXPRESSIONS.TRANSFERS);
|
|
152
|
+
const delegationsSeries = this.extractSeries(resp, QUERY_EXPRESSIONS.DELEGATIONS);
|
|
153
|
+
const aiCallsSeries = this.extractSeries(resp, QUERY_EXPRESSIONS.AI_CALLS);
|
|
154
|
+
const lastActivitySeries = this.extractSeries(resp, QUERY_EXPRESSIONS.LAST_ACTIVITY);
|
|
155
|
+
const metadataSeries = this.extractSeries(resp, QUERY_EXPRESSIONS.CONVERSATION_METADATA);
|
|
156
|
+
const contextErrorsSeries = this.extractSeries(resp, QUERY_EXPRESSIONS.CONTEXT_ERRORS);
|
|
157
|
+
const agentGenerationErrorsSeries = this.extractSeries(resp, QUERY_EXPRESSIONS.AGENT_GENERATION_ERRORS);
|
|
158
|
+
const userMessagesSeries = this.extractSeries(resp, QUERY_EXPRESSIONS.USER_MESSAGES);
|
|
159
|
+
|
|
160
|
+
// metadata map
|
|
161
|
+
const metaByConv = new Map<string, { tenantId: string; graphId: string; graphName: string }>();
|
|
162
|
+
for (const s of metadataSeries) {
|
|
163
|
+
const id = s.labels?.[SPAN_KEYS.CONVERSATION_ID];
|
|
164
|
+
if (!id) continue;
|
|
165
|
+
metaByConv.set(id, {
|
|
166
|
+
tenantId: s.labels?.[SPAN_KEYS.TENANT_ID] ?? UNKNOWN_VALUE,
|
|
167
|
+
graphId: s.labels?.[SPAN_KEYS.GRAPH_ID] ?? UNKNOWN_VALUE,
|
|
168
|
+
graphName: s.labels?.[SPAN_KEYS.GRAPH_NAME] ?? UNKNOWN_VALUE,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// last seen map
|
|
173
|
+
const lastSeen = new Map<string, number>();
|
|
174
|
+
for (const s of lastActivitySeries) {
|
|
175
|
+
const id = s.labels?.[SPAN_KEYS.CONVERSATION_ID];
|
|
176
|
+
if (!id) continue;
|
|
177
|
+
lastSeen.set(id, numberFromSeries(s));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// first user message per conversation (min timestamp already grouped)
|
|
181
|
+
const firstMsgByConv = new Map<string, { content: string; timestamp: number }>();
|
|
182
|
+
const msgsByConv = new Map<string, Array<{ t: number; c: string }>>();
|
|
183
|
+
for (const s of userMessagesSeries) {
|
|
184
|
+
const id = s.labels?.[SPAN_KEYS.CONVERSATION_ID];
|
|
185
|
+
const content = s.labels?.[SPAN_KEYS.MESSAGE_CONTENT];
|
|
186
|
+
const t = numberFromSeries(s);
|
|
187
|
+
if (!id || !content) continue;
|
|
188
|
+
(msgsByConv.get(id) ?? msgsByConv.set(id, []).get(id)!) .push({ t, c: content });
|
|
189
|
+
}
|
|
190
|
+
for (const [id, arr] of msgsByConv) {
|
|
191
|
+
arr.sort((a, b) => a.t - b.t);
|
|
192
|
+
const first = arr[0];
|
|
193
|
+
if (first) {
|
|
194
|
+
const content = first.c.length > 100 ? `${first.c.slice(0, 100)}...` : first.c;
|
|
195
|
+
firstMsgByConv.set(id, { content, timestamp: nsToMs(first.t) });
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// build stats
|
|
200
|
+
let stats = this.toConversationStats(
|
|
201
|
+
toolsSeries, transfersSeries, delegationsSeries, aiCallsSeries,
|
|
202
|
+
metaByConv, contextErrorsSeries, agentGenerationErrorsSeries, firstMsgByConv,
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
// optional secondary filter pass via span filters
|
|
206
|
+
if (filters?.spanName || filters?.attributes?.length) {
|
|
207
|
+
stats = await this.applySpanFilters(stats, startTime, endTime, filters, projectId);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// search filter
|
|
211
|
+
if (searchQuery?.trim()) {
|
|
212
|
+
const q = searchQuery.toLowerCase().trim();
|
|
213
|
+
stats = stats.filter(s =>
|
|
214
|
+
s.firstUserMessage?.toLowerCase().includes(q) ||
|
|
215
|
+
s.conversationId.toLowerCase().includes(q) ||
|
|
216
|
+
s.graphId.toLowerCase().includes(q),
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// sort by last activity
|
|
221
|
+
stats.sort((a, b) => byMostRecent(lastSeen.get(a.conversationId), lastSeen.get(b.conversationId)));
|
|
222
|
+
|
|
223
|
+
if (!pagination) return stats;
|
|
224
|
+
|
|
225
|
+
const { page, limit } = pagination;
|
|
226
|
+
const total = stats.length;
|
|
227
|
+
const totalPages = Math.ceil(total / limit);
|
|
228
|
+
const start = (page - 1) * limit;
|
|
229
|
+
const data = stats.slice(start, start + limit);
|
|
230
|
+
|
|
231
|
+
return {
|
|
232
|
+
data,
|
|
233
|
+
pagination: {
|
|
234
|
+
page, limit, total, totalPages,
|
|
235
|
+
hasNextPage: page < totalPages,
|
|
236
|
+
hasPreviousPage: page > 1,
|
|
237
|
+
},
|
|
238
|
+
};
|
|
239
|
+
} catch (e) {
|
|
240
|
+
console.error('getConversationStats error:', e);
|
|
241
|
+
return [];
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
async getAICallsByGraph(startTime: number, endTime: number, projectId?: string) {
|
|
246
|
+
try {
|
|
247
|
+
const resp = await this.makeRequest(this.buildCombinedPayload(startTime, endTime, undefined, projectId));
|
|
248
|
+
const series = this.extractSeries(resp, QUERY_EXPRESSIONS.AI_CALLS);
|
|
249
|
+
const totals = new Map<string, number>();
|
|
250
|
+
for (const s of series) {
|
|
251
|
+
const graphId = s.labels?.[SPAN_KEYS.GRAPH_ID] || UNKNOWN_VALUE;
|
|
252
|
+
const count = countFromSeries(s);
|
|
253
|
+
if (count) totals.set(graphId, (totals.get(graphId) || 0) + count);
|
|
254
|
+
}
|
|
255
|
+
return [...totals].map(([graphId, totalCalls]) => ({ graphId, totalCalls }))
|
|
256
|
+
.sort((a, b) => b.totalCalls - a.totalCalls);
|
|
257
|
+
} catch (e) {
|
|
258
|
+
console.error('getAICallsByGraph error:', e);
|
|
259
|
+
return [];
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
async getAICallsByAgent(startTime: number, endTime: number, graphId?: string, modelId?: string, projectId?: string) {
|
|
264
|
+
try {
|
|
265
|
+
const resp = await this.makeRequest(this.buildAgentModelBreakdownPayload(startTime, endTime, projectId));
|
|
266
|
+
const series = this.extractSeries(resp, 'agentModelCalls');
|
|
267
|
+
const acc = new Map<string, { agentId: string; graphId: string; modelId: string; totalCalls: number }>();
|
|
268
|
+
|
|
269
|
+
for (const s of series) {
|
|
270
|
+
const agent = s.labels?.[SPAN_KEYS.AI_TELEMETRY_FUNCTION_ID] || UNKNOWN_VALUE;
|
|
271
|
+
const gId = s.labels?.[SPAN_KEYS.GRAPH_ID] || UNKNOWN_VALUE;
|
|
272
|
+
const mId = s.labels?.[SPAN_KEYS.AI_MODEL_ID] || UNKNOWN_VALUE;
|
|
273
|
+
const count = countFromSeries(s);
|
|
274
|
+
|
|
275
|
+
if (!count) continue;
|
|
276
|
+
if (graphId && graphId !== 'all' && gId !== graphId) continue;
|
|
277
|
+
if (modelId && modelId !== 'all' && mId !== modelId) continue;
|
|
278
|
+
|
|
279
|
+
const key = `${agent}::${gId}::${mId}`;
|
|
280
|
+
const row = acc.get(key) || { agentId: agent, graphId: gId, modelId: mId, totalCalls: 0 };
|
|
281
|
+
row.totalCalls += count;
|
|
282
|
+
acc.set(key, row);
|
|
283
|
+
}
|
|
284
|
+
return [...acc.values()].sort((a, b) => b.totalCalls - a.totalCalls);
|
|
285
|
+
} catch (e) {
|
|
286
|
+
console.error('getAICallsByAgent error:', e);
|
|
287
|
+
return [];
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
async getAICallsByModel(startTime: number, endTime: number, graphId?: string, projectId?: string) {
|
|
292
|
+
try {
|
|
293
|
+
const resp = await this.makeRequest(this.buildModelBreakdownPayload(startTime, endTime, projectId));
|
|
294
|
+
const series = this.extractSeries(resp, 'modelCalls');
|
|
295
|
+
const totals = new Map<string, number>();
|
|
296
|
+
|
|
297
|
+
for (const s of series) {
|
|
298
|
+
const mId = s.labels?.[SPAN_KEYS.AI_MODEL_ID] || UNKNOWN_VALUE;
|
|
299
|
+
const gId = s.labels?.[SPAN_KEYS.GRAPH_ID] || UNKNOWN_VALUE;
|
|
300
|
+
const count = countFromSeries(s);
|
|
301
|
+
if (!count) continue;
|
|
302
|
+
if (graphId && graphId !== 'all' && gId !== graphId) continue;
|
|
303
|
+
totals.set(mId, (totals.get(mId) || 0) + count);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return [...totals].map(([modelId, totalCalls]) => ({ modelId, totalCalls }))
|
|
307
|
+
.sort((a, b) => b.totalCalls - a.totalCalls);
|
|
308
|
+
} catch (e) {
|
|
309
|
+
console.error('getAICallsByModel error:', e);
|
|
310
|
+
return [];
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
async getUniqueGraphs(startTime: number, endTime: number, projectId?: string) {
|
|
315
|
+
try {
|
|
316
|
+
const resp = await this.makeRequest(this.buildUniqueGraphsPayload(startTime, endTime, projectId));
|
|
317
|
+
const series = this.extractSeries(resp, 'uniqueGraphs');
|
|
318
|
+
const graphs = series
|
|
319
|
+
.map(s => s.labels?.[SPAN_KEYS.GRAPH_ID])
|
|
320
|
+
.filter((id): id is string => Boolean(id) && id !== UNKNOWN_VALUE)
|
|
321
|
+
.sort();
|
|
322
|
+
return [...new Set(graphs)];
|
|
323
|
+
} catch (e) {
|
|
324
|
+
console.error('getUniqueGraphs error:', e);
|
|
325
|
+
return [];
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
async getUniqueModels(startTime: number, endTime: number, projectId?: string) {
|
|
330
|
+
try {
|
|
331
|
+
const resp = await this.makeRequest(this.buildUniqueModelsPayload(startTime, endTime, projectId));
|
|
332
|
+
const series = this.extractSeries(resp, 'uniqueModels');
|
|
333
|
+
const models = series
|
|
334
|
+
.map(s => s.labels?.[SPAN_KEYS.AI_MODEL_ID])
|
|
335
|
+
.filter((id): id is string => Boolean(id) && id !== UNKNOWN_VALUE)
|
|
336
|
+
.sort();
|
|
337
|
+
return [...new Set(models)];
|
|
338
|
+
} catch (e) {
|
|
339
|
+
console.error('getUniqueModels error:', e);
|
|
340
|
+
return [];
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
async getConversationsPerDay(startTime: number, endTime: number, graphId?: string, projectId?: string) {
|
|
345
|
+
try {
|
|
346
|
+
// 1) which conversations exist?
|
|
347
|
+
const metaResp = await this.makeRequest(this.buildConversationMetadataPayload(startTime, endTime, graphId, projectId));
|
|
348
|
+
const metaSeries = this.extractSeries(metaResp, 'conversationMetadata');
|
|
349
|
+
|
|
350
|
+
// 2) if any, fetch their last activity
|
|
351
|
+
const activitySeries = metaSeries.length
|
|
352
|
+
? this.extractSeries(await this.makeRequest(this.buildConversationActivityPayload(startTime, endTime, graphId, projectId)), 'lastActivity')
|
|
353
|
+
: [];
|
|
354
|
+
|
|
355
|
+
const buckets = new Map<string, number>();
|
|
356
|
+
for (const s of activitySeries) {
|
|
357
|
+
const tsMs = nsToMs(numberFromSeries(s));
|
|
358
|
+
if (!tsMs) continue;
|
|
359
|
+
const d = new Date(tsMs);
|
|
360
|
+
const key = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
|
|
361
|
+
buckets.set(key, (buckets.get(key) || 0) + 1);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
return datesRange(startTime, endTime).map(date => ({ date, count: buckets.get(date) || 0 }));
|
|
365
|
+
} catch (e) {
|
|
366
|
+
console.error('getConversationsPerDay error:', e);
|
|
367
|
+
return datesRange(startTime, endTime).map(date => ({ date, count: 0 }));
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
async getAggregateStats(startTime: number, endTime: number, filters?: SpanFilterOptions, projectId?: string) {
|
|
372
|
+
try {
|
|
373
|
+
const resp = await this.makeRequest(this.buildCombinedPayload(startTime, endTime, filters, projectId));
|
|
374
|
+
|
|
375
|
+
const toolsSeries = this.extractSeries(resp, 'tools');
|
|
376
|
+
const transfersSeries = this.extractSeries(resp, 'transfers');
|
|
377
|
+
const delegationsSeries = this.extractSeries(resp, 'delegations');
|
|
378
|
+
const aiCallsSeries = this.extractSeries(resp, 'aiCalls');
|
|
379
|
+
const metadataSeries = this.extractSeries(resp, 'conversationMetadata');
|
|
380
|
+
const contextErrSeries = this.extractSeries(resp, 'contextErrors');
|
|
381
|
+
const agentGenErrSeries = this.extractSeries(resp, 'agentGenerationErrors');
|
|
382
|
+
|
|
383
|
+
const metaByConv = new Map<string, { tenantId: string; graphId: string; graphName: string }>();
|
|
384
|
+
for (const s of metadataSeries) {
|
|
385
|
+
const id = s.labels?.[SPAN_KEYS.CONVERSATION_ID];
|
|
386
|
+
if (!id) continue;
|
|
387
|
+
metaByConv.set(id, { tenantId: s.labels?.[SPAN_KEYS.TENANT_ID] ?? UNKNOWN_VALUE, graphId: s.labels?.[SPAN_KEYS.GRAPH_ID] ?? UNKNOWN_VALUE, graphName: s.labels?.[SPAN_KEYS.GRAPH_NAME] ?? UNKNOWN_VALUE });
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
let stats = this.toConversationStats(
|
|
391
|
+
toolsSeries, transfersSeries, delegationsSeries, aiCallsSeries,
|
|
392
|
+
metaByConv, contextErrSeries, agentGenErrSeries, new Map<string, { content: string; timestamp: number }>(),
|
|
393
|
+
);
|
|
394
|
+
|
|
395
|
+
if (filters?.spanName || filters?.attributes?.length) {
|
|
396
|
+
stats = await this.applySpanFilters(stats, startTime, endTime, filters, projectId);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
return {
|
|
400
|
+
totalToolCalls: stats.reduce((s, r) => s + r.totalToolCalls, 0),
|
|
401
|
+
totalTransfers: stats.reduce((s, r) => s + r.totalTransfers, 0),
|
|
402
|
+
totalDelegations: stats.reduce((s, r) => s + r.totalDelegations, 0),
|
|
403
|
+
totalConversations: stats.length,
|
|
404
|
+
totalAICalls: stats.reduce((s, r) => s + r.totalAICalls, 0),
|
|
405
|
+
};
|
|
406
|
+
} catch (e) {
|
|
407
|
+
console.error('getAggregateStats error:', e);
|
|
408
|
+
return { totalToolCalls: 0, totalTransfers: 0, totalDelegations: 0, totalConversations: 0, totalAICalls: 0 };
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
async getAvailableSpanNames(startTime: number, endTime: number, graphId?: string, projectId?: string) {
|
|
413
|
+
try {
|
|
414
|
+
const filterItems: any[] = [
|
|
415
|
+
{ key: { key: SPAN_KEYS.NAME, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN }, op: OPERATORS.EXISTS, value: '' },
|
|
416
|
+
];
|
|
417
|
+
if (graphId && graphId !== 'all') {
|
|
418
|
+
filterItems.push({ key: { key: SPAN_KEYS.GRAPH_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EQUALS, value: graphId });
|
|
419
|
+
}
|
|
420
|
+
if (projectId) {
|
|
421
|
+
filterItems.push({ key: { key: SPAN_KEYS.PROJECT_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EQUALS, value: projectId });
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
const payload = {
|
|
425
|
+
start: startTime, end: endTime, step: QUERY_DEFAULTS.STEP, variables: {},
|
|
426
|
+
compositeQuery: {
|
|
427
|
+
queryType: QUERY_TYPES.BUILDER, panelType: PANEL_TYPES.LIST,
|
|
428
|
+
builderQueries: {
|
|
429
|
+
spanNames: {
|
|
430
|
+
dataSource: DATA_SOURCES.TRACES, queryName: QUERY_EXPRESSIONS.SPAN_NAMES,
|
|
431
|
+
aggregateOperator: AGGREGATE_OPERATORS.NOOP, aggregateAttribute: {},
|
|
432
|
+
filters: { op: OPERATORS.AND, items: filterItems },
|
|
433
|
+
selectColumns: [{ key: SPAN_KEYS.NAME, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN }],
|
|
434
|
+
expression: QUERY_EXPRESSIONS.SPAN_NAMES, disabled: QUERY_DEFAULTS.DISABLED, having: QUERY_DEFAULTS.HAVING,
|
|
435
|
+
stepInterval: QUERY_DEFAULTS.STEP_INTERVAL, limit: QUERY_DEFAULTS.LIMIT_1000, orderBy: [{ columnName: SPAN_KEYS.TIMESTAMP, order: ORDER_DIRECTIONS.DESC }], groupBy: QUERY_DEFAULTS.EMPTY_GROUP_BY, offset: QUERY_DEFAULTS.OFFSET,
|
|
436
|
+
},
|
|
437
|
+
},
|
|
438
|
+
},
|
|
439
|
+
dataSource: DATA_SOURCES.TRACES, projectId,
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
const resp = await this.makeRequest(payload);
|
|
443
|
+
const list = resp?.data?.result?.find((r: any) => r?.queryName === 'spanNames')?.list ?? [];
|
|
444
|
+
const names = new Set<string>();
|
|
445
|
+
for (const row of list) {
|
|
446
|
+
const n = row?.data?.name ?? row?.name;
|
|
447
|
+
if (n) names.add(n);
|
|
448
|
+
}
|
|
449
|
+
return [...names].sort();
|
|
450
|
+
} catch (e) {
|
|
451
|
+
console.error('getAvailableSpanNames error:', e);
|
|
452
|
+
return [];
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
// ---------- Private: transform + filter
|
|
457
|
+
|
|
458
|
+
private toConversationStats(
|
|
459
|
+
toolCallsSeries: Series[],
|
|
460
|
+
transferSeries: Series[],
|
|
461
|
+
delegationSeries: Series[],
|
|
462
|
+
aiCallsSeries: Series[],
|
|
463
|
+
metaByConv: Map<string, { tenantId: string; graphId: string; graphName: string }>,
|
|
464
|
+
contextErrSeries: Series[],
|
|
465
|
+
agentGenErrSeries: Series[],
|
|
466
|
+
firstMsgByConv: Map<string, { content: string; timestamp: number }>,
|
|
467
|
+
): ConversationStats[] {
|
|
468
|
+
type Acc = {
|
|
469
|
+
totalToolCalls: number;
|
|
470
|
+
toolsUsed: Map<string, { name: string; calls: number; description: string }>;
|
|
471
|
+
transfers: Map<string, { from: string; to: string; count: number }>;
|
|
472
|
+
totalTransfers: number;
|
|
473
|
+
delegations: Map<string, { from: string; to: string; count: number }>;
|
|
474
|
+
totalDelegations: number;
|
|
475
|
+
totalAICalls: number;
|
|
476
|
+
totalErrors: number;
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
const byConv = new Map<string, Acc>();
|
|
480
|
+
|
|
481
|
+
const ensure = (id: string) => {
|
|
482
|
+
const cur = byConv.get(id);
|
|
483
|
+
if (cur) return cur;
|
|
484
|
+
const blank: Acc = {
|
|
485
|
+
totalToolCalls: 0,
|
|
486
|
+
toolsUsed: new Map(),
|
|
487
|
+
transfers: new Map(),
|
|
488
|
+
totalTransfers: 0,
|
|
489
|
+
delegations: new Map(),
|
|
490
|
+
totalDelegations: 0,
|
|
491
|
+
totalAICalls: 0,
|
|
492
|
+
totalErrors: 0,
|
|
493
|
+
};
|
|
494
|
+
byConv.set(id, blank);
|
|
495
|
+
return blank;
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
// tools
|
|
499
|
+
for (const s of toolCallsSeries) {
|
|
500
|
+
const id = s.labels?.[SPAN_KEYS.CONVERSATION_ID]; if (!id) continue;
|
|
501
|
+
const name = s.labels?.[SPAN_KEYS.AI_TOOL_CALL_NAME]; if (!name) continue;
|
|
502
|
+
const calls = countFromSeries(s); if (!calls) continue;
|
|
503
|
+
const desc = s.labels?.[SPAN_KEYS.MCP_TOOL_DESCRIPTION] || '';
|
|
504
|
+
const acc = ensure(id);
|
|
505
|
+
acc.totalToolCalls += calls;
|
|
506
|
+
const t = acc.toolsUsed.get(name) || { name, calls: 0, description: desc };
|
|
507
|
+
t.calls += calls; acc.toolsUsed.set(name, t);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
// transfers
|
|
511
|
+
for (const s of transferSeries) {
|
|
512
|
+
const id = s.labels?.[SPAN_KEYS.CONVERSATION_ID]; if (!id) continue;
|
|
513
|
+
const from = s.labels?.[SPAN_KEYS.TRANSFER_FROM_AGENT_ID]; const to = s.labels?.[SPAN_KEYS.TRANSFER_TO_AGENT_ID];
|
|
514
|
+
const count = countFromSeries(s);
|
|
515
|
+
if (!from || !to || !count) continue;
|
|
516
|
+
const acc = ensure(id); acc.totalTransfers += count;
|
|
517
|
+
const key = `${from}→${to}`;
|
|
518
|
+
const h = acc.transfers.get(key) || { from, to, count: 0 };
|
|
519
|
+
h.count += count; acc.transfers.set(key, h);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// delegations
|
|
523
|
+
for (const s of delegationSeries) {
|
|
524
|
+
const id = s.labels?.[SPAN_KEYS.CONVERSATION_ID]; if (!id) continue;
|
|
525
|
+
const from = s.labels?.[SPAN_KEYS.DELEGATION_FROM_AGENT_ID]; const to = s.labels?.[SPAN_KEYS.DELEGATION_TO_AGENT_ID];
|
|
526
|
+
const count = countFromSeries(s);
|
|
527
|
+
if (!from || !to || !count) continue;
|
|
528
|
+
const acc = ensure(id); acc.totalDelegations += count;
|
|
529
|
+
const key = `${from}→${to}`;
|
|
530
|
+
const d = acc.delegations.get(key) || { from, to, count: 0 };
|
|
531
|
+
d.count += count; acc.delegations.set(key, d);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
// AI calls
|
|
535
|
+
for (const s of aiCallsSeries) {
|
|
536
|
+
const id = s.labels?.[SPAN_KEYS.CONVERSATION_ID]; if (!id) continue;
|
|
537
|
+
const count = countFromSeries(s); if (!count) continue;
|
|
538
|
+
ensure(id).totalAICalls += count;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
// errors
|
|
542
|
+
for (const s of [...contextErrSeries, ...agentGenErrSeries]) {
|
|
543
|
+
const id = s.labels?.[SPAN_KEYS.CONVERSATION_ID]; if (!id) continue;
|
|
544
|
+
const count = countFromSeries(s); if (!count) continue;
|
|
545
|
+
ensure(id).totalErrors += count;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
// finalize
|
|
549
|
+
const out: ConversationStats[] = [];
|
|
550
|
+
const allConvIds = new Set<string>([...byConv.keys(), ...metaByConv.keys()]);
|
|
551
|
+
for (const id of allConvIds) {
|
|
552
|
+
const acc = byConv.get(id) || ensure(id);
|
|
553
|
+
const meta = metaByConv.get(id) || { tenantId: UNKNOWN_VALUE, graphId: UNKNOWN_VALUE, graphName: UNKNOWN_VALUE };
|
|
554
|
+
out.push({
|
|
555
|
+
conversationId: id,
|
|
556
|
+
tenantId: meta.tenantId,
|
|
557
|
+
graphId: meta.graphId,
|
|
558
|
+
graphName: meta.graphName || '',
|
|
559
|
+
totalToolCalls: acc.totalToolCalls,
|
|
560
|
+
toolsUsed: [...acc.toolsUsed.values()],
|
|
561
|
+
transfers: [...acc.transfers.values()],
|
|
562
|
+
totalTransfers: acc.totalTransfers,
|
|
563
|
+
delegations: [...acc.delegations.values()],
|
|
564
|
+
totalDelegations: acc.totalDelegations,
|
|
565
|
+
totalAICalls: acc.totalAICalls,
|
|
566
|
+
totalErrors: acc.totalErrors,
|
|
567
|
+
hasErrors: acc.totalErrors > 0,
|
|
568
|
+
firstUserMessage: firstMsgByConv.get(id)?.content,
|
|
569
|
+
startTime: firstMsgByConv.get(id)?.timestamp,
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
return out;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
private async applySpanFilters(stats: ConversationStats[], startTime: number, endTime: number, filters: SpanFilterOptions, projectId?: string) {
|
|
576
|
+
try {
|
|
577
|
+
const resp = await this.makeRequest(this.buildFilteredConversationsPayload(startTime, endTime, filters, projectId));
|
|
578
|
+
const series = this.extractSeries(resp, 'filteredConversations');
|
|
579
|
+
const allowed = new Set<string>(series.map(s => s.labels?.[SPAN_KEYS.CONVERSATION_ID]).filter(Boolean) as string[]);
|
|
580
|
+
return stats.filter(s => allowed.has(s.conversationId));
|
|
581
|
+
} catch (e) {
|
|
582
|
+
console.error('applySpanFilters error:', e);
|
|
583
|
+
return stats;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
// ---------- Payload builders (unchanged behavior, less repetition)
|
|
588
|
+
|
|
589
|
+
private buildAgentModelBreakdownPayload(start: number, end: number, projectId?: string) {
|
|
590
|
+
return {
|
|
591
|
+
start, end, step: QUERY_DEFAULTS.STEP, variables: {},
|
|
592
|
+
compositeQuery: {
|
|
593
|
+
queryType: QUERY_TYPES.BUILDER, panelType: PANEL_TYPES.TABLE,
|
|
594
|
+
builderQueries: {
|
|
595
|
+
agentModelCalls: {
|
|
596
|
+
dataSource: DATA_SOURCES.TRACES, queryName: QUERY_EXPRESSIONS.AGENT_MODEL_CALLS,
|
|
597
|
+
aggregateOperator: AGGREGATE_OPERATORS.COUNT,
|
|
598
|
+
aggregateAttribute: { key: SPAN_KEYS.SPAN_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN },
|
|
599
|
+
filters: {
|
|
600
|
+
op: OPERATORS.AND, items: [
|
|
601
|
+
{ key: { key: SPAN_KEYS.AI_OPERATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN }, op: OPERATORS.EQUALS, value: AI_OPERATIONS.GENERATE_TEXT },
|
|
602
|
+
{ key: { key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EXISTS, value: '' },
|
|
603
|
+
...(projectId ? [{ key: { key: SPAN_KEYS.PROJECT_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EQUALS, value: projectId }] : []),
|
|
604
|
+
],
|
|
605
|
+
},
|
|
606
|
+
groupBy: [
|
|
607
|
+
{ key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG },
|
|
608
|
+
{ key: SPAN_KEYS.AI_TELEMETRY_FUNCTION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN },
|
|
609
|
+
{ key: SPAN_KEYS.GRAPH_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG },
|
|
610
|
+
{ key: SPAN_KEYS.AI_MODEL_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN },
|
|
611
|
+
],
|
|
612
|
+
expression: QUERY_EXPRESSIONS.AGENT_MODEL_CALLS, reduceTo: REDUCE_OPERATIONS.SUM, stepInterval: QUERY_DEFAULTS.STEP_INTERVAL,
|
|
613
|
+
orderBy: [{ columnName: SPAN_KEYS.TIMESTAMP, order: ORDER_DIRECTIONS.DESC }], offset: QUERY_DEFAULTS.OFFSET,
|
|
614
|
+
disabled: QUERY_DEFAULTS.DISABLED, having: QUERY_DEFAULTS.HAVING, legend: QUERY_DEFAULTS.LEGEND, limit: QUERY_DEFAULTS.LIMIT_NULL,
|
|
615
|
+
},
|
|
616
|
+
},
|
|
617
|
+
},
|
|
618
|
+
dataSource: DATA_SOURCES.TRACES, projectId,
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
private buildModelBreakdownPayload(start: number, end: number, projectId?: string) {
|
|
623
|
+
return {
|
|
624
|
+
start, end, step: QUERY_DEFAULTS.STEP, variables: {},
|
|
625
|
+
compositeQuery: {
|
|
626
|
+
queryType: QUERY_TYPES.BUILDER, panelType: PANEL_TYPES.TABLE,
|
|
627
|
+
builderQueries: {
|
|
628
|
+
modelCalls: {
|
|
629
|
+
dataSource: DATA_SOURCES.TRACES, queryName: QUERY_EXPRESSIONS.MODEL_CALLS,
|
|
630
|
+
aggregateOperator: AGGREGATE_OPERATORS.COUNT,
|
|
631
|
+
aggregateAttribute: { key: SPAN_KEYS.SPAN_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN },
|
|
632
|
+
filters: {
|
|
633
|
+
op: OPERATORS.AND, items: [
|
|
634
|
+
{ key: { key: SPAN_KEYS.AI_OPERATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN }, op: OPERATORS.EQUALS, value: AI_OPERATIONS.GENERATE_TEXT },
|
|
635
|
+
{ key: { key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EXISTS, value: '' },
|
|
636
|
+
...(projectId ? [{ key: { key: SPAN_KEYS.PROJECT_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EQUALS, value: projectId }] : []),
|
|
637
|
+
],
|
|
638
|
+
},
|
|
639
|
+
groupBy: [
|
|
640
|
+
{ key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG },
|
|
641
|
+
{ key: SPAN_KEYS.AI_MODEL_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN },
|
|
642
|
+
{ key: SPAN_KEYS.GRAPH_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG },
|
|
643
|
+
],
|
|
644
|
+
expression: QUERY_EXPRESSIONS.MODEL_CALLS, reduceTo: REDUCE_OPERATIONS.SUM, stepInterval: QUERY_DEFAULTS.STEP_INTERVAL,
|
|
645
|
+
orderBy: [{ columnName: SPAN_KEYS.TIMESTAMP, order: ORDER_DIRECTIONS.DESC }], offset: QUERY_DEFAULTS.OFFSET,
|
|
646
|
+
disabled: QUERY_DEFAULTS.DISABLED, having: QUERY_DEFAULTS.HAVING, legend: QUERY_DEFAULTS.LEGEND, limit: QUERY_DEFAULTS.LIMIT_ZERO,
|
|
647
|
+
},
|
|
648
|
+
},
|
|
649
|
+
},
|
|
650
|
+
dataSource: DATA_SOURCES.TRACES, projectId,
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
private buildConversationActivityPayload(start: number, end: number, graphId?: string, projectId?: string) {
|
|
655
|
+
const items: any[] = [
|
|
656
|
+
{ key: { key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EXISTS, value: '' },
|
|
657
|
+
...(graphId && graphId !== 'all' ? [{ key: { key: SPAN_KEYS.GRAPH_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EQUALS, value: graphId }] : []),
|
|
658
|
+
...(projectId ? [{ key: { key: SPAN_KEYS.PROJECT_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EQUALS, value: projectId }] : []),
|
|
659
|
+
];
|
|
660
|
+
|
|
661
|
+
return {
|
|
662
|
+
start, end, step: QUERY_DEFAULTS.STEP, variables: {},
|
|
663
|
+
compositeQuery: {
|
|
664
|
+
queryType: QUERY_TYPES.BUILDER, panelType: PANEL_TYPES.TABLE,
|
|
665
|
+
builderQueries: {
|
|
666
|
+
lastActivity: {
|
|
667
|
+
dataSource: DATA_SOURCES.TRACES, queryName: QUERY_EXPRESSIONS.LAST_ACTIVITY,
|
|
668
|
+
aggregateOperator: AGGREGATE_OPERATORS.MAX,
|
|
669
|
+
aggregateAttribute: { key: SPAN_KEYS.TIMESTAMP, ...QUERY_FIELD_CONFIGS.INT64_TAG_COLUMN },
|
|
670
|
+
filters: { op: OPERATORS.AND, items },
|
|
671
|
+
groupBy: [{ key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }],
|
|
672
|
+
expression: QUERY_EXPRESSIONS.LAST_ACTIVITY, reduceTo: REDUCE_OPERATIONS.MAX, stepInterval: QUERY_DEFAULTS.STEP_INTERVAL,
|
|
673
|
+
orderBy: [{ columnName: SPAN_KEYS.TIMESTAMP, order: ORDER_DIRECTIONS.DESC }], offset: QUERY_DEFAULTS.OFFSET,
|
|
674
|
+
disabled: QUERY_DEFAULTS.DISABLED, having: QUERY_DEFAULTS.HAVING, legend: QUERY_DEFAULTS.LEGEND, limit: QUERY_DEFAULTS.LIMIT_NULL,
|
|
675
|
+
},
|
|
676
|
+
},
|
|
677
|
+
},
|
|
678
|
+
dataSource: DATA_SOURCES.TRACES, projectId,
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
private buildConversationMetadataPayload(start: number, end: number, graphId?: string, projectId?: string) {
|
|
683
|
+
const items: any[] = [
|
|
684
|
+
{ key: { key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EXISTS, value: '' },
|
|
685
|
+
{ key: { key: SPAN_KEYS.TENANT_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EXISTS, value: '' },
|
|
686
|
+
{ key: { key: SPAN_KEYS.GRAPH_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EXISTS, value: '' },
|
|
687
|
+
...(graphId && graphId !== 'all' ? [{ key: { key: SPAN_KEYS.GRAPH_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EQUALS, value: graphId }] : []),
|
|
688
|
+
...(projectId ? [{ key: { key: SPAN_KEYS.PROJECT_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EQUALS, value: projectId }] : []),
|
|
689
|
+
];
|
|
690
|
+
|
|
691
|
+
return {
|
|
692
|
+
start, end, step: QUERY_DEFAULTS.STEP, variables: {},
|
|
693
|
+
compositeQuery: {
|
|
694
|
+
queryType: QUERY_TYPES.BUILDER, panelType: PANEL_TYPES.TABLE,
|
|
695
|
+
builderQueries: {
|
|
696
|
+
conversationMetadata: {
|
|
697
|
+
dataSource: DATA_SOURCES.TRACES, queryName: QUERY_EXPRESSIONS.CONVERSATION_METADATA,
|
|
698
|
+
aggregateOperator: AGGREGATE_OPERATORS.COUNT,
|
|
699
|
+
aggregateAttribute: { key: SPAN_KEYS.SPAN_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN },
|
|
700
|
+
filters: { op: OPERATORS.AND, items },
|
|
701
|
+
groupBy: [
|
|
702
|
+
{ key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG },
|
|
703
|
+
{ key: SPAN_KEYS.TENANT_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG },
|
|
704
|
+
{ key: SPAN_KEYS.GRAPH_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG },
|
|
705
|
+
{ key: SPAN_KEYS.GRAPH_NAME, ...QUERY_FIELD_CONFIGS.STRING_TAG },
|
|
706
|
+
],
|
|
707
|
+
expression: QUERY_EXPRESSIONS.CONVERSATION_METADATA, reduceTo: REDUCE_OPERATIONS.SUM, stepInterval: QUERY_DEFAULTS.STEP_INTERVAL,
|
|
708
|
+
orderBy: [{ columnName: SPAN_KEYS.TIMESTAMP, order: ORDER_DIRECTIONS.DESC }], offset: QUERY_DEFAULTS.OFFSET,
|
|
709
|
+
disabled: QUERY_DEFAULTS.DISABLED, having: QUERY_DEFAULTS.HAVING, legend: QUERY_DEFAULTS.LEGEND, limit: QUERY_DEFAULTS.LIMIT_NULL,
|
|
710
|
+
},
|
|
711
|
+
},
|
|
712
|
+
},
|
|
713
|
+
dataSource: DATA_SOURCES.TRACES, projectId,
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
private buildFilteredConversationsPayload(start: number, end: number, filters: SpanFilterOptions, projectId?: string) {
|
|
718
|
+
const items: any[] = [
|
|
719
|
+
{ key: { key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EXISTS, value: '' },
|
|
720
|
+
];
|
|
721
|
+
|
|
722
|
+
if (filters.spanName) {
|
|
723
|
+
items.push({ key: { key: SPAN_KEYS.NAME, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN }, op: OPERATORS.EQUALS, value: filters.spanName });
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
// Attribute filters — pass typed booleans/numbers where possible
|
|
727
|
+
for (const attr of filters.attributes ?? []) {
|
|
728
|
+
const op = attr.operator ?? OPERATORS.EQUALS;
|
|
729
|
+
let value: any = asTypedFilterValue(attr.value);
|
|
730
|
+
let dataType: 'string' | 'int64' | 'float64' | 'bool' = 'string';
|
|
731
|
+
if (typeof value === 'boolean') dataType = 'bool';
|
|
732
|
+
else if (typeof value === 'number') dataType = Number.isInteger(value) ? 'int64' : 'float64';
|
|
733
|
+
|
|
734
|
+
// exists/nexists ignore value
|
|
735
|
+
if (op === OPERATORS.EXISTS || op === OPERATORS.NOT_EXISTS) {
|
|
736
|
+
items.push({ key: { key: attr.key, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op, value: '' });
|
|
737
|
+
continue;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
// LIKE operators add wildcards if absent
|
|
741
|
+
if ((op === OPERATORS.LIKE || op === OPERATORS.NOT_LIKE) && typeof value === 'string' && !value.includes('%')) {
|
|
742
|
+
value = `%${value}%`;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
// For numeric equality, keep exact-match pair (>= & <=) for robustness
|
|
746
|
+
if ((dataType === 'int64' || dataType === 'float64') && op === OPERATORS.EQUALS) {
|
|
747
|
+
const config = dataType === 'int64' ? QUERY_FIELD_CONFIGS.INT64_TAG : QUERY_FIELD_CONFIGS.FLOAT64_TAG;
|
|
748
|
+
items.push({ key: { key: attr.key, ...config }, op: OPERATORS.GREATER_THAN_OR_EQUAL, value });
|
|
749
|
+
items.push({ key: { key: attr.key, ...config }, op: OPERATORS.LESS_THAN_OR_EQUAL, value });
|
|
750
|
+
} else {
|
|
751
|
+
const config = dataType === 'string' ? QUERY_FIELD_CONFIGS.STRING_TAG :
|
|
752
|
+
dataType === 'int64' ? QUERY_FIELD_CONFIGS.INT64_TAG :
|
|
753
|
+
dataType === 'float64' ? QUERY_FIELD_CONFIGS.FLOAT64_TAG :
|
|
754
|
+
QUERY_FIELD_CONFIGS.BOOL_TAG;
|
|
755
|
+
items.push({ key: { key: attr.key, ...config }, op, value });
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
if (projectId) {
|
|
760
|
+
items.push({ key: { key: SPAN_KEYS.PROJECT_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EQUALS, value: projectId });
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
return {
|
|
764
|
+
start, end, step: QUERY_DEFAULTS.STEP, variables: {},
|
|
765
|
+
compositeQuery: {
|
|
766
|
+
queryType: QUERY_TYPES.BUILDER, panelType: PANEL_TYPES.TABLE,
|
|
767
|
+
builderQueries: {
|
|
768
|
+
filteredConversations: {
|
|
769
|
+
dataSource: DATA_SOURCES.TRACES, queryName: QUERY_EXPRESSIONS.FILTERED_CONVERSATIONS,
|
|
770
|
+
aggregateOperator: AGGREGATE_OPERATORS.COUNT,
|
|
771
|
+
aggregateAttribute: { key: SPAN_KEYS.SPAN_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN },
|
|
772
|
+
filters: { op: OPERATORS.AND, items },
|
|
773
|
+
groupBy: [{ key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }],
|
|
774
|
+
expression: QUERY_EXPRESSIONS.FILTERED_CONVERSATIONS, reduceTo: REDUCE_OPERATIONS.SUM, stepInterval: QUERY_DEFAULTS.STEP_INTERVAL,
|
|
775
|
+
orderBy: [{ columnName: SPAN_KEYS.TIMESTAMP, order: ORDER_DIRECTIONS.DESC }], offset: QUERY_DEFAULTS.OFFSET,
|
|
776
|
+
disabled: QUERY_DEFAULTS.DISABLED, having: QUERY_DEFAULTS.HAVING, legend: QUERY_DEFAULTS.LEGEND, limit: QUERY_DEFAULTS.LIMIT_NULL,
|
|
777
|
+
},
|
|
778
|
+
},
|
|
779
|
+
},
|
|
780
|
+
dataSource: DATA_SOURCES.TRACES, projectId,
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
private buildCombinedPayload(start: number, end: number, _filters?: SpanFilterOptions, projectId?: string) {
|
|
785
|
+
const withProject = (items: any[]) =>
|
|
786
|
+
projectId ? [...items, { key: { key: SPAN_KEYS.PROJECT_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EQUALS, value: projectId }] : items;
|
|
787
|
+
|
|
788
|
+
return {
|
|
789
|
+
start, end, step: QUERY_DEFAULTS.STEP, variables: {},
|
|
790
|
+
compositeQuery: {
|
|
791
|
+
queryType: QUERY_TYPES.BUILDER, panelType: PANEL_TYPES.TABLE,
|
|
792
|
+
builderQueries: {
|
|
793
|
+
tools: {
|
|
794
|
+
dataSource: DATA_SOURCES.TRACES, queryName: QUERY_EXPRESSIONS.TOOLS,
|
|
795
|
+
aggregateOperator: AGGREGATE_OPERATORS.COUNT,
|
|
796
|
+
aggregateAttribute: { key: SPAN_KEYS.SPAN_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN },
|
|
797
|
+
filters: { op: OPERATORS.AND, items: withProject([
|
|
798
|
+
{ key: { key: SPAN_KEYS.NAME, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN }, op: OPERATORS.EQUALS, value: SPAN_NAMES.AI_TOOL_CALL },
|
|
799
|
+
{ key: { key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EXISTS, value: '' },
|
|
800
|
+
{ key: { key: SPAN_KEYS.AI_TOOL_TYPE, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EQUALS, value: AI_TOOL_TYPES.MCP },
|
|
801
|
+
]) },
|
|
802
|
+
groupBy: [
|
|
803
|
+
{ key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG },
|
|
804
|
+
{ key: SPAN_KEYS.AI_TOOL_CALL_NAME, ...QUERY_FIELD_CONFIGS.STRING_TAG },
|
|
805
|
+
],
|
|
806
|
+
expression: QUERY_EXPRESSIONS.TOOLS, reduceTo: REDUCE_OPERATIONS.SUM, stepInterval: QUERY_DEFAULTS.STEP_INTERVAL,
|
|
807
|
+
orderBy: [{ columnName: SPAN_KEYS.TIMESTAMP, order: ORDER_DIRECTIONS.DESC }], offset: QUERY_DEFAULTS.OFFSET,
|
|
808
|
+
disabled: QUERY_DEFAULTS.DISABLED, having: QUERY_DEFAULTS.HAVING, legend: QUERY_DEFAULTS.LEGEND, limit: QUERY_DEFAULTS.LIMIT_NULL,
|
|
809
|
+
},
|
|
810
|
+
|
|
811
|
+
transfers: {
|
|
812
|
+
dataSource: DATA_SOURCES.TRACES, queryName: QUERY_EXPRESSIONS.TRANSFERS,
|
|
813
|
+
aggregateOperator: AGGREGATE_OPERATORS.COUNT,
|
|
814
|
+
aggregateAttribute: { key: SPAN_KEYS.SPAN_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN },
|
|
815
|
+
filters: { op: OPERATORS.AND, items: withProject([
|
|
816
|
+
{ key: { key: SPAN_KEYS.NAME, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN }, op: OPERATORS.EQUALS, value: SPAN_NAMES.AI_TOOL_CALL },
|
|
817
|
+
{ key: { key: SPAN_KEYS.AI_TOOL_TYPE, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EQUALS, value: AI_TOOL_TYPES.TRANSFER },
|
|
818
|
+
{ key: { key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EXISTS, value: '' },
|
|
819
|
+
]) },
|
|
820
|
+
groupBy: [
|
|
821
|
+
{ key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG },
|
|
822
|
+
{ key: SPAN_KEYS.TRANSFER_FROM_AGENT_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG },
|
|
823
|
+
{ key: SPAN_KEYS.TRANSFER_TO_AGENT_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG },
|
|
824
|
+
],
|
|
825
|
+
expression: QUERY_EXPRESSIONS.TRANSFERS, reduceTo: REDUCE_OPERATIONS.SUM, stepInterval: QUERY_DEFAULTS.STEP_INTERVAL,
|
|
826
|
+
orderBy: [{ columnName: SPAN_KEYS.TIMESTAMP, order: ORDER_DIRECTIONS.DESC }], offset: QUERY_DEFAULTS.OFFSET,
|
|
827
|
+
disabled: QUERY_DEFAULTS.DISABLED, having: QUERY_DEFAULTS.HAVING, legend: QUERY_DEFAULTS.LEGEND, limit: QUERY_DEFAULTS.LIMIT_NULL,
|
|
828
|
+
},
|
|
829
|
+
|
|
830
|
+
delegations: {
|
|
831
|
+
dataSource: DATA_SOURCES.TRACES, queryName: QUERY_EXPRESSIONS.DELEGATIONS,
|
|
832
|
+
aggregateOperator: AGGREGATE_OPERATORS.COUNT,
|
|
833
|
+
aggregateAttribute: { key: SPAN_KEYS.SPAN_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN },
|
|
834
|
+
filters: { op: OPERATORS.AND, items: withProject([
|
|
835
|
+
{ key: { key: SPAN_KEYS.NAME, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN }, op: OPERATORS.EQUALS, value: SPAN_NAMES.AI_TOOL_CALL },
|
|
836
|
+
{ key: { key: SPAN_KEYS.AI_TOOL_TYPE, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EQUALS, value: AI_TOOL_TYPES.DELEGATION },
|
|
837
|
+
{ key: { key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EXISTS, value: '' },
|
|
838
|
+
]) },
|
|
839
|
+
groupBy: [
|
|
840
|
+
{ key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG },
|
|
841
|
+
{ key: SPAN_KEYS.DELEGATION_FROM_AGENT_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG },
|
|
842
|
+
{ key: SPAN_KEYS.DELEGATION_TO_AGENT_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG },
|
|
843
|
+
],
|
|
844
|
+
expression: QUERY_EXPRESSIONS.DELEGATIONS, reduceTo: REDUCE_OPERATIONS.SUM, stepInterval: QUERY_DEFAULTS.STEP_INTERVAL,
|
|
845
|
+
orderBy: [{ columnName: SPAN_KEYS.TIMESTAMP, order: ORDER_DIRECTIONS.DESC }], offset: QUERY_DEFAULTS.OFFSET,
|
|
846
|
+
disabled: QUERY_DEFAULTS.DISABLED, having: QUERY_DEFAULTS.HAVING, legend: QUERY_DEFAULTS.LEGEND, limit: QUERY_DEFAULTS.LIMIT_NULL,
|
|
847
|
+
},
|
|
848
|
+
|
|
849
|
+
conversationMetadata: {
|
|
850
|
+
dataSource: DATA_SOURCES.TRACES, queryName: QUERY_EXPRESSIONS.CONVERSATION_METADATA,
|
|
851
|
+
aggregateOperator: AGGREGATE_OPERATORS.COUNT,
|
|
852
|
+
aggregateAttribute: { key: SPAN_KEYS.SPAN_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN },
|
|
853
|
+
filters: { op: OPERATORS.AND, items: withProject([
|
|
854
|
+
{ key: { key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EXISTS, value: '' },
|
|
855
|
+
{ key: { key: SPAN_KEYS.TENANT_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EXISTS, value: '' },
|
|
856
|
+
{ key: { key: SPAN_KEYS.GRAPH_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EXISTS, value: '' },
|
|
857
|
+
]) },
|
|
858
|
+
groupBy: [
|
|
859
|
+
{ key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG },
|
|
860
|
+
{ key: SPAN_KEYS.TENANT_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG },
|
|
861
|
+
{ key: SPAN_KEYS.GRAPH_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG },
|
|
862
|
+
{ key: SPAN_KEYS.GRAPH_NAME, ...QUERY_FIELD_CONFIGS.STRING_TAG },
|
|
863
|
+
],
|
|
864
|
+
expression: QUERY_EXPRESSIONS.CONVERSATION_METADATA, reduceTo: REDUCE_OPERATIONS.SUM, stepInterval: QUERY_DEFAULTS.STEP_INTERVAL,
|
|
865
|
+
orderBy: [{ columnName: SPAN_KEYS.TIMESTAMP, order: ORDER_DIRECTIONS.DESC }], offset: QUERY_DEFAULTS.OFFSET,
|
|
866
|
+
disabled: QUERY_DEFAULTS.DISABLED, having: QUERY_DEFAULTS.HAVING, legend: QUERY_DEFAULTS.LEGEND, limit: QUERY_DEFAULTS.LIMIT_NULL,
|
|
867
|
+
},
|
|
868
|
+
|
|
869
|
+
aiCalls: {
|
|
870
|
+
dataSource: DATA_SOURCES.TRACES, queryName: QUERY_EXPRESSIONS.AI_CALLS,
|
|
871
|
+
aggregateOperator: AGGREGATE_OPERATORS.COUNT,
|
|
872
|
+
aggregateAttribute: { key: SPAN_KEYS.SPAN_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN },
|
|
873
|
+
filters: { op: OPERATORS.AND, items: withProject([
|
|
874
|
+
{ key: { key: SPAN_KEYS.AI_OPERATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN }, op: OPERATORS.EQUALS, value: AI_OPERATIONS.GENERATE_TEXT },
|
|
875
|
+
{ key: { key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EXISTS, value: '' },
|
|
876
|
+
]) },
|
|
877
|
+
groupBy: [
|
|
878
|
+
{ key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG },
|
|
879
|
+
{ key: SPAN_KEYS.GRAPH_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG },
|
|
880
|
+
{ key: 'ai.telemetry.functionId', ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN },
|
|
881
|
+
],
|
|
882
|
+
expression: QUERY_EXPRESSIONS.AI_CALLS, reduceTo: REDUCE_OPERATIONS.SUM, stepInterval: QUERY_DEFAULTS.STEP_INTERVAL,
|
|
883
|
+
orderBy: [{ columnName: SPAN_KEYS.TIMESTAMP, order: ORDER_DIRECTIONS.DESC }], offset: QUERY_DEFAULTS.OFFSET,
|
|
884
|
+
disabled: QUERY_DEFAULTS.DISABLED, having: QUERY_DEFAULTS.HAVING, legend: QUERY_DEFAULTS.LEGEND, limit: QUERY_DEFAULTS.LIMIT_NULL,
|
|
885
|
+
},
|
|
886
|
+
|
|
887
|
+
lastActivity: {
|
|
888
|
+
dataSource: DATA_SOURCES.TRACES, queryName: QUERY_EXPRESSIONS.LAST_ACTIVITY,
|
|
889
|
+
aggregateOperator: AGGREGATE_OPERATORS.MAX,
|
|
890
|
+
aggregateAttribute: { key: SPAN_KEYS.TIMESTAMP, ...QUERY_FIELD_CONFIGS.INT64_TAG_COLUMN },
|
|
891
|
+
filters: { op: OPERATORS.AND, items: withProject([
|
|
892
|
+
{ key: { key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EXISTS, value: '' },
|
|
893
|
+
]) },
|
|
894
|
+
groupBy: [{ key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }],
|
|
895
|
+
expression: QUERY_EXPRESSIONS.LAST_ACTIVITY, reduceTo: REDUCE_OPERATIONS.MAX, stepInterval: QUERY_DEFAULTS.STEP_INTERVAL,
|
|
896
|
+
orderBy: [{ columnName: SPAN_KEYS.TIMESTAMP, order: ORDER_DIRECTIONS.DESC }], offset: QUERY_DEFAULTS.OFFSET,
|
|
897
|
+
disabled: QUERY_DEFAULTS.DISABLED, having: QUERY_DEFAULTS.HAVING, legend: QUERY_DEFAULTS.LEGEND, limit: QUERY_DEFAULTS.LIMIT_NULL,
|
|
898
|
+
},
|
|
899
|
+
|
|
900
|
+
contextErrors: {
|
|
901
|
+
dataSource: DATA_SOURCES.TRACES, queryName: QUERY_EXPRESSIONS.CONTEXT_ERRORS,
|
|
902
|
+
aggregateOperator: AGGREGATE_OPERATORS.COUNT,
|
|
903
|
+
aggregateAttribute: { key: SPAN_KEYS.SPAN_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN },
|
|
904
|
+
filters: { op: OPERATORS.AND, items: withProject([
|
|
905
|
+
{ key: { key: SPAN_KEYS.NAME, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN }, op: OPERATORS.EQUALS, value: SPAN_NAMES.CONTEXT_HANDLE },
|
|
906
|
+
{ key: { key: SPAN_KEYS.HAS_ERROR, ...QUERY_FIELD_CONFIGS.BOOL_TAG_COLUMN }, op: OPERATORS.EQUALS, value: true }, // real boolean
|
|
907
|
+
{ key: { key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EXISTS, value: '' },
|
|
908
|
+
]) },
|
|
909
|
+
groupBy: [{ key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }],
|
|
910
|
+
expression: QUERY_EXPRESSIONS.CONTEXT_ERRORS, reduceTo: REDUCE_OPERATIONS.SUM, stepInterval: QUERY_DEFAULTS.STEP_INTERVAL,
|
|
911
|
+
orderBy: [{ columnName: SPAN_KEYS.TIMESTAMP, order: ORDER_DIRECTIONS.DESC }], offset: QUERY_DEFAULTS.OFFSET,
|
|
912
|
+
disabled: QUERY_DEFAULTS.DISABLED, having: QUERY_DEFAULTS.HAVING, legend: QUERY_DEFAULTS.LEGEND, limit: QUERY_DEFAULTS.LIMIT_NULL,
|
|
913
|
+
},
|
|
914
|
+
|
|
915
|
+
agentGenerationErrors: {
|
|
916
|
+
dataSource: DATA_SOURCES.TRACES, queryName: QUERY_EXPRESSIONS.AGENT_GENERATION_ERRORS,
|
|
917
|
+
aggregateOperator: AGGREGATE_OPERATORS.COUNT,
|
|
918
|
+
aggregateAttribute: { key: SPAN_KEYS.SPAN_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN },
|
|
919
|
+
filters: { op: OPERATORS.AND, items: withProject([
|
|
920
|
+
{ key: { key: SPAN_KEYS.NAME, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN }, op: OPERATORS.EQUALS, value: SPAN_NAMES.AGENT_GENERATION },
|
|
921
|
+
{ key: { key: SPAN_KEYS.HAS_ERROR, ...QUERY_FIELD_CONFIGS.BOOL_TAG_COLUMN }, op: OPERATORS.EQUALS, value: true }, // real boolean
|
|
922
|
+
{ key: { key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EXISTS, value: '' },
|
|
923
|
+
]) },
|
|
924
|
+
groupBy: [{ key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }],
|
|
925
|
+
expression: QUERY_EXPRESSIONS.AGENT_GENERATION_ERRORS, reduceTo: REDUCE_OPERATIONS.SUM, stepInterval: QUERY_DEFAULTS.STEP_INTERVAL,
|
|
926
|
+
orderBy: [{ columnName: SPAN_KEYS.TIMESTAMP, order: ORDER_DIRECTIONS.DESC }], offset: QUERY_DEFAULTS.OFFSET,
|
|
927
|
+
disabled: QUERY_DEFAULTS.DISABLED, having: QUERY_DEFAULTS.HAVING, legend: QUERY_DEFAULTS.LEGEND, limit: QUERY_DEFAULTS.LIMIT_NULL,
|
|
928
|
+
},
|
|
929
|
+
|
|
930
|
+
userMessages: {
|
|
931
|
+
dataSource: DATA_SOURCES.TRACES, queryName: QUERY_EXPRESSIONS.USER_MESSAGES,
|
|
932
|
+
aggregateOperator: AGGREGATE_OPERATORS.MIN,
|
|
933
|
+
aggregateAttribute: { key: SPAN_KEYS.TIMESTAMP, ...QUERY_FIELD_CONFIGS.INT64_TAG_COLUMN },
|
|
934
|
+
filters: { op: OPERATORS.AND, items: withProject([
|
|
935
|
+
{ key: { key: SPAN_KEYS.MESSAGE_CONTENT, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EXISTS, value: '' },
|
|
936
|
+
{ key: { key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EXISTS, value: '' },
|
|
937
|
+
|
|
938
|
+
]) },
|
|
939
|
+
groupBy: [
|
|
940
|
+
{ key: SPAN_KEYS.CONVERSATION_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG },
|
|
941
|
+
{ key: SPAN_KEYS.MESSAGE_CONTENT, ...QUERY_FIELD_CONFIGS.STRING_TAG },
|
|
942
|
+
],
|
|
943
|
+
expression: QUERY_EXPRESSIONS.USER_MESSAGES, reduceTo: REDUCE_OPERATIONS.MIN, stepInterval: QUERY_DEFAULTS.STEP_INTERVAL,
|
|
944
|
+
orderBy: [{ columnName: SPAN_KEYS.TIMESTAMP, order: ORDER_DIRECTIONS.ASC }], offset: QUERY_DEFAULTS.OFFSET,
|
|
945
|
+
disabled: QUERY_DEFAULTS.DISABLED, having: QUERY_DEFAULTS.HAVING, legend: QUERY_DEFAULTS.LEGEND, limit: QUERY_DEFAULTS.LIMIT_NULL,
|
|
946
|
+
},
|
|
947
|
+
},
|
|
948
|
+
},
|
|
949
|
+
dataSource: DATA_SOURCES.TRACES, projectId,
|
|
950
|
+
};
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
private buildUniqueGraphsPayload(start: number, end: number, projectId?: string) {
|
|
954
|
+
const items: any[] = [
|
|
955
|
+
{ key: { key: SPAN_KEYS.GRAPH_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EXISTS, value: '' },
|
|
956
|
+
{ key: { key: SPAN_KEYS.GRAPH_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.NOT_EQUALS, value: UNKNOWN_VALUE },
|
|
957
|
+
...(projectId ? [{ key: { key: SPAN_KEYS.PROJECT_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EQUALS, value: projectId }] : []),
|
|
958
|
+
];
|
|
959
|
+
|
|
960
|
+
return {
|
|
961
|
+
start, end, step: QUERY_DEFAULTS.STEP, variables: {},
|
|
962
|
+
compositeQuery: {
|
|
963
|
+
queryType: QUERY_TYPES.BUILDER, panelType: PANEL_TYPES.TABLE,
|
|
964
|
+
builderQueries: {
|
|
965
|
+
uniqueGraphs: {
|
|
966
|
+
dataSource: DATA_SOURCES.TRACES, queryName: QUERY_EXPRESSIONS.UNIQUE_GRAPHS,
|
|
967
|
+
aggregateOperator: AGGREGATE_OPERATORS.COUNT,
|
|
968
|
+
aggregateAttribute: { key: SPAN_KEYS.SPAN_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN },
|
|
969
|
+
filters: { op: OPERATORS.AND, items },
|
|
970
|
+
groupBy: [{ key: SPAN_KEYS.GRAPH_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }],
|
|
971
|
+
expression: QUERY_EXPRESSIONS.UNIQUE_GRAPHS, reduceTo: REDUCE_OPERATIONS.SUM, stepInterval: QUERY_DEFAULTS.STEP_INTERVAL,
|
|
972
|
+
orderBy: [{ columnName: SPAN_KEYS.GRAPH_ID, order: ORDER_DIRECTIONS.ASC }], offset: QUERY_DEFAULTS.OFFSET,
|
|
973
|
+
disabled: QUERY_DEFAULTS.DISABLED, having: QUERY_DEFAULTS.HAVING, legend: QUERY_DEFAULTS.LEGEND, limit: QUERY_DEFAULTS.LIMIT_NULL,
|
|
974
|
+
},
|
|
975
|
+
},
|
|
976
|
+
},
|
|
977
|
+
dataSource: DATA_SOURCES.TRACES, projectId,
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
private buildUniqueModelsPayload(start: number, end: number, projectId?: string) {
|
|
982
|
+
const items: any[] = [
|
|
983
|
+
{ key: { key: SPAN_KEYS.AI_MODEL_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN }, op: OPERATORS.EXISTS, value: '' },
|
|
984
|
+
{ key: { key: SPAN_KEYS.AI_MODEL_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN }, op: OPERATORS.NOT_EQUALS, value: UNKNOWN_VALUE },
|
|
985
|
+
...(projectId ? [{ key: { key: SPAN_KEYS.PROJECT_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG }, op: OPERATORS.EQUALS, value: projectId }] : []),
|
|
986
|
+
];
|
|
987
|
+
|
|
988
|
+
return {
|
|
989
|
+
start, end, step: QUERY_DEFAULTS.STEP, variables: {},
|
|
990
|
+
compositeQuery: {
|
|
991
|
+
queryType: QUERY_TYPES.BUILDER, panelType: PANEL_TYPES.TABLE,
|
|
992
|
+
builderQueries: {
|
|
993
|
+
uniqueModels: {
|
|
994
|
+
dataSource: DATA_SOURCES.TRACES, queryName: QUERY_EXPRESSIONS.UNIQUE_MODELS,
|
|
995
|
+
aggregateOperator: AGGREGATE_OPERATORS.COUNT,
|
|
996
|
+
aggregateAttribute: { key: SPAN_KEYS.SPAN_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN },
|
|
997
|
+
filters: { op: OPERATORS.AND, items },
|
|
998
|
+
groupBy: [{ key: SPAN_KEYS.AI_MODEL_ID, ...QUERY_FIELD_CONFIGS.STRING_TAG_COLUMN }],
|
|
999
|
+
expression: QUERY_EXPRESSIONS.UNIQUE_MODELS, reduceTo: REDUCE_OPERATIONS.SUM, stepInterval: QUERY_DEFAULTS.STEP_INTERVAL,
|
|
1000
|
+
orderBy: [{ columnName: SPAN_KEYS.AI_MODEL_ID, order: ORDER_DIRECTIONS.ASC }], offset: QUERY_DEFAULTS.OFFSET,
|
|
1001
|
+
disabled: QUERY_DEFAULTS.DISABLED, having: QUERY_DEFAULTS.HAVING, legend: QUERY_DEFAULTS.LEGEND, limit: QUERY_DEFAULTS.LIMIT_NULL,
|
|
1002
|
+
},
|
|
1003
|
+
},
|
|
1004
|
+
},
|
|
1005
|
+
dataSource: DATA_SOURCES.TRACES, projectId,
|
|
1006
|
+
};
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
// ---------- Singleton export
|
|
1011
|
+
|
|
1012
|
+
let signozStatsClient: SigNozStatsAPI | null = null;
|
|
1013
|
+
|
|
1014
|
+
export function getSigNozStatsClient(): SigNozStatsAPI {
|
|
1015
|
+
return (signozStatsClient ??= new SigNozStatsAPI());
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
export { SigNozStatsAPI };
|