(opts ...baseOption)
| 59 | func (fn option) metrics() {} |
| 60 | |
| 61 | func newConfig(opts ...baseOption) *config { |
| 62 | conf := &config{ |
| 63 | dbSystem: "redis", |
| 64 | attrs: []attribute.KeyValue{}, |
| 65 | |
| 66 | tp: otel.GetTracerProvider(), |
| 67 | mp: otel.GetMeterProvider(), |
| 68 | dbStmtEnabled: true, |
| 69 | callerEnabled: true, |
| 70 | filterProcess: DefaultCommandFilter, |
| 71 | filterProcessPipeline: func(cmds []redis.Cmder) bool { |
| 72 | for _, cmd := range cmds { |
| 73 | if DefaultCommandFilter(cmd) { |
| 74 | return true |
| 75 | } |
| 76 | } |
| 77 | return false |
| 78 | }, |
| 79 | } |
| 80 | |
| 81 | for _, opt := range opts { |
| 82 | opt.apply(conf) |
| 83 | } |
| 84 | |
| 85 | conf.attrs = append(conf.attrs, semconv.DBSystemKey.String(conf.dbSystem)) |
| 86 | |
| 87 | return conf |
| 88 | } |
| 89 | |
| 90 | func WithDBSystem(dbSystem string) Option { |
| 91 | return option(func(conf *config) { |
no test coverage detected