in pkg/metricgen/otlp.go [98:117]
func newOTLPMetricHTTPExporter(ctx context.Context, cfg config) (*otlpmetrichttp.Exporter, error) {
endpoint, err := otlpEndpoint(cfg.apmServerURL)
if err != nil {
return nil, err
}
tlsConfig := &tls.Config{InsecureSkipVerify: !cfg.verifyServerCert}
opts := []otlpmetrichttp.Option{
otlpmetrichttp.WithEndpoint(endpoint.Host),
otlpmetrichttp.WithTLSClientConfig(tlsConfig),
}
if endpoint.Scheme == "http" {
opts = append(opts, otlpmetrichttp.WithInsecure())
}
headers := map[string]string{"Authorization": "ApiKey " + cfg.apiKey}
opts = append(opts, otlpmetrichttp.WithHeaders(headers))
return otlpmetrichttp.New(ctx, opts...)
}