Socket
Socket
Sign inDemoInstall

@codesee/trace-datadog-rum

Package Overview
Dependencies
Maintainers
9
Versions
617
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.402.0 to 0.403.0

8

dist/dd-client-trace.d.ts

@@ -1,6 +0,2 @@

import { RumEvent } from "@datadog/browser-rum";
export declare function initCodeSeeDDTrace({ clientToken, env, version, }: {
clientToken: string;
env: string;
version?: string;
}): (event: RumEvent) => boolean | undefined;
import { RumUserConfiguration } from "@datadog/browser-rum";
export declare function initCodeSeeDDTrace(clientToken: string, args: RumUserConfiguration): void;

@@ -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"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;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Environment,browserRum=require("@datadog/browser-rum");function __awaiter(e,a,c,d){return new(c=c||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 c?n:new c(function(e){e(n)})).then(o,r)}i((d=d.apply(e,a||[])).next())})}!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(e,n){var t=null!==(i=n.env)&&void 0!==i?i:"",o=n.version,r=n.beforeSend,i=null!==(i=n.service)&&void 0!==i?i:"";n.beforeSend=initialize({clientToken:e,env:t,version:o,userBeforeSend:r,serviceName:i}),browserRum.datadogRum.init(n)}function initialize({clientToken:i,env:a,version:c,serviceName:d,userBeforeSend:s}){let u=[],v=Date.now();return"undefined"!=typeof document&&(document.onvisibilitychange=()=>{"hidden"===document.visibilityState&&doSendTraces(i,u)}),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:c;e=e||"";o={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!==(o=n.service)&&void 0!==o?o:d,env:a},type:"http"}]};return u.push(o),maybeSendTraces(i,u,queueLimit,v)&&(v=Date.now(),u=[]),!s||s(n)}}}}exports.initCodeSeeDDTrace=initCodeSeeDDTrace;
{
"name": "@codesee/trace-datadog-rum",
"version": "0.402.0",
"version": "0.403.0",
"description": "CodeSee datadog client side trace library",

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

},
"files": [
"dist"
],
"keywords": [

@@ -48,0 +51,0 @@ "datadog",

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