(ctx context.Context, cli Cli)
| 113 | } |
| 114 | |
| 115 | func dockerMetricExporter(ctx context.Context, cli Cli) []sdkmetric.Option { |
| 116 | endpoint, secure := dockerExporterOTLPEndpoint(cli) |
| 117 | if endpoint == "" { |
| 118 | return nil |
| 119 | } |
| 120 | |
| 121 | opts := []otlpmetricgrpc.Option{ |
| 122 | otlpmetricgrpc.WithEndpoint(endpoint), |
| 123 | } |
| 124 | if !secure { |
| 125 | opts = append(opts, otlpmetricgrpc.WithInsecure()) |
| 126 | } |
| 127 | |
| 128 | exp, err := otlpmetricgrpc.New(ctx, opts...) |
| 129 | if err != nil { |
| 130 | otel.Handle(err) |
| 131 | return nil |
| 132 | } |
| 133 | return []sdkmetric.Option{sdkmetric.WithReader(newCLIReader(exp))} |
| 134 | } |
| 135 | |
| 136 | // unixSocketEndpoint converts the unix scheme from URL to |
| 137 | // an OTEL endpoint that can be used with the OTLP exporter. |
no test coverage detected
searching dependent graphs…