+
    uG9j5                       a  R8 t?0 t R t^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHtH	t	 ^ RI
Ht ^ RIHt ^ RIHtHt ^ RIHt ^ RIHtHtHtHt ^ RIHtHtHt ]P8                  ! ]4      t]]] ]!]"]	]]] ]!]"3,          ,          3,          t#]! 4       t$]PJ                  ! 4       t&R	s']! R
R	R7      t(] ^ k ]! ^R7      R R l4       t)R R lt*R R lt+R R lt,R R lt-] ! R R4      4       t.R R lt/R R lt0R R lt1R9R R  llt2R!R/R" R# llt3R$ R% lt4]Pj                  3R& R' llt6]R:R( R) ll4       t7R;R* R+ llt8R:R, R- llt9R:R. R/ llt:R0 R1 lt;]R2 R3 l4       t<R4 R5 lt= ! R6 R74      t>R# )<a   Centralized telemetry for the Anaconda CLI framework.

All functions are safe to call regardless of whether telemetry is configured.
When telemetry is disabled, every function is a no-op. Imports of the OTel SDK
are deferred until the backend initializes.
N)	GeneratorSequence)contextmanager)
ContextVar)	dataclassfield)	lru_cache)AnyDictOptionalUnion)TelemetryConfigAUTHENTICATED_ENDPOINTPUBLIC_ENDPOINTF_suppress_http)default)maxsizec                F    V ^8  d   QhR\         \        \        3,          /#    return)r
   str)formats   ";lib/python3.14/site-packages/anaconda_cli_base/telemetry.py__annotate__r   '   s      d38n     c                      ^ RI Hp  ^ RIHp RV/pV ! RR7       FJ  pVP                  '       g   K  VP                  P
                  R,          W#P                  P                  &   KL  	  V# )    )entry_points__version__anaconda-cli-basezanaconda_cli.subcommand)groupVersion)importlib.metadatar   anaconda_cli_baser    distmetadataname)r   r    versionseps       r   _get_plugin_versionsr+   &   sQ    /-#[1H!:;777%'WW%5%5i%@HWW\\" < Or   c                $    V ^8  d   QhR\         /# r   r   )r   s   "r   r   r   2   s      3 r   c                     R RRRRRRRRR	R
RRRRRRRRR/
p V P                  4        F.  w  r\        P                  P                  V4      '       g   K,  Vu # 	  \        P                  P                  R4      '       d   R# R# )GITHUB_ACTIONSzgithub-actions	GITLAB_CIz	gitlab-ciJENKINS_URLjenkinsCIRCLECIcircleciTRAVISz	travis-ci	BUILDKITE	buildkiteTF_BUILDzazure-pipelinesCODEBUILD_BUILD_IDzaws-codebuildTEAMCITY_VERSIONteamcityBITBUCKET_PIPELINE_UUIDzbitbucket-pipelinesCIz
unknown-ci )itemsosenvironget)ci_env_varsenv_varvendors      r   _detect_ci_vendorrF   2   s    *[yJ+[%oJ!#8K ',,.::>>'""M / 
zz~~dr   c                $    V ^8  d   QhR\         /# r   bool)r   s   "r   r   r   G   s      t r   c                      ^ RI Hp  V P                  4       R,          R,          pVP                  4       '       d   R#  VP                  P                  RRR7       VP                  4        R#   \         d     R# i ; i)r   )Pathz	.anacondaz.telemetry_initializedFT)parentsexist_ok)pathlibrK   homeexistsparentmkdirtouchOSError)rK   markers     r   _is_first_runrV   G   sj    YY[;&)AAF}}D48   s   -A- -A<;A<c                $    V ^8  d   QhR\         /# r   r-   )r   s   "r   r   r   U   s      # r   c                  b   R RRRRRRRRRR	R
/p V P                  4        F.  w  r\        P                  P                  V4      '       g   K,  Vu # 	  \        P                  P                  RR4      pRVP	                  4       9   d   R# \        P                  P                  R4      '       d   R# R# )CURSOR_TRACE_IDcursorCURSOR_SESSION_IDCLINE_TASK_IDclineCONTINUE_GLOBAL_DIRcontinueWINDSURF_SESSION_IDwindsurfOPENCODEopencodeTERM_PROGRAMr>   CLAUDE_CODEzclaude-code)r?   r@   rA   rB   lower)
indicatorsrD   agentterm_programs       r   _detect_ai_agentrj   U   s    8XzzJJ %**,::>>'""L - ::>>."5L<%%''	zz~~m$$r   c                $    V ^8  d   QhR\         /# r   rH   )r   s   "r   r   r   i   s      T r   c                  >    \         P                  P                  4       # N)sysstdoutisatty r   r   _detect_ttyrr   i   s    ::r   c                   R   a  ] tR t^mt o ]! ]P                  R7      tV 3R ltRt	V t
R# )_CommandInfo)default_factoryc                J   < V ^8  d   Qh/ S[ ;R&   S[ ;R&   S[ ;R&   S[;R&   # )r   commandpluginflags
start_time)r   float)r   __classdict__s   "r   r   _CommandInfo.__annotate__m   s4     L  K  J	 
 @ r   rq   N)__name__
