-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Server Programmability
-
Programmability 2026-03-02
-
None
-
None
-
None
-
None
-
None
-
None
-
None
I had a (admittedly weird) situation where I wanted a private constructor (otel::metrics::MetricName) to be used in a friend class that was defined in a different file and module (disagg::MetricName). I marked otel::metrics::MetricName as MONGO_MOD_OPEN but still the module scanner gave me this error:
Illegal use of otel::metrics::MetricName::MetricName(StringData) outside of module observability.metrics: loc: src/mongo/otel/metrics/metric_names.h:62:15 usages: src/mongo/db/modules/atlas/src/disagg_storage/disagg_storage_metric_names.h:12:45 CONSTRUCTOR disagg::MetricName::MetricName (disagg_storage)
I worked around this by marking the constructor itself as MONGO_MOD_PUBLIC. I don't know if this is a bug or just a lack of documentation, but the documentation didn't indicate that the private constructor needed to be explicitly marked. It does seem rare that this case would come up, so documenting the workaround is probably sufficient.
- related to
-
SERVER-120062 Make MetricName lockdown less weird
-
- Backlog
-