← Back to Pull requests

Semconv: type attributes after their values and expose whole enums #173

Closed
unknown closed this pull request without merging on Nov 09, 2026 16:30 UTC
View on GitHub
unknown unknown commented on Nov 07, 2026 00:07 UTC
Author

Closes #99.

Two problems in the generated semconv attribute definitions:

1. every attribute was a StringAttribute, whatever its registry type (http.response.status_code was declared as a string), and arrays and template[T] attributes were no exception;
2. enum attributes were a different shape from the others: a .base definition next to a well_known_values that held a single arbitrary member, the first one, and not the enum.

Changes

Typed attributes. The definition type now follows the registry type: IntAttribute, DoubleAttribute, BooleanAttribute, the four array forms, and template[T] takes the type of T. resource.zig and trace.zig already handled int, double and boolean, and now share one type map with attribute.zig, which also adds arrays. Unknown types still fall back to StringAttribute.

Enum attributes have the shape of every other attribute. There is no more .base: http_request_method.name, .stability... like server_port. well_known_values is a declaration holding the whole enum, void for attributes without well-known values:

const method = semconv.attribute.http_request_method;
method.name;                                   // was method.base.name
@TypeOf(method).well_known_values.get;         // the enum, same as http_request_methodValue.get

A declaration cannot be read through a value (method.well_known_values does not compile), hence the @TypeOf. The <name>Value enums are unchanged. This matches the other languages' generated semconv, where the key is a flat definition and none nests it under a wrapper: Go and Java put the well-known values beside the key (sibling constants, a nested ...Values class), and Rust has no well-known values at all, only key constants.

Int-valued enums. cpython.gc.generation and rpc.grpc.status_code have numeric members. They use a new IntEnumAttribute and spell their values with toInt(), instead of a toString() returning "0".

The generated files were regenerated with zig build semconv-generate (weaver v0.16.1, spec 1.36.0), from the updated templates; regenerating the unchanged templates first gave no diff.

Breaking changes

Intended, the module is alpha:

  • x.base.name / x.base.stability become x.name / x.stability for the 125 attributes with well-known values;

  • well_known_values is a type and no longer a value, and EnumAttribute.init no longer takes it;

  • the two int-valued enums no longer have toString();

  • attributes that were StringAttribute are now typed, e.g. http_response_status_code is an IntAttribute: code reading their examples gets ?[]const i64 and no longer ?[]const []const u8.
  • Related

    #84 builds on these definitions (sdk.attributes.fromPairs matches them structurally). Its builders.zig reads .base.name and the well_known_values field, so whichever of the two lands second needs a small follow-up

    Testing

    zig build semconv-test semconv-examples semconv-run-examples sdk-test, zig fmt --check. The examples assert the new shapes (typed definitions, well_known_values, int enums).

    Diff: 396 lines (+297 / -99) across 4 files Reviewer: inge4pres Review duration: 3863m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.43) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 396 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.358
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #173"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 43.2% (MEDIUM) · Higher = larger blast radius
    43.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.7% · Safe to merge
    18.7%