Search code examples
kubernetesistiojaeger

Add custom tag to span in Jaeger when using in Istio service mesh


I want to add a custom tag in Jaeger span, I tried to install Istio on my Kubernetes cluster with this command:

istioctl install --set profile=demo --set meshConfig.accessLogFile=/dev/stdout --set meshConfig.outboundTrafficPolicy.mode=REGISTRY_ONLY -f .\tracing.yaml -y

and this is tracing.yaml:

apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
spec:
  meshConfig:
    enableTracing: true
    defaultConfig:
      tracing:
        sampling: 100.0
        custom_tags:
          my_tag_header:
            header:
              name: test
              defaultValue: test

but there is no test tag in spans: enter image description here What should I do?


Solution

  • When using Istio operator you have to initialize it first with

    istioctl operator init
    

    By default Istio operator installs and watches only istio-operator namespace. If you want to specify another namespaces for it to watch (for example default), add --watchedNamespaces argument

    istioctl operator init --watchedNamespaces=default
    

    With the operator installed, you can now create a mesh by deploying an IstioOperator resource. To install the Istio demo configuration profile using the operator, run the following command:

    kubectl apply -f - <<EOF
    apiVersion: install.istio.io/v1alpha1
    kind: IstioOperator
    metadata:
      namespace: istio-system
      name: example-istiocontrolplane
    spec:
      profile: demo
    EOF
    

    Now, with the controller running, you can change the Istio configuration by editing or replacing the IstioOperator resource. The controller will detect the change and respond by updating the Istio installation correspondingly.