All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.opentelemetry.javaagent.instrumentation.kubernetesclient.KubernetesExperimentalAttributesExtractor Maven / Gradle / Ivy

/*
 * Copyright The OpenTelemetry Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package io.opentelemetry.javaagent.instrumentation.kubernetesclient;

import io.kubernetes.client.openapi.ApiResponse;
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
import javax.annotation.Nullable;
import okhttp3.Request;

class KubernetesExperimentalAttributesExtractor
    implements AttributesExtractor> {
  @Override
  public void onStart(AttributesBuilder attributes, Request request) {
    KubernetesRequestDigest digest = KubernetesRequestDigest.parse(request);
    attributes
        .put("kubernetes-client.namespace", digest.getResourceMeta().getNamespace())
        .put("kubernetes-client.name", digest.getResourceMeta().getName());
  }

  @Override
  public void onEnd(
      AttributesBuilder attributes,
      Request request,
      @Nullable ApiResponse apiResponse,
      @Nullable Throwable error) {}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy