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

Add caller label for "tracing lite" #51

Merged
merged 9 commits into from
May 15, 2023
Merged

Add caller label for "tracing lite" #51

merged 9 commits into from
May 15, 2023

Conversation

keturiosakys
Copy link
Member

@keturiosakys keturiosakys commented May 10, 2023

This PR adds a caller label to function metrics. It uses asyncLocalStorage
API available in Node (and polyfilled in Deno) to register and pass on the
function name detail to the next function in the async call chain.

  • use asyncLocalStorage to track context of a function caller and add as label

@keturiosakys keturiosakys linked an issue May 10, 2023 that may be closed by this pull request
@keturiosakys keturiosakys marked this pull request as ready for review May 15, 2023 09:10
Copy link
Member

@oscarvz oscarvz left a comment

Choose a reason for hiding this comment

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

Looks good! Apart from one nit we can go ahead with it. As discussed earlier, this works in Node/Deno environments but will break in the browser - which we'll have to pick up right after merging this ✌️

@@ -10,6 +10,14 @@ import {
} from "./utils";
import { registerBuildInfo } from "./buildInfo";

import { AsyncLocalStorage } from "async_hooks";
Copy link
Member

Choose a reason for hiding this comment

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

This import can be moved underneath the @opentelemetry/api import on line 1.

@keturiosakys keturiosakys merged commit 871ba38 into main May 15, 2023
@keturiosakys keturiosakys deleted the caller-label branch May 15, 2023 11:12
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.

Support the caller label
2 participants