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

feat: Support environment-service pair to map to traceproviders #240

Closed
wants to merge 4 commits into from

Conversation

thugrock7
Copy link
Contributor

No description provided.

Copy link

codecov bot commented Oct 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.75%. Comparing base (1fd91b9) to head (895af69).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #240      +/-   ##
==========================================
+ Coverage   59.37%   59.75%   +0.37%     
==========================================
  Files          72       72              
  Lines        2895     2902       +7     
==========================================
+ Hits         1719     1734      +15     
+ Misses       1095     1088       -7     
+ Partials       81       80       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@thugrock7 thugrock7 changed the title feat: register functions to include environment feat: Support environment-service pair to map to traceproviders Oct 25, 2024
Copy link
Contributor

@varkey98 varkey98 left a comment

Choose a reason for hiding this comment

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

Looking through the pr, I don't think we would need to change traceable or hypertrace goagent APIs. Can't we just manage this from TPA itself? cc @tim-mwangi @ryanericson ?

@@ -13,6 +13,11 @@ import (
"go.opentelemetry.io/otel/sdk/trace"
)

const (
environmentKey = "deployment.environment"
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is the key input from gateway agents, I think it should be prefixed with traceableai. I'd say traceableai.environment.name is a better key

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wanted to keep "traceable" name out of hypertrace repos. Don't know the convention we follow though

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 keep environment notion itself out of this repo. It'll be scattered if you add that notion here. Because initially we made it traceable specific one. ref, https://github.com/Traceableai/agent-config/blob/main/proto/ai/traceable/agent/config/v1/config.proto#L22

Copy link
Contributor

Choose a reason for hiding this comment

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

Now it's gonna be like hypertrace agent provides environment specific tracers, but traceable goagent is used for getting environment specific filters when you think about it from a tracer-filter pair pov

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree to keep environment notion out of this repo. Just thinking on lines of making traceable-goagent to have multi environment support as the TA, to register services there we mitigate that logic to RegisterServiceWithSpanProcessorWrapper() (here), the only problem is we assume a unique key for traceProviders here which service name used to do. But if we want to create a multi-env support for traceable-goagent, where a same service name can exist in different environments, this current setup fails due to this traceProviderMap. So here I only intend to use unique key to create tracer.
May be other way is to form a unique key in traceable-goagent itself, and use that to call the RegisterServiceWithSpanProcessorWrapper(unique_key, resourceAttributes), but as here we add resource attrs, didn't feel it generic enough and dropped that idea

Copy link
Contributor

Choose a reason for hiding this comment

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

I still dont understand why you can't add all of this logic in TPA itself?

Copy link
Contributor

@varkey98 varkey98 Oct 25, 2024

Choose a reason for hiding this comment

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

Is it that the argument name is service_name across our api, but actually we would be passing environment::sep::service_name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I still dont understand why you can't add all of this logic in TPA itself?

Currently we have for each service in extcap a unique tracerfilterpair .The tracerSets of ext_cap(link) use goagent to create a tracer, which in current setup will fail for cases of same service name which can be case in multiple environments. So to avoid depending on only service name as key which can no longer be unique, formed the unique key here (encode) itself in PR. Although this could could come from TPA itself, then we should decode for place like here to get to add resource attrs, and get service name etc correctly.

Copy link
Contributor

Choose a reason for hiding this comment

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

why do you want to decode the value? Afair, the map itself would be coming from TPA right?

@varkey98
Copy link
Contributor

Another thing is that all of these api's written assuming that service name is a resource attribute. The moment we start piggy backing on them for treating environment similarly to service name there'll be a disparity as TPA processors assume them to be a span attribute. This will happen across agents and easiest thing would be to use attributeaction processor to put this under both span and resource attributes till we update processors

@tim-mwangi
Copy link
Collaborator

Hey @thugrock7, what is this needed for? Do we want to support multiple environments in tracers as well?

@thugrock7
Copy link
Contributor Author

thugrock7 commented Oct 25, 2024

I was trying to make multi-environment support for ext_cap of TPA, which followed to make traceable-goagent to support multiple environments. It's different to other TA like ebpf, where TA can only one have environment. cc: @tim-mwangi

@thugrock7 thugrock7 closed this Oct 28, 2024
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