__module____qualname____firstlineno__r   timeperf_counterrz   __annotate_func____static_attributes____classdictcell__r|   s   @r   rt   rt   m   s     
 d.?.?@J  r   rt   c                    V ^8  d   QhRR/# )r   r   Nrq   )r   s   "r   r   r   u   s     IE IET IEr   c                  D   \         '       d   R # \        ;_uu_ 4        \         '       d    R R R 4       R # \        P                  '       g    R R R 4       R #  \        P
                  P                  RR4       ^ RIHp  ^ RI	H
p ^ RIHp ^ R Ip^ RIHp \!        4       p\        P"                  '       d   \        P"                  pMV'       d   \$        pM\&        pV ! VVR7      pVP)                  R4       \        P*                  '       d    VP-                  \        P*                  4       VP/                  \        P0                  4       VP3                  \        P0                  4       \5        VR	4      '       d   VP7                  R
4       ^ R IpVP;                  RRV4      R,          p	V! RV	VP=                  4       P?                  4        RVPA                  4        2R\        PB                  R7      p
T
PE                  \G        4       \I        4       V'       d   RMR\K        4       \M        4       \O        4       R7       V! VV
. ROR7       Rs R R R 4       R #   \P         d     L\R         d!   p\T        PW                  RT4        R p?L<R p?ii ; i  + '       g   i     R # ; i)NGRPC_VERBOSITYNONE)Configuration)ResourceAttributes)initialize_telemetryr   )default_endpointdefault_auth_tokenTset_shutdown_on_exitFz[^a-zA-Z0-9._-].:N   Nr!   -
production)service_nameservice_versionplatformenvironment
anon_usageauthenticated	anonymous)plugin_versions	ci_vendor
auth_stateis_first_runai_agentis_tty)config
attributessignal_typesz#Telemetry initialization failed: %s)loggingmetricstracing),_initialized_lockr   enabledr@   rA   
setdefaultanaconda_opentelemetry.configr   !anaconda_opentelemetry.attributesr   anaconda_opentelemetry.signalsr   rer%   r    _get_api_keyendpointr   r   set_skip_internet_check	proxy_urlset_proxy_urlset_metrics_export_interval_msexport_interval_msset_tracing_export_interval_mshasattrr   r   subsystemrf   machineshare_session_identityset_attributesr+   rF   rV   rj   rr   ImportError	Exceptionloggerdebug)r   r   r   r   r    api_keyr   otel_configplatform_modr   attrsexcs               r   _ensure_initializedr   u   s   |	< 
 ~~~	 

