Skip to content

Commit

Permalink
Add otel protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
Sushisource committed Feb 5, 2025
1 parent 40fc1c0 commit c88760c
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/Temporalio/Bridge/OptionsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,17 @@ public static unsafe Interop.OpenTelemetryOptions ToInteropOptions(
default:
throw new ArgumentException("Unrecognized temporality");
}
switch (options.Protocol)
{
case Temporalio.Runtime.OpenTelemetryProtocol.Grpc:
temporality = Interop.OpenTelemetryProtocol.Grpc;

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / features-tests / test

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / features-tests / test

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / features-tests / test

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / features-tests / test

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / features-tests / test

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (macos-arm)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (macos-arm)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (macos-arm)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (macos-arm)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (macos-arm)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-latest)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-latest)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-latest)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-latest)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-latest)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-arm)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-arm)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-arm)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-arm)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-arm)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (macos-intel)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (macos-intel)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (macos-intel)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (macos-intel)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 91 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (macos-intel)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)
break;
case Temporalio.Runtime.OpenTelemetryProtocol.Http:
temporality = Interop.OpenTelemetryProtocol.Http;

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / features-tests / test

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / features-tests / test

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / features-tests / test

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / features-tests / test

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / features-tests / test

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (macos-arm)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (macos-arm)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (macos-arm)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (macos-arm)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (macos-arm)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-latest)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-latest)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-latest)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-latest)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-latest)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-arm)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-arm)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-arm)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-arm)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-arm)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (macos-intel)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (macos-intel)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (macos-intel)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (macos-intel)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)

Check failure on line 94 in src/Temporalio/Bridge/OptionsExtensions.cs

View workflow job for this annotation

GitHub Actions / build-lint-test (macos-intel)

The type or namespace name 'OpenTelemetryProtocol' does not exist in the namespace 'Temporalio.Bridge.Interop' (are you missing an assembly reference?)
break;
default:
throw new ArgumentException("Unrecognized protocol");
}
return new Interop.OpenTelemetryOptions()
{
url = scope.ByteArray(options.Url.ToString()),
Expand Down
6 changes: 6 additions & 0 deletions src/Temporalio/Bridge/include/temporal-sdk-bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ typedef enum OpenTelemetryMetricTemporality {
Delta,
} OpenTelemetryMetricTemporality;

typedef enum OpenTelemetryProtocol {
Grpc = 1,
Http,
} OpenTelemetryProtocol;

typedef enum RpcService {
Workflow = 1,
Operator,
Expand Down Expand Up @@ -217,6 +222,7 @@ typedef struct OpenTelemetryOptions {
uint32_t metric_periodicity_millis;
enum OpenTelemetryMetricTemporality metric_temporality;
bool durations_as_seconds;
enum OpenTelemetryProtocol protocol;
} OpenTelemetryOptions;

typedef struct PrometheusOptions {
Expand Down
7 changes: 7 additions & 0 deletions src/Temporalio/Bridge/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ pub struct OpenTelemetryOptions {
metric_periodicity_millis: u32,
metric_temporality: OpenTelemetryMetricTemporality,
durations_as_seconds: bool,
protocol: OpenTelemetryProtocol,
}

#[repr(C)]
Expand All @@ -92,6 +93,12 @@ pub enum OpenTelemetryMetricTemporality {
Delta,
}

#[repr(C)]
pub enum OpenTelemetryProtocol {
Grpc = 1,
Http,
}

#[repr(C)]
pub struct PrometheusOptions {
bind_address: ByteArrayRef,
Expand Down
4 changes: 2 additions & 2 deletions src/Temporalio/Runtime/OpenTelemetryMetricTemporality.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace Temporalio.Runtime
{
/// <summary>
/// Temporality for OpenTelemetrry metrics.
/// Temporality for OpenTelemetry metrics.
/// </summary>
public enum OpenTelemetryMetricTemporality
{
Expand All @@ -15,4 +15,4 @@ public enum OpenTelemetryMetricTemporality
/// </summary>
Delta,
}
}
}
5 changes: 5 additions & 0 deletions src/Temporalio/Runtime/OpenTelemetryOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ public OpenTelemetryOptions(string url)
/// </summary>
public bool UseSecondsForDuration { get; set; }

/// <summary>
/// Gets or sets the protocol to use for the OpenTelemetry collector.
/// </summary>
public OpenTelemetryProtocol Protocol { get; set; } = OpenTelemetryProtocol.Grpc;

/// <summary>
/// Create a shallow copy of these options.
/// </summary>
Expand Down
18 changes: 18 additions & 0 deletions src/Temporalio/Runtime/OpenTelemetryProtocol.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace Temporalio.Runtime
{
/// <summary>
/// Protocol for OpenTelemetry metrics.
/// </summary>
public enum OpenTelemetryProtocol
{
/// <summary>
/// Grpc.
/// </summary>
Grpc,

/// <summary>
/// Http.
/// </summary>
Http,
}
}

0 comments on commit c88760c

Please sign in to comment.