Skip to content

Commit d06c632

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 b65b3b5 commit d06c632

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
@@ -185,7 +185,7 @@ func TestRequestEventIdentityFields(t *testing.T) {
185185
name: "system endpoint has empty index",
186186
method: http.MethodGet,
187187
path: "/_cluster/health",
188-
wantRouteName: clusterHealthName,
188+
wantRouteName: opNameClusterHealth,
189189
wantIndex: "",
190190
wantPath: "/_cluster/health",
191191
},

0 commit comments

Comments
 (0)