@@ -120,83 +120,6 @@ class MetricReport {
120120 get time ( ) {
121121 return this . #time;
122122 }
123-
124- /**
125- * Convert the metric report to a statsd-compatible string.
126- * @returns {string } The statsd-formatted metric report.
127- */
128- toStatsd ( ) {
129- const { type, name, value } = this ;
130- return `${ name } :${ value } |${ this . #statsdType( type ) } ` ;
131- }
132-
133- /*
134- * Convert the metric type to a statsd type.
135- *
136- * @param {string } type The metric type.
137- * @returns {string } The statsd type.
138- * @private
139- */
140- #statsdType( type ) {
141- return {
142- counter : 'c' ,
143- gauge : 'g' ,
144- pullGauge : 'g' ,
145- timer : 'ms' ,
146- } [ type ] ;
147- }
148-
149- /**
150- * Convert the metric report to a Dogstatsd-compatible string.
151- * @returns {string } The Dogstatsd-formatted metric report.
152- */
153- toDogStatsd ( ) {
154- return `${ this . toStatsd ( ) } ${ this . #dogstatsdTags( ) } ` ;
155- }
156-
157- /*
158- * Pack metadata into Dogstatsd-compatible tags.
159- *
160- * @returns {string } The packed metadata.
161- * @private
162- */
163- #dogstatsdTags( ) {
164- const entries = ObjectEntries ( this . meta ) ;
165- const pairs = ArrayPrototypeMap ( entries , ( { 0 : k , 1 : v } ) => `${ k } :${ v } ` ) ;
166- const tags = ArrayPrototypeJoin ( pairs , ',' ) ;
167- return tags . length ? `|${ tags } ` : '' ;
168- }
169-
170- /**
171- * Convert the metric report to a graphite-compatible string.
172- * @returns {string } The graphite-formatted metric report.
173- */
174- toGraphite ( ) {
175- const { name, value, time } = this ;
176- return `${ name } ${ value } ${ MathFloor ( time / 1000 ) } ` ;
177- }
178-
179- /**
180- * Convert the metric report to a Prometheus-compatible string.
181- * @returns {string } The Prometheus-formatted metric report.
182- */
183- toPrometheus ( ) {
184- const { name, value, time } = this ;
185- return `${ name } ${ this . #prometheusLabels( ) } ${ value } ${ time } ` ;
186- }
187-
188- /*
189- * Pack metadata into Prometheus-compatible labels.
190- *
191- * @returns {string } The packed metadata.
192- * @private
193- */
194- #prometheusLabels( ) {
195- const entries = ObjectEntries ( this . meta ) ;
196- const pairs = ArrayPrototypeMap ( entries , ( { 0 : k , 1 : v } ) => `${ k } ="${ v } "` ) ;
197- const labels = ArrayPrototypeJoin ( pairs , ',' ) ;
198- return labels . length ? `{${ labels } }` : '' ;
199- }
200123}
201124
202125/**
0 commit comments