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 tracing configuration to the Context #26

Merged
merged 3 commits into from
Jan 24, 2022
Merged

add tracing configuration to the Context #26

merged 3 commits into from
Jan 24, 2022

Conversation

tpiperatgod
Copy link
Member

  1. add tracing configuration to the Context
  2. add tests for the Context parsing function

By default, the Tracing plugin is registered at the end of prePlugins and at the beginning of postPlugins

Signed-off-by: laminar <fangtian@kubesphere.io>
This reverts commit c288157.
context/context_test.go Outdated Show resolved Hide resolved
return nil, fmt.Errorf("invalid tracing provider name: %s", ctx.PluginsTracing.Provider.Name)
}
if ctx.PluginsTracing.Tags != nil {
if funcName, ok := ctx.PluginsTracing.Tags["func"]; !ok || funcName != ctx.Name {
Copy link
Member

@benjaminhuo benjaminhuo Jan 24, 2022

Choose a reason for hiding this comment

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

we might need to add pod's name to tracing plugin's tags map like replica: <podname>, together with func: <functionname>, it will provide more accurate tracing data. Simply add func: <functionname> is not ok, because a function has many replicas and the tracing should be specific to replica. Maybe the `replica: should be added in the tracing plugin code, but can we provide a function somewhere to retrieve current function replica's pod name?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

@benjaminhuo benjaminhuo Jan 24, 2022

Choose a reason for hiding this comment

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

yes, that's what I mean.
And we might need to add a function to be called by the tracing plugin maybe into the function framework?

Copy link
Member

Choose a reason for hiding this comment

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

The namespace is also useful to be added to tags

Copy link
Member Author

Choose a reason for hiding this comment

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

Added parsing function for the POD_NAME and POD_NAMESPACE environment variables, which have the following association with tags in the Tracing configuration:

tags['replica'] = <value from POD_NAME>
tags['namespace'] = <value from POD_NAMESPACE>

I wonder if this could solve the problem?

Copy link
Member

Choose a reason for hiding this comment

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

As in discussion OpenFunction/functions-framework#9 (comment), skywalking has service, instance and endpoint concept, for now, it seems that function is a service, replica is an instance, can we change replica to instance?

Copy link
Member

Choose a reason for hiding this comment

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

Added parsing function for the POD_NAME and POD_NAMESPACE environment variables, which have the following association with tags in the Tracing configuration:

tags['replica'] = <value from POD_NAME>
tags['namespace'] = <value from POD_NAMESPACE>

I wonder if this could solve the problem?

Yeah, it solved the problem

Copy link
Member Author

Choose a reason for hiding this comment

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

has changed replica to instance

Copy link
Member

@arugal arugal left a comment

Choose a reason for hiding this comment

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

LGTM

return nil, fmt.Errorf("invalid tracing provider name: %s", ctx.PluginsTracing.Provider.Name)
}
if ctx.PluginsTracing.Tags != nil {
if funcName, ok := ctx.PluginsTracing.Tags["func"]; !ok || funcName != ctx.Name {
Copy link
Member

Choose a reason for hiding this comment

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

As in discussion OpenFunction/functions-framework#9 (comment), skywalking has service, instance and endpoint concept, for now, it seems that function is a service, replica is an instance, can we change replica to instance?

Signed-off-by: laminar <fangtian@kubesphere.io>
@benjaminhuo benjaminhuo merged commit b33d2b8 into OpenFunction:main Jan 24, 2022
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

3 participants