Skip to content

Commit 424f03b

Browse files
committed
style(opensearchtransport): name all OperationID String labels as constants
Replace the String() switch's string literals with a complete opName* constant registry, and reference the constants from the discovery-flag map and internal tests. One declaration per wire token; adding an operation follows a fixed pattern and tooling can trace every use. Signed-off-by: Sean Chittenden <sean.chittenden@crowdstrike.com>
1 parent 77f88cf commit 424f03b

3 files changed

Lines changed: 298 additions & 197 deletions

File tree

opensearchtransport/feature_config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ func (f discoveryFeatures) nodeStatsEnabled() bool {
173173
//
174174
//nolint:gochecknoglobals // Package-level constant map for config parsing.
175175
var discoveryFlagNames = map[string]discoveryFeatures{
176-
"cat_shards": discoverySkipCatShards,
176+
opNameCatShards: discoverySkipCatShards,
177177
"routing_num_shards": discoverySkipRoutingNumShards,
178-
clusterHealthName: discoverySkipClusterHealth,
178+
opNameClusterHealth: discoverySkipClusterHealth,
179179
"node_stats": discoverySkipNodeStats,
180180
}
181181

opensearchtransport/observer_response_internal_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func TestRequestEventIdentityFields(t *testing.T) {
182182
name: "system endpoint has empty index",
183183
method: http.MethodGet,
184184
path: "/_cluster/health",
185-
wantRouteName: clusterHealthName,
185+
wantRouteName: opNameClusterHealth,
186186
wantIndex: "",
187187
wantPath: "/_cluster/health",
188188
},

0 commit comments

Comments
 (0)