@	EJJ!!"2F;CLK5"nG!??1*'!)#*K //5))&*:*:;66v7P7PQ66v7P7PQ
 {$:;;007+ ff%7kJ3OO&0 /(//1779:!L<P<P<R;ST(!88E    4 6+-.5?;*_)+"} !  !" >
  LC 
D  	 	ELL>DD	EI 
sZ   JJJA4I=I
E IJJ!J*J+JJJJJ	c                :    V ^8  d   QhR\         \        ,          /# r   r   r   )r   s   "r   r   r      s      hsm r   c                  n     ^ RI Hp  V P                  R4      pVP                  #   \         d     R# i ; i)r   )	TokenInfozanaconda.comN)anaconda_auth.tokenr   loadr   r   )r   
token_infos     r   r   r      s6    1^^N3
!!! s   "% 44c                    V ^8  d   QhR\         \        \        ,          ,          R\         \        ,          R\         \        ,          /# )r   args	prog_namer   )r   r   r   rt   )r   s   "r   r   r      s;     
O 
O
8C=
!
O.6sm
Ol
Or   c                   \        4        \        '       g   R# V '       d   RP                  V R,          4      MT;'       g    RpV '       d
   V ^ ,          MRpRP                  R T ;'       g    .  4       4      p\        W#VR7      # )	zBStart tracking a command. Returns None when telemetry is inactive.N :Nr   Nunknownroot,c              3      "   T F5  qP                  R 4      '       g   K  VP                  R4      ^ ,          x  K7  	  R# 5i)r   =N)
startswithsplit).0as   & r   	<genexpr>"_before_command.<locals>.<genexpr>   s)     Pzll3>O_QWWS\!__zs   ? ?)rw   rx   ry   )r   r   joinrt   )r   r   command_nameplugin_namery   s   &&   r   _before_commandr      sf     <)-388DH%93I3I	L!$q'vKHHPtzzrzPPENNr   c          
      x    V ^8  d   QhR\         \        ,          R\        R\         \        ,          R\        RR/# )r   infosuccesserror	exit_coder   N)r   rt   rI   r   int)r   s   "r   r   r      sD     ! !
<
 !! I! 	!
 
!r   c                 *   V f   R #  ^ RI HpHp \        P                  ! 4       V P
                  ,
          R,          pRV P                  RV P                  RRRV P                  RV'       g   TM^ /pV! R	Wg4       V! R
VR7       V'       gm   / VCRV'       d   \        V4      P                  MRR\        \        VR\        VRR4      4      4      RV'       d   \        V4      R,          MR/CpV! RVR7       \        4        R #   \         d     Li ; i)N)increment_counterrecord_histogrami  rw   rx   sourcer!   ry   r   cli_command_duration_mscli_command_invokedr   z
error.typer   z
error.codecodeerrnor>   zerror.message:Ni  Ncli_command_errors)anaconda_opentelemetryr   r   r   r   rz   rw   rx   ry   typer~   r   getattrr   shutdown_telemetry)	r   r   r   r   r   r   duration_msr   error_attrss	   &&&&     r   _after_commandr      s     |N((*T__<Dt||dkk)TZZ'q,
 	2KG/EB66ed5k22c'%QS9T"UVUUD!1	6K 2{K   s   A#D ,+D A D DDtimeout_secondsc                6    V ^8  d   QhR\         R,          RR/# )r   r   Nr   )r{   )r   s   "r   r   r      s"     A A54< A4 Ar   c                   \         '       g   R#  ^ RIHp V e   T M\        P                  R,          pV! VR7       R#   \
         d    \        P                  R4        R# \         d    \        P                  RRR7        R# i ; i)	a  Public bounded telemetry shutdown for consumers.

Flushes all telemetry providers with an optional time bound. No-op when
telemetry is disabled. Suitable for signal handlers and other last-resort
shutdown paths: the ``_initialized`` guard guarantees ``anaconda_opentelemetry``
is already imported, so no module loading happens here.

Args:
    timeout_seconds: Maximum seconds to wait for flush. Defaults to
        config.flush_timeout_ms / 1000.0 when None.
N)r   g     @@)r   z7anaconda-opentelemetry.shutdown_telemetry not availablezTelemetry shutdown failedT)exc_info)	r   r   r   r   flush_timeout_msr   r   r   r   )r   _upstream_shutdowneffective_timeouts   $  r   r   r      sx     <AS * ((61 	
 	+<= PNO A04@As   ,>  B!B*BBc                $    V ^8  d   QhR\         /# r   rH   )r   s   "r   r   r     s      d r   c                      \         # rm   )r   rq   r   r   is_telemetry_enabledr    s    r   c                D    V ^8  d   QhR\         R\        P                  /# )r   levelr   )r   r   Handler)r   s   "r   r   r     s     % %C %goo %r   c                   \        4        \        '       g   \        P                  ! 4       #  ^ RIHp V! 4       pVf   \        P                  ! 4       # VP                  V 4       V#   \         d    \        P                  ! 4       u # i ; i)uk  Get a logging handler that exports log records to the OTel backend.

Attach to any named logger to forward records at *level* or above to the
telemetry collector. The handler is additive — existing handlers (stderr,
file) continue to work normally.

Returns a NullHandler when telemetry is inactive or unavailable, so it is
always safe to call unconditionally.
)get_telemetry_logger_handler)r   r   r   NullHandlerr   r	  setLevelr   )r  r	  handlers   &  r   get_otel_handlerr    ss     <""$$	%O.0?&&(( %""$$%s   %A& A& & B	B	c                    V ^8  d   QhR\         R\         R\        \        \         \        3,          ,          R\        \        RR3,          /# )r   r(   r   r   r   N)r   r   r
   r	   r   )r   s   "r   r   r   7  sD      
-5d38n-EsD$r   c              #    "   \        4        \        '       g   \        4       x  R#  ^ RIHp V! V \        W!4      R7      ;_uu_ 4       pVx  RRR4       R#   + '       g   i     R# ; i  \         d    \        4       x   R# i ; i5i)zCreate a child span for tracing a block of work.

Use to measure duration and capture events within a logical operation.
The span appears in trace views as a child of the CLI command's root span,
giving visibility into where time is spent.
N)	get_tracer   )r   r   	_NoOpSpanr   r  _build_attrsr   )r(   r   r   r  spans   &&&  r   tracedr  6  sd      <k4tZ(MNNRVJ ONNN ksL   %B
!A, 	AA, B
A)	#A, 'B
)A, ,BB
BB
c                    V ^8  d   QhR\         R\         R\        R\        \        \         \        3,          ,          RR/# r   r(   r   valuer   r   N)r   r   r   r
   r	   )r   s   "r   r   r   M  sG      
  c3h(	
 
r   c                    \        4        \        '       g   R#  ^ RIHp V! W\	        W14      R7       R#   \
         d     R# i ; i)a&  Increment a counter metric. Use for discrete occurrences you want to sum.

Counters are aggregated server-side (summed over time windows) and are ideal
for alerting on rates (e.g., errors/minute). Use instead of log_event when
you need numeric aggregation rather than individual event records.
N)r   )byr   )r   r   r   r   r  r   )r(   r   r  r   r   s   &&&& r   countr  M  s@     <<|J'L	
     5 AAc                    V ^8  d   QhR\         R\         R\        R\        \        \         \        3,          ,          RR/# r  )r   r{   r   r
   r	   )r   s   "r   r   r   f  sG      
  c3h(	
 
r   c                    \        4        \        '       g   R#  ^ RIHp V! W\	        W14      R7       R#   \
         d     R# i ; i)a  Record a distribution measurement. Use for values you want percentiles of.

Histograms compute p50/p95/p99 server-side, making them ideal for latency
and size measurements. Use instead of log_event when you need statistical
summaries rather than individual event records.
N)r   r   )r   r   r   r   r  r   )r(   r   r  r   r   s   &&&& r   	histogramr  f  s;     <;j1VW r  c                    V ^8  d   QhR\         R\         R\         R\        \        \         \        3,          ,          RR/# )r   body
event_namer   r   r   Nr   r   r
   r	   )r   s   "r   r   r   }  sG      
  c3h(	
 
r   c                    \        4        \        '       g   R#  ^ RIHp V! W\	        W24      R7       R#   \
         d     R# i ; i)z?Send a structured log event. No-ops when telemetry is disabled.N)
send_eventr   )r   r   r   r$  r  r   )r   r!  r   r   r$  s   &&&& r   	log_eventr%  }  s;     <=4Z0UV r  c                    V ^8  d   QhR\         \        \        \        3,          ,          R\        R\        \        \        3,          /# )r   r   r   r   )r   r
   r   r	   )r   s   "r   r   r     s9      c3h(7:	#s(^r   c                 B    \        T ;'       g    / 4      pR VR&   WR&   V# )r!   r   rx   )dict)r   r   r   s   && r   r  r    s+     !!r"E)E(O!(OLr   c                2    V ^8  d   QhR\         R,          /# )r   r   )NNN)r   )r   s   "r   r   r     s     $ $Y'78 $r   c               #     "   \         P                  R4      p  Rx  \         P                  V 4       R#   \         P                  T 4       i ; i5i)u'  Suppress HTTP-level spans inside a block to reduce trace noise.

Use when polling or retrying produces many identical HTTP spans that
obscure the real operation. The parent span still records full duration,
and HTTP metrics (counters/histograms) are still emitted — only spans
are suppressed.
TN)r   setreset)tokens    r   suppress_http_spansr.    s;      t$E$U#U#s   A4 AAAc                $    V ^8  d   QhR\         /# r   rH   )r   s   "r   r   r     s        D  r   c                  *    \         P                  4       # rm   )r   rB   rq   r   r   is_http_suppressedr1    s    r   c                   p   a  ] tR tRt o RV 3R lR lltV 3R lR ltRV 3R lR lltV 3R	 lR
 ltRtV t	R# )r  i  Nc                P   < V ^8  d   QhRS[ RS[S[S[ S[3,          ,          RR/# )r   r(   r   r   Nr"  )r   r|   s   "r   r   _NoOpSpan.__annotate__  s0      c xS#X/G SW r   c                    R # rm   rq   )selfr(   r   s   &&&r   	add_event_NoOpSpan.add_event      r   c                $   < V ^8  d   QhRS[ RR/# )r   r   r   N)r   )r   r|   s   "r   r   r4    s       t r   c                    R # rm   rq   )r6  r   s   &&r   add_exception_NoOpSpan.add_exception  r9  r   c                4   < V ^8  d   QhRS[ S[,          RR/# )r   msgr   Nr   )r   r|   s   "r   r   r4    s      HSM T r   c                    R # rm   rq   )r6  r?  s   &&r   set_error_status_NoOpSpan.set_error_status  r9  r   c                :   < V ^8  d   QhRS[ S[S[3,          RR/# )r   r   r   N)r
   r   r	   )r   r|   s   "r   r   r4    s#      c3h D r   c                    R # rm   rq   )r6  r   s   &&r   add_attributes_NoOpSpan.add_attributes  r9  r   rq   rm   )
r~   r   r   r   r7  r<  rA  rE  r   r   r   s   @r   r  r    s-         r   r  c                V    V ^8  d   Qh/ ^ \         9   d   \        \        ,          ;R&   # )r   r   )__conditional_annotations__r   rI   )r   s   "r   r   r      s&      D O N
4  NEr   )Nr   rm   )   N)@rH  __doc__r   r@   rn   	threadingr   collections.abcr   r   
contextlibr   contextvarsr   dataclassesr   r   	functoolsr   typingr	   r
   r   r   "anaconda_cli_base.telemetry_configr   r   r   	getLoggerr~   r   r   rI   r   r{   AttributeValuer   Lockr   r   r   r+   rF   rV   rj   rr   rt   r   r   r   r   r   r  WARNINGr  r  r  r  r%  r  r.  r1  r  r   )rH  s   @r   <module>rW     sl    	 
   / % " (  - -  
		8	$sD#uhuS$U=R7S.TTU		#-.>#N N 1 *( A A AIEX
O!HA$ A: #*// %2  ,2.$ $ $  r   