Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update span parser #797

Merged
merged 5 commits into from
Jul 26, 2021
Merged

Update span parser #797

merged 5 commits into from
Jul 26, 2021

Conversation

xiao-lix
Copy link
Contributor

No description provided.

@xiao-lix xiao-lix requested a review from hectorhdzg July 26, 2021 19:46
Comment on lines +21 to +22
const isHttp: boolean = (!!span.attributes[Constants.SpanAttribute.HttpStatusCode]) || (!!span.attributes[Constants.SpanAttribute.HttpUrl]);
const isGrpc: boolean = (!!span.attributes[Constants.SpanAttribute.GrpcStatusCode]);
Copy link
Contributor Author

@xiao-lix xiao-lix Jul 26, 2021

Choose a reason for hiding this comment

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

  • to check if it's http, check span[HTTP_STATUS_CODE] reference
  • to check if it's grpc, check span[RPC_GRPC_STATUS_CODE] reference

const pathname = url.pathname || "/";

// Translate to AI Dependency format
const name = `${method} ${pathname}`;
const dependencyTypeName = Constants.DependencyTypeName.Http;
const target = port ? `${host}:${port}`.toString() : host.toString();
const target = span.attributes[Constants.SpanAttribute.HttpUrl].toString() || undefined;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • for HTTP, target is [new URL(span[HTTP_URL])].hostname reference
  • for GRPC, target is span[GRPC_METHOD] reference
  • else, target is span[HTTP_URL] | undefined reference

Comment on lines +133 to +135
GrpcStatusCode: conventions.SemanticAttributes.RPC_GRPC_STATUS_CODE,
GrpcMethod: conventions.SemanticAttributes.RPC_METHOD, // rpc not grpc
GrpcService: conventions.SemanticAttributes.RPC_SERVICE, // rpc not grpc
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All GRPC related constants reference

Comment on lines +127 to +130
HttpMethod: conventions.SemanticAttributes.HTTP_METHOD,
HttpStatusCode: conventions.SemanticAttributes.HTTP_STATUS_CODE,
HttpUrl: conventions.SemanticAttributes.HTTP_URL,
HttpUserAgent: conventions.SemanticAttributes.HTTP_USER_AGENT,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All HTTP related constants reference

Copy link
Member

@hectorhdzg hectorhdzg left a comment

Choose a reason for hiding this comment

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

LGTM

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.

None yet

2 participants