-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Export temporal metrics to datadog #14842
Changes from 22 commits
e31eb19
ff9b519
f26a0b2
f872225
4e651ed
f56233a
586aad9
5bf4e67
33a18f5
85a56d2
43bee0c
1056890
1a113d8
413cbce
e29815a
0453ac7
9d5b795
3666dd5
1eb22dc
ac97b12
b1d1984
acf58da
1b7fbf4
12a422b
066cf5b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,15 @@ | |
package io.airbyte.workers.temporal; | ||
|
||
import com.google.common.annotations.VisibleForTesting; | ||
import com.uber.m3.tally.RootScopeBuilder; | ||
import com.uber.m3.tally.Scope; | ||
import com.uber.m3.tally.StatsReporter; | ||
import io.airbyte.commons.lang.Exceptions; | ||
import io.airbyte.config.Configs; | ||
import io.airbyte.config.EnvConfigs; | ||
import io.airbyte.metrics.lib.MetricClientFactory; | ||
import io.airbyte.scheduler.models.JobRunConfig; | ||
import io.micrometer.core.instrument.MeterRegistry; | ||
import io.temporal.activity.ActivityExecutionContext; | ||
import io.temporal.api.common.v1.WorkflowExecution; | ||
import io.temporal.api.namespace.v1.NamespaceConfig; | ||
|
@@ -21,6 +26,7 @@ | |
import io.temporal.client.WorkflowOptions; | ||
import io.temporal.client.WorkflowStub; | ||
import io.temporal.common.RetryOptions; | ||
import io.temporal.common.reporter.MicrometerClientStatsReporter; | ||
import io.temporal.serviceclient.SimpleSslContextBuilder; | ||
import io.temporal.serviceclient.WorkflowServiceStubs; | ||
import io.temporal.serviceclient.WorkflowServiceStubsOptions; | ||
|
@@ -90,15 +96,25 @@ public static WorkflowServiceStubs createTemporalService() { | |
private static WorkflowServiceStubsOptions getCloudTemporalOptions() { | ||
final InputStream clientCert = new ByteArrayInputStream(configs.getTemporalCloudClientCert().getBytes(StandardCharsets.UTF_8)); | ||
final InputStream clientKey = new ByteArrayInputStream(configs.getTemporalCloudClientKey().getBytes(StandardCharsets.UTF_8)); | ||
WorkflowServiceStubsOptions.Builder optionBuilder; | ||
try { | ||
return WorkflowServiceStubsOptions.newBuilder() | ||
optionBuilder = WorkflowServiceStubsOptions.newBuilder() | ||
.setSslContext(SimpleSslContextBuilder.forPKCS8(clientCert, clientKey).build()) | ||
.setTarget(configs.getTemporalCloudHost()) | ||
.build(); | ||
.setTarget(configs.getTemporalCloudHost()); | ||
} catch (final SSLException e) { | ||
log.error("SSL Exception occurred attempting to establish Temporal Cloud options."); | ||
throw new RuntimeException(e); | ||
} | ||
|
||
MeterRegistry registry = MetricClientFactory.getMeterRegistry(); | ||
if (registry != null) { | ||
StatsReporter reporter = new MicrometerClientStatsReporter(registry); | ||
Scope scope = new RootScopeBuilder() | ||
.reporter(reporter) | ||
.reportEvery(com.uber.m3.util.Duration.ofSeconds(10)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: this should be a constant |
||
optionBuilder.setMetricsScope(scope); | ||
} | ||
return optionBuilder.build(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for code readability, i think this should be moved into a private method called |
||
} | ||
|
||
@VisibleForTesting | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,6 +86,8 @@ otel-bom = {module = "io.opentelemetry:opentelemetry-bom", version = "1.14.0"} | |
otel-semconv = {module = "io.opentelemetry:opentelemetry-semconv", version = "1.14.0-alpha"} | ||
otel-sdk = {module = "io.opentelemetry:opentelemetry-sdk-metrics", version = "1.14.0"} | ||
otel-sdk-testing = {module = "io.opentelemetry:opentelemetry-sdk-metrics-testing", version = "1.13.0-alpha"} | ||
micrometer-statsd = {module = "io.micrometer:micrometer-registry-statsd", version = "1.9.2"} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good use of this pattern |
||
|
||
quartz-scheduler = {module="org.quartz-scheduler:quartz", version = "2.3.2"} | ||
|
||
[bundles] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this returning null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the default settings.
Doesn't mean anything - unless we want to inject customized configs in it, but in this case temporal side wouldn't consume anything anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha. Can we clean up the javadocs here to make it clear what the methods are used for? e.g. make it clear the
get
method is supposed to be stubbed out, and thehost
method is hardcoded.