Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,28 @@
public record AssetIdentity(
@NotBlank @JsonProperty("id") String id,
@NotBlank @JsonProperty("environmentId") @JsonAlias("environment-id") String environmentId,
@NotBlank @JsonProperty("name") String name,
@NotBlank @JsonProperty("type") String assetType
) {
public AssetIdentity
{
Objects.requireNonNull(id, "id must not be null");
Objects.requireNonNull(environmentId, "environmentId must not be null");
Objects.requireNonNull(name, "name must not be null");
Objects.requireNonNull(assetType, "assetType must not be null");
if (id.isBlank())
throw new IllegalArgumentException("id must not be blank");
if (environmentId.isBlank())
throw new IllegalArgumentException("environmentId must not be blank");
if (name.isBlank())
throw new IllegalArgumentException("name must not be blank");
if (assetType.isBlank())
throw new IllegalArgumentException("assetType must not be blank");
}

public static AssetIdentity of(String id, String environmentId, String name, String assetType)
public static AssetIdentity of(String id, String environmentId, String assetType)
{
return new AssetIdentity(id, environmentId, name, assetType);
return new AssetIdentity(id, environmentId, assetType);
}

public static AssetIdentity of(String id, String environmentId, String name, AssetType assetType)
public static AssetIdentity of(String id, String environmentId, AssetType assetType)
{
return new AssetIdentity(id, environmentId, name, assetType.name());
return new AssetIdentity(id, environmentId, assetType.name());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public interface SimulatedAsset extends Asset
@Override
default AssetIdentity identity()
{
return AssetIdentity.of("simulated-asset", "simulated-environment", "simulated-asset", this.type());
return AssetIdentity.of("simulated-asset", "simulated-environment", this.type());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class MicrometerKubernetesMetricResolver implements KubernetesMetricResol
);

private static final Set<String> TAGS = Set.of(
TAG_ENVIRONMENT, TAG_ASSET, TAG_ASSET_NAME, TAG_ASSET_TYPE,
TAG_ENVIRONMENT, TAG_ASSET, TAG_ASSET_TYPE,
TAG_SERVICE, TAG_K8S_CLUSTER, TAG_K8S_NAMESPACE, TAG_K8S_POD, TAG_K8S_CONTAINER
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class MicrometerLLMMetricResolver implements LLMMetricResolver
);

private static final Set<String> TAGS = Set.of(
TAG_ENVIRONMENT, TAG_ASSET, TAG_ASSET_NAME, TAG_ASSET_TYPE,
TAG_ENVIRONMENT, TAG_ASSET, TAG_ASSET_TYPE,
TAG_SERVICE, TAG_LLM_PROVIDER, TAG_LLM_MODEL, TAG_LLM_LOCATION
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ public final class MicrometerTags
{
public static final String TAG_ENVIRONMENT = "wombat.environment";
public static final String TAG_ASSET = "wombat.asset";
public static final String TAG_ASSET_NAME = "wombat.asset.name";
public static final String TAG_ASSET_TYPE = "wombat.asset.type";
public static final String TAG_SERVICE = "wombat.service";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public List<Tag> mapTags(AssetIdentity identity, AssetType type, MetricData data
return List.of(
Tag.of(TAG_ENVIRONMENT, identity.environmentId()),
Tag.of(TAG_ASSET, identity.id()),
Tag.of(TAG_ASSET_NAME, identity.name()),
Tag.of(TAG_ASSET_TYPE, type.name()),
Tag.of(TAG_SERVICE, data.serviceId()),
Tag.of(TAG_K8S_CLUSTER, k8sData.cluster()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public List<Tag> mapTags(AssetIdentity identity, AssetType type, MetricData data
return List.of(
Tag.of(TAG_ENVIRONMENT, identity.environmentId()),
Tag.of(TAG_ASSET, identity.id()),
Tag.of(TAG_ASSET_NAME, identity.name()),
Tag.of(TAG_ASSET_TYPE, type.name()),
Tag.of(TAG_SERVICE, data.serviceId()),
Tag.of(TAG_LLM_PROVIDER, llmData.provider().name()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ private record SourceableAsset(String assetId) implements Asset, Monitorable
@Override
public AssetIdentity identity()
{
return AssetIdentity.of(this.assetId, "env", this.assetId, this.type());
return AssetIdentity.of(this.assetId, "env", this.type());
}

@Override
Expand Down Expand Up @@ -244,7 +244,7 @@ private record ModeledAsset(String assetId) implements Asset
@Override
public AssetIdentity identity()
{
return AssetIdentity.of(this.assetId, "env", this.assetId, this.type());
return AssetIdentity.of(this.assetId, "env", this.type());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ private void recordK8sMetric(String assetId, String serviceId, String cluster, S
Tags tags = Tags.of(
TAG_ENVIRONMENT, "env-1",
TAG_ASSET, assetId,
TAG_ASSET_NAME, assetId,
TAG_ASSET_TYPE, "k8s",
TAG_SERVICE, serviceId,
TAG_K8S_CLUSTER, cluster,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ private void recordLLMMetric(String assetId, String serviceId, LLMProvider provi
Tags tags = Tags.of(
TAG_ENVIRONMENT, "env-1",
TAG_ASSET, assetId,
TAG_ASSET_NAME, assetId,
TAG_ASSET_TYPE, "llm",
TAG_SERVICE, serviceId,
TAG_LLM_PROVIDER, provider.name(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,52 +17,46 @@ class AssetIdentityTest
@Test
void of_constructsValidAssetIdentity()
{
AssetIdentity identity = AssetIdentity.of("asset-1", "env-prod", "my-asset", TYPE_NAME);
AssetIdentity identity = AssetIdentity.of("asset-1", "env-prod", TYPE_NAME);
assertEquals("asset-1", identity.id());
assertEquals("env-prod", identity.environmentId());
assertEquals("my-asset", identity.name());
assertEquals(TYPE_NAME, identity.assetType());
}

@Test
void of_namesTheGivenAssetType()
{
assertEquals(AssetIdentity.of("asset-1", "env-prod", "my-asset", TYPE_NAME), AssetIdentity.of("asset-1", "env-prod", "my-asset", TYPE));
assertEquals(AssetIdentity.of("asset-1", "env-prod", TYPE_NAME), AssetIdentity.of("asset-1", "env-prod", TYPE));
}

@Test
void equalityAndHashCode_matchByValues()
{
AssetIdentity id1 = AssetIdentity.of("asset-1", "env-prod", "my-asset", TYPE_NAME);
AssetIdentity id2 = new AssetIdentity("asset-1", "env-prod", "my-asset", TYPE_NAME);
AssetIdentity id3 = AssetIdentity.of("asset-2", "env-prod", "my-asset", TYPE_NAME);
AssetIdentity id4 = AssetIdentity.of("asset-1", "env-dev", "my-asset", TYPE_NAME);
AssetIdentity id5 = AssetIdentity.of("asset-1", "env-prod", "other-asset", TYPE_NAME);
AssetIdentity id6 = AssetIdentity.of("asset-1", "env-prod", "my-asset", "tech.illuin.wombat-module.other");
AssetIdentity id1 = AssetIdentity.of("asset-1", "env-prod", TYPE_NAME);
AssetIdentity id2 = new AssetIdentity("asset-1", "env-prod", TYPE_NAME);
AssetIdentity id3 = AssetIdentity.of("asset-2", "env-prod", TYPE_NAME);
AssetIdentity id4 = AssetIdentity.of("asset-1", "env-dev", TYPE_NAME);
AssetIdentity id5 = AssetIdentity.of("asset-1", "env-prod", "tech.illuin.wombat-module.other");

assertEquals(id1, id2);
assertEquals(id1.hashCode(), id2.hashCode());
assertNotEquals(id1, id3);
assertNotEquals(id1, id4);
assertNotEquals(id1, id5);
assertNotEquals(id1, id6);
}

@Test
void constructor_rejectsNullOrBlankFields()
{
assertThrows(NullPointerException.class, () -> new AssetIdentity(null, "env-prod", "my-asset", TYPE_NAME));
assertThrows(NullPointerException.class, () -> new AssetIdentity("asset-1", null, "my-asset", TYPE_NAME));
assertThrows(NullPointerException.class, () -> new AssetIdentity("asset-1", "env-prod", null, TYPE_NAME));
assertThrows(NullPointerException.class, () -> new AssetIdentity("asset-1", "env-prod", "my-asset", null));

assertThrows(IllegalArgumentException.class, () -> new AssetIdentity("", "env-prod", "my-asset", TYPE_NAME));
assertThrows(IllegalArgumentException.class, () -> new AssetIdentity(" ", "env-prod", "my-asset", TYPE_NAME));
assertThrows(IllegalArgumentException.class, () -> new AssetIdentity("asset-1", "", "my-asset", TYPE_NAME));
assertThrows(IllegalArgumentException.class, () -> new AssetIdentity("asset-1", " ", "my-asset", TYPE_NAME));
assertThrows(IllegalArgumentException.class, () -> new AssetIdentity("asset-1", "env-prod", "", TYPE_NAME));
assertThrows(IllegalArgumentException.class, () -> new AssetIdentity("asset-1", "env-prod", " ", TYPE_NAME));
assertThrows(IllegalArgumentException.class, () -> new AssetIdentity("asset-1", "env-prod", "my-asset", ""));
assertThrows(IllegalArgumentException.class, () -> new AssetIdentity("asset-1", "env-prod", "my-asset", " "));
assertThrows(NullPointerException.class, () -> new AssetIdentity(null, "env-prod", TYPE_NAME));
assertThrows(NullPointerException.class, () -> new AssetIdentity("asset-1", null, TYPE_NAME));
assertThrows(NullPointerException.class, () -> new AssetIdentity("asset-1", "env-prod", null));

assertThrows(IllegalArgumentException.class, () -> new AssetIdentity("", "env-prod", TYPE_NAME));
assertThrows(IllegalArgumentException.class, () -> new AssetIdentity(" ", "env-prod", TYPE_NAME));
assertThrows(IllegalArgumentException.class, () -> new AssetIdentity("asset-1", "", TYPE_NAME));
assertThrows(IllegalArgumentException.class, () -> new AssetIdentity("asset-1", " ", TYPE_NAME));
assertThrows(IllegalArgumentException.class, () -> new AssetIdentity("asset-1", "env-prod", ""));
assertThrows(IllegalArgumentException.class, () -> new AssetIdentity("asset-1", "env-prod", " "));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private record TestAsset(AssetType type, AssetProfile profile) implements Asset
@Override
public AssetIdentity identity()
{
return AssetIdentity.of("asset", "env", "Asset", this.type());
return AssetIdentity.of("asset", "env", this.type());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private record TestAsset(AssetType type, AssetProfile profile) implements Asset
@Override
public AssetIdentity identity()
{
return AssetIdentity.of("asset", "env", "Asset", this.type());
return AssetIdentity.of("asset", "env", this.type());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private record TestAsset(String assetId) implements Asset
@Override
public AssetIdentity identity()
{
return AssetIdentity.of(this.assetId, "env", this.assetId, this.type());
return AssetIdentity.of(this.assetId, "env", this.type());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ void containerSharesPerBucket_withMissingServiceTag_ignoresGroup()
Tags tagsWithoutService = Tags.of(
TAG_ENVIRONMENT, "env-1",
TAG_ASSET, "asset-1",
TAG_ASSET_NAME, "asset-1",
TAG_ASSET_TYPE, "k8s",
TAG_K8S_CLUSTER, "cluster-1",
TAG_K8S_NAMESPACE, "ns-1",
Expand Down Expand Up @@ -224,7 +223,6 @@ private void recordK8sMetric(String assetId, String serviceId, String cluster, S
Tags tags = Tags.of(
TAG_ENVIRONMENT, "env-1",
TAG_ASSET, assetId,
TAG_ASSET_NAME, assetId,
TAG_ASSET_TYPE, "k8s",
TAG_SERVICE, serviceId,
TAG_K8S_CLUSTER, cluster,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ void serviceActivitiesPerBucket_withMissingServiceTag_ignoresGroup()
Tags tagsWithoutService = Tags.of(
TAG_ENVIRONMENT, "env-1",
TAG_ASSET, "asset-1",
TAG_ASSET_NAME, "asset-1",
TAG_ASSET_TYPE, "llm",
TAG_LLM_PROVIDER, LLMProvider.openai.name(),
TAG_LLM_MODEL, "gpt-4o",
Expand All @@ -83,7 +82,6 @@ void serviceActivitiesPerBucket_withInvalidCountryCode_handlesNullLocation()
Tags tags = Tags.of(
TAG_ENVIRONMENT, "env-1",
TAG_ASSET, "asset-1",
TAG_ASSET_NAME, "asset-1",
TAG_ASSET_TYPE, "llm",
TAG_SERVICE, "service-1",
TAG_LLM_PROVIDER, LLMProvider.openai.name(),
Expand Down Expand Up @@ -147,7 +145,6 @@ private void recordLLMMetric(String assetId, String serviceId, LLMProvider provi
Tags tags = Tags.of(
TAG_ENVIRONMENT, "env-1",
TAG_ASSET, assetId,
TAG_ASSET_NAME, assetId,
TAG_ASSET_TYPE, "llm",
TAG_SERVICE, serviceId,
TAG_LLM_PROVIDER, provider.name(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ private record TestAsset(String assetId, AssetType type, String setting) impleme
@Override
public AssetIdentity identity()
{
return AssetIdentity.of(this.assetId, "env", this.assetId, this.type);
return AssetIdentity.of(this.assetId, "env", this.type);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ private record SettingAsset(String assetId, String setting) implements Asset, Mo
@Override
public AssetIdentity identity()
{
return AssetIdentity.of(this.assetId, "env", this.assetId, this.type());
return AssetIdentity.of(this.assetId, "env", this.type());
}

@Override
Expand All @@ -323,7 +323,7 @@ private record TestAsset(String assetId, AssetType type, Period period) implemen
@Override
public AssetIdentity identity()
{
return AssetIdentity.of(this.assetId, "env", this.assetId, this.type());
return AssetIdentity.of(this.assetId, "env", this.type());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class KubernetesMapperTest
{
private static final AssetType TYPE_KUBERNETES = AssetType.of("tech.illuin", "wombat-module", "kubernetes-prometheus", ActivityRegime.MEASURED, ServiceFamily.KUBERNETES_CONTAINER);
private static final AssetIdentity IDENTITY = AssetIdentity.of("asset-1", "env-1", "Asset 1", TYPE_KUBERNETES);
private static final AssetIdentity IDENTITY = AssetIdentity.of("asset-1", "env-1", TYPE_KUBERNETES);

private final KubernetesMapper mapper = new KubernetesMapper();

Expand All @@ -32,7 +32,6 @@ void mapTags_includesClusterNamespacePodContainer()

assertTrue(tags.contains(Tag.of(TAG_ENVIRONMENT, "env-1")));
assertTrue(tags.contains(Tag.of(TAG_ASSET, "asset-1")));
assertTrue(tags.contains(Tag.of(TAG_ASSET_NAME, "Asset 1")));
assertTrue(tags.contains(Tag.of(TAG_ASSET_TYPE, TYPE_KUBERNETES.name())));
assertTrue(tags.contains(Tag.of(TAG_SERVICE, "container-1")));
assertTrue(tags.contains(Tag.of(TAG_K8S_CLUSTER, "cluster-prod")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class LLMMapperTest
{
private static final AssetType TYPE_LLM = AssetType.of("tech.illuin", "wombat-module", "llm-prometheus", ActivityRegime.MEASURED, ServiceFamily.LLM);
private static final AssetIdentity IDENTITY = AssetIdentity.of("asset-1", "env-1", "Asset 1", TYPE_LLM);
private static final AssetIdentity IDENTITY = AssetIdentity.of("asset-1", "env-1", TYPE_LLM);

private final LLMMapper mapper = new LLMMapper();

Expand All @@ -34,7 +34,6 @@ void mapTags_includesProviderModelLocation()

assertTrue(tags.contains(Tag.of(TAG_ENVIRONMENT, "env-1")));
assertTrue(tags.contains(Tag.of(TAG_ASSET, "asset-1")));
assertTrue(tags.contains(Tag.of(TAG_ASSET_NAME, "Asset 1")));
assertTrue(tags.contains(Tag.of(TAG_ASSET_TYPE, TYPE_LLM.name())));
assertTrue(tags.contains(Tag.of(TAG_SERVICE, "service-1")));
assertTrue(tags.contains(Tag.of(TAG_LLM_PROVIDER, "mistralai")));
Expand Down
4 changes: 0 additions & 4 deletions doc/module/kubernetes-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ For cross-cutting data formats such as `Period`, `Duration`, `Lifetime`, `Countr
```yaml
id: "k8s-prod-cluster-01" # required - Unique identifier for the monitored asset.
environment-id: "production" # required - Identifier of the target environment (e.g. `production`, `staging`).
name: "Production Primary K8s Cluster" # required - Human-readable asset name.
config-path: "/etc/wombat/kubeconfig" # required - Absolute or relative file path to the kubeconfig file.
namespace: "payments-api" # optional (default: null) - Kubernetes namespace to restrict metric polling (polls all namespaces if omitted).
context: "prod-cluster-ctx" # optional (default: active context) - Kubeconfig context name to target.
Expand All @@ -45,7 +44,6 @@ A minimal configuration monitoring a single local or standard Kubernetes cluster
```yaml
id: "k8s-prod-cluster-01"
environment-id: "production"
name: "Production Primary K8s Cluster"
config-path: "/etc/wombat/kubeconfig"
period: "5m"
profile:
Expand All @@ -70,7 +68,6 @@ The scenario below demonstrates:
# Asset 1: AWS EKS Payments Service Cluster
id: "k8s-aws-fra-payments"
environment-id: "production-eu"
name: "AWS EKS Payments Cluster"
config-path: "/var/secrets/k8s/kubeconfig-enterprise.yaml"
context: "arn:aws:eks:eu-west-3:123456789012:cluster/prod-fra-payments"
namespace: "payments-api"
Expand All @@ -87,7 +84,6 @@ profile:
# Asset 2: GCP GKE Analytics & Batch Cluster
id: "k8s-gcp-deu-analytics"
environment-id: "production-eu"
name: "GCP GKE Analytics Processing Cluster"
config-path: "/var/secrets/k8s/kubeconfig-enterprise.yaml"
context: "gke_enterprise-analytics_europe-west3_prod-batch-cluster"
read-timeout: "PT15S"
Expand Down
3 changes: 0 additions & 3 deletions doc/module/kubernetes-static.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ For cross-cutting data formats such as `Duration`, `Lifetime`, `Country`, `Serve
```yaml
id: "k8s-static-backend" # required - Unique identifier for the asset.
environment-id: "production" # required - Identifier of the environment (e.g. `production`, `simulation`).
name: "Static Backend Service" # required - Human-readable asset name.
profile: # required - Static profile configuration.
provider: "aws" # required - Infrastructure provider (`aws`, `azure`, `gcp`, `ovhcloud`, `scaleway`).
instance-type: "c5.2xlarge" # required - Machine instance type (e.g. `c5.2xlarge`, `n2-standard-8`).
Expand Down Expand Up @@ -71,7 +70,6 @@ A minimal configuration modeling a single node with a static 20% constant baseli
```yaml
id: "k8s-static-backend"
environment-id: "production"
name: "Static Backend Service"
profile:
provider: "aws"
instance-type: "c5.xlarge"
Expand All @@ -97,7 +95,6 @@ In a realistic SaaS deployment, a 3-node Kubernetes cluster experiences multiple
```yaml
id: "k8s-saas-prod-cluster"
environment-id: "production"
name: "Production SaaS Application Cluster"
profile:
provider: "gcp"
instance-type: "n2-standard-8"
Expand Down
Loading
Loading