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

add Kafka Metric protobuf #204

Merged
merged 3 commits into from
Dec 15, 2023
Merged
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
30 changes: 30 additions & 0 deletions controller-api/src/main/proto/responsive/metrics/v1/metrics.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
syntax = "proto3";

package responsive.metrics.v1.metrics.proto;

import "opentelemetry/proto/resource/v1/resource.proto";
import "opentelemetry/proto/metrics/v1/metrics.proto";

option java_multiple_files = true;
option java_package = "dev.responsive.metrics.v1";

// a globally unique identifier for a resource in Responsive's
// metrics ecosystem
message TenantResource {
// the tenant in our system (organization ID) - we can always
// create a dedicated internal tenant for metrics that do not
// belong to any particular tenant
string tenant = 1;

// the resource (the entity in the system that reported the
// metrics that are collected)
opentelemetry.proto.resource.v1.Resource resource = 2;
}

// a metric that is reported from Responsive, for now this is
// just a simple wrapper over the open telemetry definition of
// a Resource Metrics. It is expected, though not enforced, that
// the metrics.resource here matches the TenantResource.resource
message ExportedMetric {
opentelemetry.proto.metrics.v1.ResourceMetrics metrics = 1;
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import io.opentelemetry.instrumentation.jmx.yaml.JmxConfig;
import io.opentelemetry.instrumentation.jmx.yaml.JmxRule;
import io.opentelemetry.instrumentation.jmx.yaml.RuleParser;
import io.opentelemetry.instrumentation.resources.ContainerResource;
import io.opentelemetry.sdk.OpenTelemetrySdk;
import io.opentelemetry.sdk.metrics.SdkMeterProvider;
import io.opentelemetry.sdk.metrics.export.PeriodicMetricReader;
Expand Down Expand Up @@ -83,15 +84,18 @@ public static OtelMetricsService create(
.build();

final var appId = ConfigUtils.responsiveAppId(streamsConfig, config);
final var attributes = Attributes
.builder()
.put(SERVICE_NAME_ATTR, appId + "-otel")
.put(RESPONSIVE_APPLICATION_ID_ATTR, appId)
.build();
final var resource = Resource
.empty() // the .default() one has attributes we don't care about
.merge(ContainerResource.get())
.merge(Resource.create(
Attributes.builder()
.put(SERVICE_NAME_ATTR, appId + "-otel")
.put(RESPONSIVE_APPLICATION_ID_ATTR, appId)
.build()));

final var meterProvider = SdkMeterProvider
.builder()
.setResource(Resource.create(attributes))
.setResource(resource)
.registerMetricReader(metricReader)
.build();

Expand Down
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,15 @@ dependencyResolutionManagement {
library("otel-exporter-logging", "io.opentelemetry:opentelemetry-exporter-logging:1.32.0");
library("otel-exporter-otlp", "io.opentelemetry:opentelemetry-exporter-otlp:1.32.0");
library("otel-jmx", "io.opentelemetry.instrumentation:opentelemetry-jmx-metrics:1.32.0-alpha")
library("otel-resource", "io.opentelemetry.instrumentation:opentelemetry-resources:1.32.0-alpha")
bundle("otel", listOf(
"otel-api",
"otel-sdk",
"otel-sdk-metrics",
"otel-exporter-logging",
"otel-exporter-otlp",
"otel-jmx",
"otel-resource"
))

// do not include these in jars that are distributed - these
Expand Down
Loading