Adding resource tags dinamically after initialization
See original GitHub issueQuestion
First of all, congratulations on the awesome work!
On OpenTelemetry initialization we do something similar to the following:
var resource = Resources.CreateServiceResource(conf.ServiceName, serviceVersion: conf.ServiceVersion)
.Merge(new Resource(new Dictionary<string, object>
{
{"deployment.environment", conf.DeploymentEnvironment},
{"os.type", conf.OsType},
{"os.description", conf.OsDescription},
{"cloud.zone", conf.CloudZone},
{"host.id", conf.HostID},
{"host.name", conf.HostName},
{"host.type", conf.HostType},
}));
builder.SetResource(resource);
...
However, to fetch host and cloud information we have to block the initialization process to make calls to AWS API. We would prefer not to block initialization because of this.
Is there a way to add tags to the resource after initialization? Do you guys think of an alternative solution?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Initialize ResourceManager dynamically - asp.net
I have this function and it works fine to get a translated value from this specific resource file called OkayMessages. public static string ......
Read more >settings custom resource tags · Issue #696 · aws/copilot-cli
You'll be able to specify tags while initializing a project so that all resources in your project will have these tags. $ ecs-preview...
Read more >Grant permission to tag resources during creation
To enable users to tag resources on creation, they must have permissions to use the action that creates the resource, such as ec2:RunInstances...
Read more >Configure default tags for AWS resources | Terraform
Configure the AWS Terraform provider to set default tags on resources. Override default tags on individual resources.
Read more >Dynamic tags support based on resource annotation #2783
Currently I'm trying to use one provisioner that will provision nodes for all types of ML application, if an application using a specific...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For the caching strategy, yes, that would help with the allocation since we would only need to allocate the new Resource once.
For the enrichment part, it will affect performance when you use
Enrich
.I thought I did commit the benchmark for that. I will create a new PR adding it. But you can look here: https://github.com/open-telemetry/opentelemetry-dotnet/pull/1261#issuecomment-695062784
For the processor question, yes that should work as well.
As per the current spec for Resource, resource is associated with a TracerProvider/MeterProvider, and is same for all the traces/metrics from that provider, and cannot be changed after provider creation. It is a bug that we allow overriding resource on a per span/activity level. This will very likely be fixed with one of the pending PRs. So do not count on this behaviour.