feat: allow providing arbitrary extra attributes to fiber_tracing middleware resource
This commit is contained in:
parent
9a1b41b1ad
commit
019de457c9
@ -23,17 +23,22 @@ type Config struct {
|
||||
AppName string
|
||||
Version string
|
||||
// Name of an organization providing the service
|
||||
ServiceProvider string
|
||||
Exporters []exporters.TraceExporter
|
||||
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