apm-agent-rum-js icon indicating copy to clipboard operation
apm-agent-rum-js copied to clipboard

typescript types do not match the API

Open AndyOGo opened this issue 3 years ago • 2 comments

The Typescript types provided by @elastic/apm-rum package via types property in package.json are incomplete and partly incorrect.

Basespan is missing various public properties and methods, like id and parentId.

  • see https://support.elastic.co/customers/s/case/5004M00000eajyjQAA/log-correlation-and-context-propagation-with-websocket

  • is https://github.com/elastic/apm-agent-rum-js/blob/fe7070ec8874d5e67151be20bc78b3ad57c9aaef/packages/rum/src/index.d.ts#L27-L29

  • should: https://github.com/elastic/apm-agent-rum-js/blob/fe7070ec8874d5e67151be20bc78b3ad57c9aaef/packages/rum-core/src/performance-monitoring/span-base.js#L36-L59

Transaction is missing public methods, like detectFinish

  • is: https://github.com/elastic/apm-agent-rum-js/blob/fe7070ec8874d5e67151be20bc78b3ad57c9aaef/packages/rum/src/index.d.ts#L30-L53

  • should: https://github.com/elastic/apm-agent-rum-js/blob/fe7070ec8874d5e67151be20bc78b3ad57c9aaef/packages/rum-core/src/performance-monitoring/transaction.js#L129-L135

AndyOGo avatar Aug 12 '22 07:08 AndyOGo

Hi @AndyOGo,

Thanks for reaching out!

We will have a look and will let you know

CC: @vigneshshanmugam @kyungeunni

devcorpio avatar Aug 12 '22 09:08 devcorpio

Thanks for raising this.

Missing id and parentId.

We decided against exposing the id and parentId as changing can cause distributed tracing to break easily, But if there is a good use-case like doing manual context propagation then we can expose it.

Transaction is missing public methods, like detectFinish

transaction.detectFinish is an internal method we use to check if the transaction can be ended safely. Users should never call this method, instead they would need to call transaction.end().

Let us know if you need more details.

vigneshshanmugam avatar Sep 22 '22 19:09 vigneshshanmugam