Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@codesee/trace-datadog-rum

Package Overview
Dependencies
Maintainers
9
Versions
656
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codesee/trace-datadog-rum - npm Package Compare versions

Comparing version 0.398.0 to 0.399.0

2

dist/index.js

@@ -1,1 +0,1 @@

"use strict";function __awaiter(e,c,a,d){return new(a=a||Promise)(function(t,n){function o(e){try{i(d.next(e))}catch(e){n(e)}}function r(e){try{i(d.throw(e))}catch(e){n(e)}}function i(e){var n;e.done?t(e.value):((n=e.value)instanceof a?n:new a(function(e){e(n)})).then(o,r)}i((d=d.apply(e,c||[])).next())})}var Environment;Object.defineProperty(exports,"__esModule",{value:!0}),function(e){e.Development="development",e.Production="production"}(Environment=Environment||{});const developmentConfig={INGESTION_SERVICE:"http://localhost:3867",NODE_ENV:Environment.Development},environment=process.env.NODE_ENV||Environment.Development,defaultConfig={INGESTION_SERVICE:"https://in-datadog.codesee.io",LOG_LEVEL:process.env.LOG_LEVEL||"info",NODE_ENV:environment},configs={[Environment.Development]:developmentConfig,[Environment.Production]:defaultConfig},environmentConfig=configs[environment];var config=Object.assign(Object.assign({},defaultConfig),environmentConfig);const sendTimout=6e5,queueLimit=25;function doSendTraces(e,n){return __awaiter(this,void 0,void 0,function*(){0!==n.length&&fetch(`${config.INGESTION_SERVICE}/api/v1/client/traces`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer "+e},body:JSON.stringify(n)}).then(e=>{console.info(`trace-datadog-rum: Received ${e.status} from client trace fetch.`)}).catch(e=>{console.error("trace-datadog-rum: Error sending client trace.",e)})})}function maybeSendTraces(e,n,t,o){return(n.length>=t||Date.now()-o>=sendTimout)&&(doSendTraces(e,n),!0)}function initCodeSeeDDTrace({clientToken:i,env:c,version:a}){let d=[],s=Date.now();return void 0!==document&&(document.onvisibilitychange=()=>{"hidden"===document.visibilityState&&doSendTraces(i,d)}),n=>{var t;if("resource"===n.type){var o=n;if("fetch"===o.resource.type||"xhr"===o.resource.type){var r=null!==(t=o._dd.trace_id)&&void 0!==t?t:"0";let e=null!==(t=o.version)&&void 0!==t?t:a;e=e||"";n={traceID:r,startTime:n.date,endTime:n.date+o.resource.duration,spans:[{name:o.resource.type,resource:null!==(t=null===(t=o.resource.method)||void 0===t?void 0:t.toUpperCase())&&void 0!==t?t:"",traceID:r,spanID:null!==(r=o._dd.span_id)&&void 0!==r?r:"0",parentID:"0",start:n.date,duration:o.resource.duration,error:0,meta:{version:e.toString(),"span.kind":"client","http.method":null!==(r=null===(r=o.resource.method)||void 0===r?void 0:r.toUpperCase())&&void 0!==r?r:"","http.url":o.resource.url,"http.status_code":null!==(o=o.resource.status_code)&&void 0!==o?o:0,service:null!==(n=n.service)&&void 0!==n?n:"",env:c},type:"http"}]};return d.push(n),maybeSendTraces(i,d,queueLimit,s)&&(s=Date.now(),d=[]),!0}}}}exports.initCodeSeeDDTrace=initCodeSeeDDTrace;
"use strict";function __awaiter(e,c,a,d){return new(a=a||Promise)(function(t,n){function o(e){try{i(d.next(e))}catch(e){n(e)}}function r(e){try{i(d.throw(e))}catch(e){n(e)}}function i(e){var n;e.done?t(e.value):((n=e.value)instanceof a?n:new a(function(e){e(n)})).then(o,r)}i((d=d.apply(e,c||[])).next())})}var Environment;Object.defineProperty(exports,"__esModule",{value:!0}),function(e){e.Development="development",e.Production="production"}(Environment=Environment||{});const developmentConfig={INGESTION_SERVICE:"http://localhost:3867",NODE_ENV:Environment.Development},environment=process.env.NODE_ENV||Environment.Development,defaultConfig={INGESTION_SERVICE:"https://in-datadog.codesee.io",LOG_LEVEL:process.env.LOG_LEVEL||"info",NODE_ENV:environment},configs={[Environment.Development]:developmentConfig,[Environment.Production]:defaultConfig},environmentConfig=configs[environment];var config=Object.assign(Object.assign({},defaultConfig),environmentConfig);const sendTimout=6e5,queueLimit=25;function doSendTraces(e,n){return __awaiter(this,void 0,void 0,function*(){0!==n.length&&fetch(`${config.INGESTION_SERVICE}/api/v1/client/traces`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer "+e},body:JSON.stringify(n)}).then(e=>{console.info(`trace-datadog-rum: Received ${e.status} from client trace fetch.`)}).catch(e=>{console.error("trace-datadog-rum: Error sending client trace.",e)})})}function maybeSendTraces(e,n,t,o){return(n.length>=t||Date.now()-o>=sendTimout)&&(doSendTraces(e,n),!0)}function initCodeSeeDDTrace({clientToken:i,env:c,version:a}){let d=[],s=Date.now();return"undefined"!=typeof document&&(document.onvisibilitychange=()=>{"hidden"===document.visibilityState&&doSendTraces(i,d)}),n=>{var t;if("resource"===n.type){var o=n;if("fetch"===o.resource.type||"xhr"===o.resource.type){var r=null!==(t=o._dd.trace_id)&&void 0!==t?t:"0";let e=null!==(t=o.version)&&void 0!==t?t:a;e=e||"";n={traceID:r,startTime:n.date,endTime:n.date+o.resource.duration,spans:[{name:o.resource.type,resource:null!==(t=null===(t=o.resource.method)||void 0===t?void 0:t.toUpperCase())&&void 0!==t?t:"",traceID:r,spanID:null!==(r=o._dd.span_id)&&void 0!==r?r:"0",parentID:"0",start:n.date,duration:o.resource.duration,error:0,meta:{version:e.toString(),"span.kind":"client","http.method":null!==(r=null===(r=o.resource.method)||void 0===r?void 0:r.toUpperCase())&&void 0!==r?r:"","http.url":o.resource.url,"http.status_code":null!==(o=o.resource.status_code)&&void 0!==o?o:0,service:null!==(n=n.service)&&void 0!==n?n:"",env:c},type:"http"}]};return d.push(n),maybeSendTraces(i,d,queueLimit,s)&&(s=Date.now(),d=[]),!0}}}}exports.initCodeSeeDDTrace=initCodeSeeDDTrace;
{
"name": "@codesee/trace-datadog-rum",
"version": "0.398.0",
"version": "0.399.0",
"description": "CodeSee datadog client side trace library",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -83,3 +83,3 @@ import { RumEvent, RumResourceEvent } from "@datadog/browser-rum";

if (document !== undefined) {
if (typeof document !== "undefined") {
document.onvisibilitychange = () => {

@@ -86,0 +86,0 @@ if (document.visibilityState === "hidden") {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc