mufiye commented on issue #10341:
URL: https://github.com/apache/skywalking/issues/10341#issuecomment-1427561102

   > We could use this(replace ConvertCase to another function) to set the 
metric name without parameter.
   > 
   > ```
   > metrics:
   >   set(metric.name, ConvertCase(metric.name, "snake"))
   > ```
   > 
   > 
https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/ottl/README.md#convert-metric-name-to-snake-case
   > 
   > Meanwhile, we could `set(attributes["job_id"], replace(metric.name, 
xxx))`. Of course, the `set(attributes...)` must run first, otherwise, the 
metadata lost.
   > 
   > Could you check what I am missing?
   
   Yes, you are right. And I have tried this before by below config. The most 
important thing I think is how to process the attributes in 
`set(attributes["job_id"], replace(metric.name, xxx))`.
   ```yaml
   processors:
     transform:
       metric_statements:
         - context: resource
           statements:
         - context: datapoint
           statements:
             - set(attributes["job_id"], metric.name)
         - context: metric
           statements:
             - replace_match(name, "system.*.cpu", "system.cpu")
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to