Skip to content

Conversation

@asanluis
Copy link
Contributor

@asanluis asanluis commented Aug 5, 2020

TODO if is the correct approach

  • Delete RequestZipkinHeader
  • Refactor kafkajs and expressjs instrumentation
  • Update README, add example usage of a custom propagation
  • Add AWS propagation module

asanluis added 5 commits July 15, 2020 23:47
// TODO if is the correct approach
 - Delete RequestZipkinHeader
 - Refactor kafkajs and expressjs instrumentation
 - Update README, add example usage of a custom propagation
 - Add AWS propagation module
// TODO if is the correct approach
 - Delete RequestZipkinHeader
 - Refactor kafkajs and expressjs instrumentation
 - Update README, add example usage of a custom propagation
 - Add AWS propagation module
// TODO if is the correct approach
 - Delete RequestZipkinHeader
 - Refactor kafkajs and expressjs instrumentation
 - Update README, add example usage of a custom propagation
 - Add AWS propagation module
this.sampler = sampler;
this.traceId128Bit = traceId128Bit;
this.supportsJoin = supportsJoin;
this._propagation = propagation;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know if a better approach is delete the extract and injector methods and only add a get propagation, this simplify the grpc-client implementation, thats need to know the propagation headers....

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would go for that instead.

this.tracer.setId(clientTraceId);

const proxyReqWithZipkinHeaders = Request.addZipkinHeaders(proxyReq, clientTraceId);
const proxyReqWithZipkinHeaders = this.tracer.injector(proxyReq);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather pass the clientTraceId explicitly instead of having the injector to know about the scope.

recordBinary(key: string, value: boolean | string | number): void;
writeIdToConsole(message: any): void;
/** Extract propagation ctx from request */
extractId(readHeader: <T> (header: string) => option.IOption<T>): void;
Copy link
Contributor

@jcchavezs jcchavezs Sep 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd prefer to have the extractId to be actually an extractor like the injector.

Also, maybe read header can be an abstract getter, not necessarily tight to http headers (e.g. in GRPC it is metadata)?

/** Extract propagation ctx from request */
extractId(readHeader: <T> (header: string) => option.IOption<T>): void;
/** Injector propagation ctx from request */
injector(request: any): object;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

injector can be for messaging too so I think it is better that we pass something like readHeader and call it setter and this return an object that performs the injection, does that make sense?

}
namespace propagation {
interface Propagation {
extractor<T>(tracer: Tracer, readHeader: <T> (header: string) => option.IOption<T>): TraceId;
Copy link
Contributor

@jcchavezs jcchavezs Sep 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, we pass the tracer to the extractor? is this really needed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In new tracing models we have propagation decoupled from tracer, I think we should follow similar pattern here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree we should not couple these


export { default as Instrumentation } from './instrumentation';
export { default as Request } from './request';
export { default as B3Propagation } from './propagation/b3propagation';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<3


recordRequest(method, requestUrl, readHeader) {
this._createIdFromHeaders(readHeader).ifPresent(id => this.tracer.setId(id));
this.tracer.extractId(readHeader);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am really happy this becomes so simple now.

headers[this.headers.Sampled] = sampled ? '1' : '0';
});

if (traceId.isDebug()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In here, if `traceId.isDebug()) then you don't need to pass sampling.

@jcchavezs
Copy link
Contributor

This is great work @asanluis I left you some comments cc @adriancole

@jcchavezs
Copy link
Contributor

I will come back to it this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants