zuozhiw commented on code in PR #5376:
URL: https://github.com/apache/texera/pull/5376#discussion_r3680500759


##########
common/config/src/main/scala/org/apache/texera/observability/TexeraMetrics.scala:
##########
@@ -0,0 +1,227 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.texera.observability
+
+import com.typesafe.scalalogging.LazyLogging
+import io.opentelemetry.api.GlobalOpenTelemetry
+import io.opentelemetry.api.common.{AttributeKey, Attributes}
+import io.opentelemetry.api.metrics.Meter
+
+/**
+  * Strongly-typed façade for Texera-emitted metrics.
+  *
+  * Cardinality safety is enforced by the API surface, not by
+  * documentation: there is no public method that accepts an arbitrary
+  * string as a label key or value. The only labels that ever land on
+  * an instrument are the two enums [[Outcome]] and [[WorkflowKind]],
+  * each restricted to a fixed set. ``workflow.id`` / ``execution.id``
+  * are deliberately NOT metric labels — per-execution detail belongs
+  * in traces and logs, joined on ``trace_id`` at query time.
+  *
+  * Histogram bucket bounds are hard-coded constants so they can't be
+  * coerced by request input. The OTel SDK applies its own default
+  * attribute-value-length cap to anything that does slip through.
+  */
+object TexeraMetrics extends LazyLogging {

Review Comment:
   thanks, looks good



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to