Open Q&A
If there's no good subforum for your question - ask it here!
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Monaco creates new segment when segments are manually updated

kumaravel
Advisor

We are using Monaco to create a number of segments.

When segments are manually edited and then Monaco is re-run, instead of overriding the existing segment, a new segment with the same name is recreated.

Is this behaviour as expected?

Dynatrace Certified Associate
4 REPLIES 4

AntonPineiro
DynaMight Guru
DynaMight Guru

Hi,

This is not behaviour using another APIs.

Are you using latest Monaco version? If yes, maybe, I will open a support case.

Best regards

❤️ Emacs ❤️ Vim ❤️ Bash ❤️ Perl

t_pawlak
Leader

Hi,

I would not expect Monaco to create a duplicate segment just because the existing segment was manually updated.

However, I would first verify how Monaco identifies this particular segment after the manual change. The local `id` in Monaco is not the same as the Dynatrace object ID, so if the object can no longer be matched correctly, Monaco may treat it as a new configuration instead of updating the existing one.

I would suggest checking:

  • Monaco CLI version
  • whether the segment was originally created by Monaco or imported/downloaded later
  • whether the manual change modified any unique identifier/reference used by the Settings API object
  • running a fresh "monaco download" and comparing the downloaded object with the one in Git

If this is reproducible with the latest Monaco version, I would open a Dynatrace support case, because creating another segment with the same name sounds risky and not like the expected GitOps/idempotent behavior.

Best regards,
Tomasz

kumaravel
Advisor

I tried to check what happen when monaco creates a segment vs creation via the UI.

Segments created via Monaco has a field 'externalId' with a prefix of monaco (eg- monaco-8b94be1f-03b1-3872-89d7-8ac135f5aff2)

But segments created via UI miss the field externalId. Also when a Monaco created segment is updated from the UI, the field externalId is deleted.

Seems Monaco uses the externalId fields to check for an existing segment and then updated it. But deletion of externalId fields seems the reason for Monaco to not find the segments and recreate a new one.

The Monaco download only return the uid. The externalId was visible via swagger.

kumaravel_0-1780412699570.png

Tried it with v2.28.5 and v2.28.8

Please let me know in case more details are needed.

Dynatrace Certified Associate

sujit_k_singh
Champion

Hi @kumaravel 

Yes, this is expected behaviour when segments are manually edited outside of Monaco.

Monaco uses the configuration name as the unique identifier when creating or updating configurations. Monaco configuration YAML file - list of special configuration types — Dynatrace Docs

 Here's what's happening:

When you manually edit a segment, the platform assigns it a new ID. When Monaco re-runs, it looks for a configuration matching its tracked identifier — but because the manual edit changed the underlying object ID, Monaco no longer recognises it as the same segment. So it creates a new one with the same name rather than updating the existing one.

i would suggest to use monaco deploy --dry-run before deploying to preview what Monaco intends to create vs. update — this will flag duplicates before they happen.

Thanks,

Sujit

Dynatrace Professional Certified

Featured Posts