import { ApmFields , ApmUserAgentFields } from './apm_fields' ; import { Entity } from '../entity' ; import { RumSpan } from './rum_span' ; import { RumTransaction } from './rum_transaction' ; export class Browser extends Entity < ApmFields > { transaction ( transactionName , transactionType = 'page-load' ) { return new RumTransaction ( { ... this . fields , 'transaction.name' : transactionName , 'transaction.type' : transactionType , } ) ; } span ( spanName , spanType , spanSubtype ) { return new RumSpan ( { ... this . fields , 'span.name' : spanName , 'span.type' : spanType , 'span.subtype' : spanSubtype , } ) ; } } export function browser ( serviceName , production , userAgent ) { return new Browser ( { 'agent.name' : 'rum-js' , 'service.name' : serviceName , 'service.environment' : production , ... userAgent , } ) ; }