Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gRPC Exporter Endpoint Configuration Variable Update #124

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

natemollica-nm
Copy link
Collaborator

@natemollica-nm natemollica-nm commented Feb 23, 2024

Changes proposed in this PR

Update consul-telemetry-collector to include gRPC endpoint configuration via environment variable to support Datadog OTLP metrics collection gRPC receiver endpoint.

  • Added similar environment variable configuration option to that CO_OTEL_HTTP_ENDPOINT for gRPC receivers: CO_OTEL_GRPC_ENDPOINT
  • Added similar CLI parameter flag to that of http-collector-endpoint for gRPC receivers: grpc-collector-endpoint

How I've tested this PR

  • Updated external_test.go with grpc forwarding tests
	t.Run("with tls grpc forwarder", func(t *testing.T) {
		provider := NewProvider(&config.ExporterConfig{
			ID: exporters.GRPCOtlpExporterID,
			Exporter: &exporters.ExporterConfig{
				Endpoint: "https://localhost:6060",
			},
		}, providers.SharedParams{})
		retrieved, err := provider.Retrieve(context.Background(), "", nil)
		test.NoError(t, err)

		conf, err := retrieved.AsConf()
		test.NoError(t, err)
		confMap := conf.ToStringMap()
		exporters := asMap(t, confMap["exporters"])
		otlp := asMap(t, exporters["otlp"])
		test.Eq(t, otlp["endpoint"], "https://localhost:6060")
		test.Eq(t, otlp["tls"], nil)
	})

	t.Run("with non-tls grpc forwarder", func(t *testing.T) {
		provider := NewProvider(&config.ExporterConfig{
			ID: exporters.GRPCOtlpExporterID,
			Exporter: &exporters.ExporterConfig{
				Endpoint: "http://localhost:6060",
			},
		}, providers.SharedParams{})
		retrieved, err := provider.Retrieve(context.Background(), "", nil)
		test.NoError(t, err)

		conf, err := retrieved.AsConf()
		test.NoError(t, err)
		confMap := conf.ToStringMap()
		exporters := asMap(t, confMap["exporters"])
		otlp := asMap(t, exporters["otlp"])
		test.Eq(t, otlp["endpoint"], "http://localhost:6060")
		tlsSetting := asMap(t, otlp["tls"])
		test.Eq(t, tlsSetting["insecure"], true)
		test.Eq(t, tlsSetting["insecure_skip_verify"], false)
	})
  • Ran make target for go tests.

How I expect reviewers to test this PR

  • Review repository updates to include gRPC endpoint environment variable and verify no conflicts with HCP cloud functionality.

Checklist

  • Tests added
  • [CHANGELOG entry added]

@natemollica-nm natemollica-nm marked this pull request as ready for review February 23, 2024 23:59
@natemollica-nm natemollica-nm requested review from a team as code owners February 23, 2024 23:59
@natemollica-nm natemollica-nm linked an issue Feb 24, 2024 that may be closed by this pull request
@natemollica-nm natemollica-nm self-assigned this Feb 24, 2024
@natemollica-nm natemollica-nm added the enhancement New feature or request label Feb 24, 2024
@Achooo Achooo removed their request for review June 28, 2024 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gRPC External Exporter Configuration Options Missing
2 participants