Skip to content

feat: using ports 5442/5443 to export traces/metrics #422

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ The final artifact is in `javaagent/build/libs/hypertrace-agent-<version>-all.ja
Download the [latest version](https://github.com/hypertrace/javaagent/releases/latest/download/hypertrace-agent-all.jar).

```bash
HT_REPORTING_ENDPOINT=http://localhost:4317 java -javaagent:javaagent/build/libs/hypertrace-agent-<version>-all.jar -jar app.jar
HT_REPORTING_ENDPOINT=http://localhost:5442 java -javaagent:javaagent/build/libs/hypertrace-agent-<version>-all.jar -jar app.jar
```
If TPA is configured with TLS server
```bash
HT_REPORTING_ENDPOINT=https://localhost:5443 java -javaagent:javaagent/build/libs/hypertrace-agent-<version>-all.jar -jar app.jar
```

By default the agent uses Otlp exporter.
Expand Down
2 changes: 1 addition & 1 deletion example-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
service_name: service_name
reporting:
endpoint: http://localhost:4317
endpoint: http://localhost:5442
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private static List<StringValue> initDefaultContentTypes() {

static final String DEFAULT_SERVICE_NAME = "unknown";
// Default reporting endpoint for traces and metrics
static final String DEFAULT_REPORTING_ENDPOINT = "http://localhost:4317";
static final String DEFAULT_REPORTING_ENDPOINT = "http://localhost:5442";
// 128 KiB
static final int DEFAULT_BODY_MAX_SIZE_BYTES = 128 * 1024;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ private void assertConfig(AgentConfig agentConfig) {
Assertions.assertEquals(
"/foo/bar/example.pem", agentConfig.getReporting().getCertFile().getValue());
Assertions.assertEquals(
"http://localhost:4317", agentConfig.getReporting().getEndpoint().getValue());
"http://localhost:5442", agentConfig.getReporting().getEndpoint().getValue());
Assertions.assertEquals(
"http://localhost:4317", agentConfig.getReporting().getMetricEndpoint().getValue());
"http://localhost:5442", agentConfig.getReporting().getMetricEndpoint().getValue());
Assertions.assertEquals(true, agentConfig.getReporting().getSecure().getValue());
Assertions.assertEquals(16, agentConfig.getDataCapture().getBodyMaxSizeBytes().getValue());
Assertions.assertEquals(
Expand Down Expand Up @@ -172,15 +172,15 @@ public void configWithSystemProps() throws IOException {
}

@Test
@SetEnvironmentVariable(key = "HT_REPORTING_ENDPOINT", value = "http://oltp.hypertrace.org:4317")
@SetEnvironmentVariable(key = "HT_REPORTING_ENDPOINT", value = "http://oltp.hypertrace.org:5442")
public void complexConfig() throws IOException {
// GIVEN a config file with a non-default reporting endpoint and an env-var with a different
// non-default otlp reporting endpoint
URL resource = getClass().getClassLoader().getResource("config.yaml");
// WHEN we load the config
AgentConfig agentConfig = HypertraceConfig.load(resource.getPath());
// VERIFY the trace and metric endpoints are the both the value of the env var
String expectedEndpoint = "http://oltp.hypertrace.org:4317";
String expectedEndpoint = "http://oltp.hypertrace.org:5442";
Assertions.assertEquals(expectedEndpoint, agentConfig.getReporting().getEndpoint().getValue());
Assertions.assertEquals(
expectedEndpoint, agentConfig.getReporting().getMetricEndpoint().getValue());
Expand Down Expand Up @@ -238,7 +238,7 @@ void nonDefaultReportingEndpoint() throws IOException {
// VERIFY the trace reporting type is OTLP
Assertions.assertEquals(
TraceReporterType.OTLP, agentConfig.getReporting().getTraceReporterType());
String expectedReportingEndpoint = "http://example.com:4317";
String expectedReportingEndpoint = "http://example.com:5442";
// VERIFY the trace reporting and metric reporting endpoints are both the specified value
Assertions.assertEquals(
expectedReportingEndpoint, agentConfig.getReporting().getEndpoint().getValue());
Expand All @@ -257,10 +257,10 @@ void nonDefaultMetricsEndpoint() throws IOException {
TraceReporterType.OTLP, agentConfig.getReporting().getTraceReporterType());
// VERIFY the trace reporting endpoint is still the default value
Assertions.assertEquals(
"http://localhost:4317", agentConfig.getReporting().getEndpoint().getValue());
"http://localhost:5442", agentConfig.getReporting().getEndpoint().getValue());
// VERIFY the metric reporting endpoint is the specified value
Assertions.assertEquals(
"http://example.com:4317", agentConfig.getReporting().getMetricEndpoint().getValue());
"http://example.com:5442", agentConfig.getReporting().getMetricEndpoint().getValue());
}

@Test
Expand Down
4 changes: 2 additions & 2 deletions otel-extensions/src/test/resources/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ enabled: false
propagationFormats:
- B3
reporting:
endpoint: http://localhost:4317
metric_endpoint: http://localhost:4317
endpoint: http://localhost:5442
metric_endpoint: http://localhost:5442
secure: true
trace_reporter_type: OTLP
metric_reporter_type: METRIC_REPORTER_TYPE_OTLP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ enabled: false
propagationFormats:
- B3
reporting:
endpoint: http://localhost:4317
metric_endpoint: http://localhost:4317
endpoint: http://localhost:5442
metric_endpoint: http://localhost:5442
secure: true
trace_reporter_type: OTLP
metric_reporter_type: METRIC_REPORTER_TYPE_OTLP
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
service_name: service
reporting:
metric_endpoint: http://example.com:4317
metric_endpoint: http://example.com:5442
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
service_name: service
reporting:
endpoint: http://example.com:4317
endpoint: http://example.com:5442
2 changes: 1 addition & 1 deletion otel-extensions/src/test/resources/zipkinConfig.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
service_name: service
reporting:
trace_reporter_type: ZIPKIN
endpoint: http://example.com:9411/api/v2/spans
endpoint: http://example.com:5442/api/v2/spans
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ abstract class SmokeTest extends Specification {
.withEnv("OTEL_BSP_SCHEDULE_DELAY", "10")
.withEnv("OTEL_EXPORTER_OTLP_ENDPOINT", "http://collector:55680")
.withEnv("HT_SERVICE_NAME", "CIService")
.withEnv("HT_REPORTING_ENDPOINT", "http://collector:4317")
.withEnv("HT_REPORTING_ENDPOINT", "http://collector:5442")
.withEnv("OTEL_TRACES_EXPORTER", "otlp")
.withImagePullPolicy(PullPolicy.alwaysPull())
.withEnv(extraEnv)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public abstract class AbstractSmokeTest {
private static final String NETWORK_ALIAS_OTEL_COLLECTOR = "collector";
private static final String NETWORK_ALIAS_OTEL_MOCK_STORAGE = "backend";
private static final String OTEL_EXPORTER_ENDPOINT =
String.format("http://%s:4317", NETWORK_ALIAS_OTEL_COLLECTOR);
String.format("http://%s:5442", NETWORK_ALIAS_OTEL_COLLECTOR);

// note - with OTEL 1.13, the value of this manifest property is specified
// as the version in the InstrumentationLibrary class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
public class OpenTelemetryCollector extends GenericContainer<OpenTelemetryCollector> {

public static final int JAEGER_COLLECTOR_THRIFT_PORT = 14268;
public static final int JAEGER_COLLECTOR_GRPC_PORT = 14250;
public static final int ZIPKIN_PORT = 9411;
public static final int OTLP_PORT = 4317;
public static final int HEALTH_CHECK_PORT = 13133;
public static final int JAEGER_COLLECTOR_GRPC_PORT = 14250;
public static final int HTTP_REVERSE_PROXY_PORT = 5442;
public static final int HTTPS_REVERSE_PROXY_PORT = 5443;
public static final int HEALTH_CHECK_PORT = 13133;

public OpenTelemetryCollector(String dockerImage) {
super(DockerImageName.parse(dockerImage));
Expand All @@ -41,8 +41,9 @@ protected void init() {
HEALTH_CHECK_PORT,
JAEGER_COLLECTOR_THRIFT_PORT,
JAEGER_COLLECTOR_GRPC_PORT,
ZIPKIN_PORT,
OTLP_PORT);
HTTP_REVERSE_PROXY_PORT,
HTTPS_REVERSE_PROXY_PORT
);
}

public static class BoundPortHttpWaitStrategy extends HttpWaitStrategy {
Expand Down
2 changes: 1 addition & 1 deletion smoke-tests/src/test/resources/ht-config-all-disabled.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
service_name: app_under_test
reporting:
endpoint: http://localhost:4317
endpoint: http://localhost:5442
trace_reporter_type: OTLP
secure: true
data_capture:
Expand Down
2 changes: 1 addition & 1 deletion smoke-tests/src/test/resources/ht-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
serviceName: app_under_test
reporting:
endpoint: http://localhost:4317
endpoint: http://localhost:5442
trace_reporter_type: OTLP