feat: allow providing arbitrary extra attributes to fiber_tracing middleware resource
This commit is contained in:
parent
9a1b41b1ad
commit
019de457c9
@ -25,15 +25,20 @@ type Config struct {
|
||||
// Name of an organization providing the service
|
||||
ServiceProvider string
|
||||
Exporters []exporters.TraceExporter
|
||||
ResourceAttributes []attribute.KeyValue
|
||||
}
|
||||
|
||||
func newResource(config Config) *resource.Resource {
|
||||
r := resource.NewWithAttributes(
|
||||
semconv.SchemaURL,
|
||||
semconv.ServiceNameKey.String(config.AppName),
|
||||
semconv.ServiceVersionKey.String(config.Version),
|
||||
allAttributes := make([]attribute.KeyValue, 0, 3)
|
||||
allAttributes = append(
|
||||
allAttributes,
|
||||
semconv.ServiceName(config.AppName),
|
||||
semconv.ServiceVersion(config.Version),
|
||||
attribute.String("service.provider", config.ServiceProvider),
|
||||
)
|
||||
allAttributes = append(allAttributes, config.ResourceAttributes...)
|
||||
|
||||
r := resource.NewWithAttributes(semconv.SchemaURL, allAttributes...)
|
||||
return r
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user