diff --git a/api/dataStores.yaml b/api/dataStores.yaml index 52882a9cd3..39b6749afa 100644 --- a/api/dataStores.yaml +++ b/api/dataStores.yaml @@ -48,6 +48,8 @@ components: $ref: "#/components/schemas/SignalFX" awsxray: $ref: "#/components/schemas/AwsXRay" + azureappinsights: + $ref: "#/components/schemas/AzureAppInsights" createdAt: type: string format: date-time @@ -84,6 +86,17 @@ components: type: string token: type: string + AzureAppInsights: + type: object + properties: + useAzureActiveDirectoryAuth: + type: boolean + accessToken: + type: string + connectionType: + $ref: "#/components/schemas/SupportedConnectionTypes" + resourceArmId: + type: string AwsXRay: type: object properties: @@ -180,7 +193,11 @@ components: datadog, awsxray, honeycomb, + azureappinsights, ] SupportedClients: type: string enum: [http, grpc] + SupportedConnectionTypes: + type: string + enum: [direct, collector] diff --git a/cli/openapi/model_azure_app_insights.go b/cli/openapi/model_azure_app_insights.go new file mode 100644 index 0000000000..c9351fbe8d --- /dev/null +++ b/cli/openapi/model_azure_app_insights.go @@ -0,0 +1,232 @@ +/* +TraceTest + +OpenAPI definition for TraceTest endpoint and resources + +API version: 0.2.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the AzureAppInsights type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AzureAppInsights{} + +// AzureAppInsights struct for AzureAppInsights +type AzureAppInsights struct { + UseAzureActiveDirectoryAuth *bool `json:"useAzureActiveDirectoryAuth,omitempty"` + AccessToken *string `json:"accessToken,omitempty"` + ConnectionType *SupportedConnectionTypes `json:"connectionType,omitempty"` + ResourceArmId *string `json:"resourceArmId,omitempty"` +} + +// NewAzureAppInsights instantiates a new AzureAppInsights object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAzureAppInsights() *AzureAppInsights { + this := AzureAppInsights{} + return &this +} + +// NewAzureAppInsightsWithDefaults instantiates a new AzureAppInsights object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAzureAppInsightsWithDefaults() *AzureAppInsights { + this := AzureAppInsights{} + return &this +} + +// GetUseAzureActiveDirectoryAuth returns the UseAzureActiveDirectoryAuth field value if set, zero value otherwise. +func (o *AzureAppInsights) GetUseAzureActiveDirectoryAuth() bool { + if o == nil || isNil(o.UseAzureActiveDirectoryAuth) { + var ret bool + return ret + } + return *o.UseAzureActiveDirectoryAuth +} + +// GetUseAzureActiveDirectoryAuthOk returns a tuple with the UseAzureActiveDirectoryAuth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureAppInsights) GetUseAzureActiveDirectoryAuthOk() (*bool, bool) { + if o == nil || isNil(o.UseAzureActiveDirectoryAuth) { + return nil, false + } + return o.UseAzureActiveDirectoryAuth, true +} + +// HasUseAzureActiveDirectoryAuth returns a boolean if a field has been set. +func (o *AzureAppInsights) HasUseAzureActiveDirectoryAuth() bool { + if o != nil && !isNil(o.UseAzureActiveDirectoryAuth) { + return true + } + + return false +} + +// SetUseAzureActiveDirectoryAuth gets a reference to the given bool and assigns it to the UseAzureActiveDirectoryAuth field. +func (o *AzureAppInsights) SetUseAzureActiveDirectoryAuth(v bool) { + o.UseAzureActiveDirectoryAuth = &v +} + +// GetAccessToken returns the AccessToken field value if set, zero value otherwise. +func (o *AzureAppInsights) GetAccessToken() string { + if o == nil || isNil(o.AccessToken) { + var ret string + return ret + } + return *o.AccessToken +} + +// GetAccessTokenOk returns a tuple with the AccessToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureAppInsights) GetAccessTokenOk() (*string, bool) { + if o == nil || isNil(o.AccessToken) { + return nil, false + } + return o.AccessToken, true +} + +// HasAccessToken returns a boolean if a field has been set. +func (o *AzureAppInsights) HasAccessToken() bool { + if o != nil && !isNil(o.AccessToken) { + return true + } + + return false +} + +// SetAccessToken gets a reference to the given string and assigns it to the AccessToken field. +func (o *AzureAppInsights) SetAccessToken(v string) { + o.AccessToken = &v +} + +// GetConnectionType returns the ConnectionType field value if set, zero value otherwise. +func (o *AzureAppInsights) GetConnectionType() SupportedConnectionTypes { + if o == nil || isNil(o.ConnectionType) { + var ret SupportedConnectionTypes + return ret + } + return *o.ConnectionType +} + +// GetConnectionTypeOk returns a tuple with the ConnectionType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureAppInsights) GetConnectionTypeOk() (*SupportedConnectionTypes, bool) { + if o == nil || isNil(o.ConnectionType) { + return nil, false + } + return o.ConnectionType, true +} + +// HasConnectionType returns a boolean if a field has been set. +func (o *AzureAppInsights) HasConnectionType() bool { + if o != nil && !isNil(o.ConnectionType) { + return true + } + + return false +} + +// SetConnectionType gets a reference to the given SupportedConnectionTypes and assigns it to the ConnectionType field. +func (o *AzureAppInsights) SetConnectionType(v SupportedConnectionTypes) { + o.ConnectionType = &v +} + +// GetResourceArmId returns the ResourceArmId field value if set, zero value otherwise. +func (o *AzureAppInsights) GetResourceArmId() string { + if o == nil || isNil(o.ResourceArmId) { + var ret string + return ret + } + return *o.ResourceArmId +} + +// GetResourceArmIdOk returns a tuple with the ResourceArmId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureAppInsights) GetResourceArmIdOk() (*string, bool) { + if o == nil || isNil(o.ResourceArmId) { + return nil, false + } + return o.ResourceArmId, true +} + +// HasResourceArmId returns a boolean if a field has been set. +func (o *AzureAppInsights) HasResourceArmId() bool { + if o != nil && !isNil(o.ResourceArmId) { + return true + } + + return false +} + +// SetResourceArmId gets a reference to the given string and assigns it to the ResourceArmId field. +func (o *AzureAppInsights) SetResourceArmId(v string) { + o.ResourceArmId = &v +} + +func (o AzureAppInsights) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AzureAppInsights) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !isNil(o.UseAzureActiveDirectoryAuth) { + toSerialize["useAzureActiveDirectoryAuth"] = o.UseAzureActiveDirectoryAuth + } + if !isNil(o.AccessToken) { + toSerialize["accessToken"] = o.AccessToken + } + if !isNil(o.ConnectionType) { + toSerialize["connectionType"] = o.ConnectionType + } + if !isNil(o.ResourceArmId) { + toSerialize["resourceArmId"] = o.ResourceArmId + } + return toSerialize, nil +} + +type NullableAzureAppInsights struct { + value *AzureAppInsights + isSet bool +} + +func (v NullableAzureAppInsights) Get() *AzureAppInsights { + return v.value +} + +func (v *NullableAzureAppInsights) Set(val *AzureAppInsights) { + v.value = val + v.isSet = true +} + +func (v NullableAzureAppInsights) IsSet() bool { + return v.isSet +} + +func (v *NullableAzureAppInsights) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAzureAppInsights(val *AzureAppInsights) *NullableAzureAppInsights { + return &NullableAzureAppInsights{value: val, isSet: true} +} + +func (v NullableAzureAppInsights) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAzureAppInsights) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/cli/openapi/model_data_store.go b/cli/openapi/model_data_store.go index 5b2281c26a..483b32ca3d 100644 --- a/cli/openapi/model_data_store.go +++ b/cli/openapi/model_data_store.go @@ -20,17 +20,18 @@ var _ MappedNullable = &DataStore{} // DataStore struct for DataStore type DataStore struct { - Id *string `json:"id,omitempty"` - Name string `json:"name"` - Type SupportedDataStores `json:"type"` - Default *bool `json:"default,omitempty"` - Jaeger *GRPCClientSettings `json:"jaeger,omitempty"` - Tempo *BaseClient `json:"tempo,omitempty"` - Opensearch *ElasticSearch `json:"opensearch,omitempty"` - Elasticapm *ElasticSearch `json:"elasticapm,omitempty"` - Signalfx *SignalFX `json:"signalfx,omitempty"` - Awsxray *AwsXRay `json:"awsxray,omitempty"` - CreatedAt *time.Time `json:"createdAt,omitempty"` + Id *string `json:"id,omitempty"` + Name string `json:"name"` + Type SupportedDataStores `json:"type"` + Default *bool `json:"default,omitempty"` + Jaeger *GRPCClientSettings `json:"jaeger,omitempty"` + Tempo *BaseClient `json:"tempo,omitempty"` + Opensearch *ElasticSearch `json:"opensearch,omitempty"` + Elasticapm *ElasticSearch `json:"elasticapm,omitempty"` + Signalfx *SignalFX `json:"signalfx,omitempty"` + Awsxray *AwsXRay `json:"awsxray,omitempty"` + Azureappinsights *AzureAppInsights `json:"azureappinsights,omitempty"` + CreatedAt *time.Time `json:"createdAt,omitempty"` } // NewDataStore instantiates a new DataStore object @@ -356,6 +357,38 @@ func (o *DataStore) SetAwsxray(v AwsXRay) { o.Awsxray = &v } +// GetAzureappinsights returns the Azureappinsights field value if set, zero value otherwise. +func (o *DataStore) GetAzureappinsights() AzureAppInsights { + if o == nil || isNil(o.Azureappinsights) { + var ret AzureAppInsights + return ret + } + return *o.Azureappinsights +} + +// GetAzureappinsightsOk returns a tuple with the Azureappinsights field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DataStore) GetAzureappinsightsOk() (*AzureAppInsights, bool) { + if o == nil || isNil(o.Azureappinsights) { + return nil, false + } + return o.Azureappinsights, true +} + +// HasAzureappinsights returns a boolean if a field has been set. +func (o *DataStore) HasAzureappinsights() bool { + if o != nil && !isNil(o.Azureappinsights) { + return true + } + + return false +} + +// SetAzureappinsights gets a reference to the given AzureAppInsights and assigns it to the Azureappinsights field. +func (o *DataStore) SetAzureappinsights(v AzureAppInsights) { + o.Azureappinsights = &v +} + // GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. func (o *DataStore) GetCreatedAt() time.Time { if o == nil || isNil(o.CreatedAt) { @@ -422,6 +455,9 @@ func (o DataStore) ToMap() (map[string]interface{}, error) { if !isNil(o.Awsxray) { toSerialize["awsxray"] = o.Awsxray } + if !isNil(o.Azureappinsights) { + toSerialize["azureappinsights"] = o.Azureappinsights + } if !isNil(o.CreatedAt) { toSerialize["createdAt"] = o.CreatedAt } diff --git a/cli/openapi/model_supported_connection_types.go b/cli/openapi/model_supported_connection_types.go new file mode 100644 index 0000000000..63df8d87e2 --- /dev/null +++ b/cli/openapi/model_supported_connection_types.go @@ -0,0 +1,110 @@ +/* +TraceTest + +OpenAPI definition for TraceTest endpoint and resources + +API version: 0.2.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// SupportedConnectionTypes the model 'SupportedConnectionTypes' +type SupportedConnectionTypes string + +// List of SupportedConnectionTypes +const ( + DIRECT SupportedConnectionTypes = "direct" + COLLECTOR SupportedConnectionTypes = "collector" +) + +// All allowed values of SupportedConnectionTypes enum +var AllowedSupportedConnectionTypesEnumValues = []SupportedConnectionTypes{ + "direct", + "collector", +} + +func (v *SupportedConnectionTypes) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := SupportedConnectionTypes(value) + for _, existing := range AllowedSupportedConnectionTypesEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid SupportedConnectionTypes", value) +} + +// NewSupportedConnectionTypesFromValue returns a pointer to a valid SupportedConnectionTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewSupportedConnectionTypesFromValue(v string) (*SupportedConnectionTypes, error) { + ev := SupportedConnectionTypes(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for SupportedConnectionTypes: valid values are %v", v, AllowedSupportedConnectionTypesEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v SupportedConnectionTypes) IsValid() bool { + for _, existing := range AllowedSupportedConnectionTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SupportedConnectionTypes value +func (v SupportedConnectionTypes) Ptr() *SupportedConnectionTypes { + return &v +} + +type NullableSupportedConnectionTypes struct { + value *SupportedConnectionTypes + isSet bool +} + +func (v NullableSupportedConnectionTypes) Get() *SupportedConnectionTypes { + return v.value +} + +func (v *NullableSupportedConnectionTypes) Set(val *SupportedConnectionTypes) { + v.value = val + v.isSet = true +} + +func (v NullableSupportedConnectionTypes) IsSet() bool { + return v.isSet +} + +func (v *NullableSupportedConnectionTypes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSupportedConnectionTypes(val *SupportedConnectionTypes) *NullableSupportedConnectionTypes { + return &NullableSupportedConnectionTypes{value: val, isSet: true} +} + +func (v NullableSupportedConnectionTypes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSupportedConnectionTypes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/cli/openapi/model_supported_data_stores.go b/cli/openapi/model_supported_data_stores.go index a8e5a3ebe6..47309bfc94 100644 --- a/cli/openapi/model_supported_data_stores.go +++ b/cli/openapi/model_supported_data_stores.go @@ -20,17 +20,18 @@ type SupportedDataStores string // List of SupportedDataStores const ( - JAEGER SupportedDataStores = "jaeger" - OPENSEARCH SupportedDataStores = "opensearch" - TEMPO SupportedDataStores = "tempo" - SIGNALFX SupportedDataStores = "signalfx" - OTLP SupportedDataStores = "otlp" - ELASTICAPM SupportedDataStores = "elasticapm" - NEWRELIC SupportedDataStores = "newrelic" - LIGHTSTEP SupportedDataStores = "lightstep" - DATADOG SupportedDataStores = "datadog" - AWSXRAY SupportedDataStores = "awsxray" - HONEYCOMB SupportedDataStores = "honeycomb" + JAEGER SupportedDataStores = "jaeger" + OPENSEARCH SupportedDataStores = "opensearch" + TEMPO SupportedDataStores = "tempo" + SIGNALFX SupportedDataStores = "signalfx" + OTLP SupportedDataStores = "otlp" + ELASTICAPM SupportedDataStores = "elasticapm" + NEWRELIC SupportedDataStores = "newrelic" + LIGHTSTEP SupportedDataStores = "lightstep" + DATADOG SupportedDataStores = "datadog" + AWSXRAY SupportedDataStores = "awsxray" + HONEYCOMB SupportedDataStores = "honeycomb" + AZUREAPPINSIGHTS SupportedDataStores = "azureappinsights" ) // All allowed values of SupportedDataStores enum @@ -46,6 +47,7 @@ var AllowedSupportedDataStoresEnumValues = []SupportedDataStores{ "datadog", "awsxray", "honeycomb", + "azureappinsights", } func (v *SupportedDataStores) UnmarshalJSON(src []byte) error { diff --git a/go.work.sum b/go.work.sum index 84d2eed6b5..df9d71f073 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1,3 +1,4 @@ +<<<<<<< Updated upstream atomicgo.dev/assert v0.0.2/go.mod h1:ut4NcI3QDdJtlmAxQULOmA13Gz6e2DWbSAS8RUOmNYQ= bazil.org/fuse v0.0.0-20200407214033-5883e5a4b512 h1:SRsZGA7aFnCZETmov57jwPrWuTmaZK6+4R4v5FUe1/c= cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= @@ -151,6 +152,7 @@ cloud.google.com/go/workflows v1.9.0/go.mod h1:ZGkj1aFIOd9c8Gerkjjq7OW7I5+l6cSvT contrib.go.opencensus.io/exporter/prometheus v0.4.2/go.mod h1:dvEHbiKmgvbr5pjaF9fpw1KeYcjrnC1J8B+JKjsZyRQ= github.com/Azure/azure-sdk-for-go v56.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/azure-sdk-for-go v59.4.0+incompatible h1:gDA8odnngdNd3KYHL2NoK1j9vpWBgEnFSjKKLpkC8Aw= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs= github.com/Azure/go-autorest/autorest v0.11.24 h1:1fIGgHKqVm54KIPT+q8Zmd1QlVsmHqeUGso5qm2BqqE= github.com/Azure/go-autorest/autorest v0.11.24/go.mod h1:G6kyRlFnTuSbEYkQGawPfsCswgme4iYf6rfSKUDzbCc= @@ -161,6 +163,7 @@ github.com/Azure/go-autorest/autorest/to v0.4.0 h1:oXVqrxakqqV1UZdSazDOPOLvOIz+X github.com/Azure/go-autorest/autorest/validation v0.3.1 h1:AgyqjAd94fwNAoTjl/WQXg4VvFeRFpO+UhNyRXqF1ac= github.com/Azure/go-autorest/logger v0.2.1 h1:IG7i4p/mDa2Ce4TRyAO8IHnVhAVF3RFU+ZtXWSmf4Tg= github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo= +github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= github.com/HdrHistogram/hdrhistogram-go v1.1.0 h1:6dpdDPTRoo78HxAJ6T1HfMiKSnqhgRRqzCuPshRkQ7I= github.com/MarvinJWendt/testza v0.5.2/go.mod h1:xu53QFE5sCdjtMCKk8YMQ2MnymimEctc4n3EjyIYvEY= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc= @@ -178,6 +181,8 @@ github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUork github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg= +github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= +github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= @@ -206,6 +211,7 @@ github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfE github.com/hjson/hjson-go/v4 v4.0.0/go.mod h1:KaYt3bTw3zhBjYqnXkYywcYctk0A2nxeEFTse3rH13E= github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= github.com/knadh/koanf v1.4.3/go.mod h1:5FAkuykKXZvLqhAbP4peWgM5CTcZmn7L1d27k/a+kfg= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= @@ -213,6 +219,7 @@ github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJys github.com/mostynb/go-grpc-compression v1.1.17/go.mod h1:FUSBr0QjKqQgoDG/e0yiqlR6aqyXC39+g/hFLDfSsEY= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= @@ -248,7 +255,6 @@ go.opentelemetry.io/otel/metric v0.31.0/go.mod h1:ohmwj9KTSIeBnDBm/ZwH2PSZxZzoOa go.opentelemetry.io/otel/sdk v1.9.0/go.mod h1:AEZc8nt5bd2F7BC24J5R0mrjYnpEgYHyTcM/vrSple4= go.opentelemetry.io/otel/sdk/metric v0.31.0/go.mod h1:fl0SmNnX9mN9xgU6OLYLMBMrNAsaZQi7qBwprwO3abk= go.opentelemetry.io/otel/trace v1.9.0/go.mod h1:2737Q0MuG8q1uILYm2YYVkAyLtOofiTNGg6VODnOiPo= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= @@ -262,8 +268,6 @@ golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfS golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= diff --git a/server/go.mod b/server/go.mod index 8cf6fede35..d6c1242390 100644 --- a/server/go.mod +++ b/server/go.mod @@ -5,6 +5,9 @@ go 1.20 replace k8s.io/client-go => k8s.io/client-go v0.18.0 require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 + github.com/Azure/azure-sdk-for-go/sdk/monitor/azquery v1.1.0 github.com/Jeffail/gabs/v2 v2.7.0 github.com/alecthomas/participle/v2 v2.0.0-alpha8 github.com/aws/aws-sdk-go v1.44.196 @@ -62,6 +65,8 @@ require ( ) require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect github.com/Microsoft/go-winio v0.5.2 // indirect github.com/PuerkitoBio/purell v1.1.1 // indirect github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect @@ -78,6 +83,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-redis/redis/v7 v7.4.1 // indirect + github.com/golang-jwt/jwt/v4 v4.5.0 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect @@ -87,6 +93,7 @@ require ( github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/klauspost/compress v1.15.6 // indirect github.com/knadh/koanf v1.4.0 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.12 // indirect github.com/mattn/go-isatty v0.0.14 // indirect @@ -96,6 +103,7 @@ require ( github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 // indirect github.com/pelletier/go-toml/v2 v2.0.6 // indirect + github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/segmentio/backo-go v1.0.0 // indirect github.com/sirupsen/logrus v1.8.1 // indirect @@ -112,10 +120,11 @@ require ( go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.8.0 // indirect go.uber.org/zap v1.21.0 // indirect - golang.org/x/net v0.7.0 // indirect + golang.org/x/crypto v0.7.0 // indirect + golang.org/x/net v0.8.0 // indirect golang.org/x/sync v0.1.0 // indirect golang.org/x/sys v0.6.0 // indirect - golang.org/x/text v0.7.0 // indirect + golang.org/x/text v0.8.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/server/go.sum b/server/go.sum index ecc0d957a4..35fcd101fc 100644 --- a/server/go.sum +++ b/server/go.sum @@ -67,6 +67,14 @@ github.com/Azure/azure-pipeline-go v0.2.3/go.mod h1:x841ezTBIMG6O3lAcl8ATHnsOPVl github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/azure-sdk-for-go v41.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/azure-sdk-for-go v59.4.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 h1:8kDqDngH+DmVBiCtIjCFTGa7MBnsIOkF9IccInFEbjk= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/monitor/azquery v1.1.0 h1:l+LIDHsZkFBiipIKhOn3m5/2MX4bwNwHYWyNulPaTis= +github.com/Azure/azure-sdk-for-go/sdk/monitor/azquery v1.1.0/go.mod h1:BjVVBLUiZ/qR2a4PAhjs8uGXNfStD0tSxgxCMfcVRT8= github.com/Azure/azure-storage-blob-go v0.14.0/go.mod h1:SMqIBi+SuiQH32bvyjngEewEeXoPfKMgWlBDaYf6fck= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/Azure/go-ansiterm v0.0.0-20210608223527-2377c96fe795/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= @@ -104,6 +112,8 @@ github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZ github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= +github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 h1:OBhqkivkhkMqLPymWEppkm7vgPQY2XsHoEkaMQ0AdZY= +github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ClickHouse/clickhouse-go v1.4.3/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI= @@ -468,6 +478,7 @@ github.com/dhui/dktest v0.3.10/go.mod h1:h5Enh0nG3Qbo9WjNFRrwmKUaePEBhXMOygbz3Ww github.com/digitalocean/godo v1.72.0/go.mod h1:GBmu8MkjZmNARE7IXRPmkbbnocNN8+uBm0xbEVw2LCs= github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= +github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY= github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= @@ -759,6 +770,8 @@ github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69 github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang-jwt/jwt/v4 v4.1.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= +github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang-migrate/migrate/v4 v4.15.2 h1:vU+M05vs6jWHKDdmE1Ecwj0BznygFc4QsdRe2E/L7kc= github.com/golang-migrate/migrate/v4 v4.15.2/go.mod h1:f2toGLkYqD3JH+Todi4aZ2ZdbeUNx4sIwiOK96rE9Lw= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= @@ -1141,6 +1154,7 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/ktrysmt/go-bitbucket v0.6.4/go.mod h1:9u0v3hsd2rqCHRIpbir1oP7F58uo5dq19sBYvuMoyQ4= github.com/kylelemons/godebug v0.0.0-20160406211939-eadb3ce320cb/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= @@ -1398,6 +1412,7 @@ github.com/pierrec/lz4/v3 v3.3.4/go.mod h1:280XNCGS8jAcG++AHdd6SeWnzyJ1w9oow2vbO github.com/pierrec/lz4/v4 v4.1.8/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -1849,6 +1864,7 @@ golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1979,8 +1995,8 @@ golang.org/x/net v0.0.0-20220111093109-d55c255bac03/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -2177,8 +2193,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/server/http/mappings/datastore.go b/server/http/mappings/datastore.go index 1c98c03ba7..61aa516ed6 100644 --- a/server/http/mappings/datastore.go +++ b/server/http/mappings/datastore.go @@ -47,17 +47,18 @@ func (m *OpenAPI) ConnectionTestStep(in model.ConnectionTestStep) openapi.Connec } var dataStoreTypesMapping = map[datastoreresource.DataStoreType]openapi.SupportedDataStores{ - datastoreresource.DataStoreTypeJaeger: openapi.JAEGER, - datastoreresource.DataStoreTypeTempo: openapi.TEMPO, - datastoreresource.DataStoreTypeOpenSearch: openapi.OPENSEARCH, - datastoreresource.DataStoreTypeSignalFX: openapi.SIGNALFX, - datastoreresource.DataStoreTypeOTLP: openapi.OTLP, - datastoreresource.DataStoreTypeNewRelic: openapi.NEWRELIC, - datastoreresource.DataStoreTypeLighStep: openapi.LIGHTSTEP, - datastoreresource.DataStoreTypeElasticAPM: openapi.ELASTICAPM, - datastoreresource.DataStoreTypeDataDog: openapi.DATADOG, - datastoreresource.DataStoreTypeAwsXRay: openapi.AWSXRAY, - datastoreresource.DataStoreTypeHoneycomb: openapi.HONEYCOMB, + datastoreresource.DataStoreTypeJaeger: openapi.JAEGER, + datastoreresource.DataStoreTypeTempo: openapi.TEMPO, + datastoreresource.DataStoreTypeOpenSearch: openapi.OPENSEARCH, + datastoreresource.DataStoreTypeSignalFX: openapi.SIGNALFX, + datastoreresource.DataStoreTypeOTLP: openapi.OTLP, + datastoreresource.DataStoreTypeNewRelic: openapi.NEWRELIC, + datastoreresource.DataStoreTypeLighStep: openapi.LIGHTSTEP, + datastoreresource.DataStoreTypeElasticAPM: openapi.ELASTICAPM, + datastoreresource.DataStoreTypeDataDog: openapi.DATADOG, + datastoreresource.DataStoreTypeAwsXRay: openapi.AWSXRAY, + datastoreresource.DataStoreTypeHoneycomb: openapi.HONEYCOMB, + datastoreresource.DatastoreTypeAzureAppInsights: openapi.AZUREAPPINSIGHTS, } func (m OpenAPI) DataStoreType(in datastoreresource.DataStoreType) openapi.SupportedDataStores { @@ -143,5 +144,11 @@ func (m Model) DataStore(in openapi.DataStore) datastoreresource.DataStore { deepcopy.DeepCopy(in.Signalfx, &dataStore.Values.SignalFx) } + // Azure App Insights + if dataStore.Type == datastoreresource.DatastoreTypeAzureAppInsights { + dataStore.Values.AzureAppInsights = &datastoreresource.AzureAppInsightsConfig{} + deepcopy.DeepCopy(in.Azureappinsights, &dataStore.Values.AzureAppInsights) + } + return dataStore } diff --git a/server/openapi/model_azure_app_insights.go b/server/openapi/model_azure_app_insights.go new file mode 100644 index 0000000000..7bdf1f248c --- /dev/null +++ b/server/openapi/model_azure_app_insights.go @@ -0,0 +1,37 @@ +/* + * TraceTest + * + * OpenAPI definition for TraceTest endpoint and resources + * + * API version: 0.2.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +type AzureAppInsights struct { + UseAzureActiveDirectoryAuth bool `json:"useAzureActiveDirectoryAuth,omitempty"` + + AccessToken string `json:"accessToken,omitempty"` + + ConnectionType SupportedConnectionTypes `json:"connectionType,omitempty"` + + ResourceArmId string `json:"resourceArmId,omitempty"` +} + +// AssertAzureAppInsightsRequired checks if the required fields are not zero-ed +func AssertAzureAppInsightsRequired(obj AzureAppInsights) error { + return nil +} + +// AssertRecurseAzureAppInsightsRequired recursively checks if required fields are not zero-ed in a nested slice. +// Accepts only nested slice of AzureAppInsights (e.g. [][]AzureAppInsights), otherwise ErrTypeAssertionError is thrown. +func AssertRecurseAzureAppInsightsRequired(objSlice interface{}) error { + return AssertRecurseInterfaceRequired(objSlice, func(obj interface{}) error { + aAzureAppInsights, ok := obj.(AzureAppInsights) + if !ok { + return ErrTypeAssertionError + } + return AssertAzureAppInsightsRequired(aAzureAppInsights) + }) +} diff --git a/server/openapi/model_data_store.go b/server/openapi/model_data_store.go index e5ece88552..873278517a 100644 --- a/server/openapi/model_data_store.go +++ b/server/openapi/model_data_store.go @@ -34,6 +34,8 @@ type DataStore struct { Awsxray AwsXRay `json:"awsxray,omitempty"` + Azureappinsights AzureAppInsights `json:"azureappinsights,omitempty"` + CreatedAt time.Time `json:"createdAt,omitempty"` } @@ -67,6 +69,9 @@ func AssertDataStoreRequired(obj DataStore) error { if err := AssertAwsXRayRequired(obj.Awsxray); err != nil { return err } + if err := AssertAzureAppInsightsRequired(obj.Azureappinsights); err != nil { + return err + } return nil } diff --git a/server/openapi/model_supported_connection_types.go b/server/openapi/model_supported_connection_types.go new file mode 100644 index 0000000000..4c0c5a56d8 --- /dev/null +++ b/server/openapi/model_supported_connection_types.go @@ -0,0 +1,35 @@ +/* + * TraceTest + * + * OpenAPI definition for TraceTest endpoint and resources + * + * API version: 0.2.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +type SupportedConnectionTypes string + +// List of SupportedConnectionTypes +const ( + DIRECT SupportedConnectionTypes = "direct" + COLLECTOR SupportedConnectionTypes = "collector" +) + +// AssertSupportedConnectionTypesRequired checks if the required fields are not zero-ed +func AssertSupportedConnectionTypesRequired(obj SupportedConnectionTypes) error { + return nil +} + +// AssertRecurseSupportedConnectionTypesRequired recursively checks if required fields are not zero-ed in a nested slice. +// Accepts only nested slice of SupportedConnectionTypes (e.g. [][]SupportedConnectionTypes), otherwise ErrTypeAssertionError is thrown. +func AssertRecurseSupportedConnectionTypesRequired(objSlice interface{}) error { + return AssertRecurseInterfaceRequired(objSlice, func(obj interface{}) error { + aSupportedConnectionTypes, ok := obj.(SupportedConnectionTypes) + if !ok { + return ErrTypeAssertionError + } + return AssertSupportedConnectionTypesRequired(aSupportedConnectionTypes) + }) +} diff --git a/server/openapi/model_supported_data_stores.go b/server/openapi/model_supported_data_stores.go index c68e806749..3ea1e0a2f4 100644 --- a/server/openapi/model_supported_data_stores.go +++ b/server/openapi/model_supported_data_stores.go @@ -13,17 +13,18 @@ type SupportedDataStores string // List of SupportedDataStores const ( - JAEGER SupportedDataStores = "jaeger" - OPENSEARCH SupportedDataStores = "opensearch" - TEMPO SupportedDataStores = "tempo" - SIGNALFX SupportedDataStores = "signalfx" - OTLP SupportedDataStores = "otlp" - ELASTICAPM SupportedDataStores = "elasticapm" - NEWRELIC SupportedDataStores = "newrelic" - LIGHTSTEP SupportedDataStores = "lightstep" - DATADOG SupportedDataStores = "datadog" - AWSXRAY SupportedDataStores = "awsxray" - HONEYCOMB SupportedDataStores = "honeycomb" + JAEGER SupportedDataStores = "jaeger" + OPENSEARCH SupportedDataStores = "opensearch" + TEMPO SupportedDataStores = "tempo" + SIGNALFX SupportedDataStores = "signalfx" + OTLP SupportedDataStores = "otlp" + ELASTICAPM SupportedDataStores = "elasticapm" + NEWRELIC SupportedDataStores = "newrelic" + LIGHTSTEP SupportedDataStores = "lightstep" + DATADOG SupportedDataStores = "datadog" + AWSXRAY SupportedDataStores = "awsxray" + HONEYCOMB SupportedDataStores = "honeycomb" + AZUREAPPINSIGHTS SupportedDataStores = "azureappinsights" ) // AssertSupportedDataStoresRequired checks if the required fields are not zero-ed diff --git a/server/tracedb/awsxray.go b/server/tracedb/awsxray.go index 7c7fc0bcc9..8cd752b363 100644 --- a/server/tracedb/awsxray.go +++ b/server/tracedb/awsxray.go @@ -133,9 +133,7 @@ func (db *awsxrayDB) GetTraceByID(ctx context.Context, traceID string) (model.Tr return model.Trace{}, connection.ErrTraceNotFound } - trace, err := parseXRayTrace(traceID, res.Traces[0]) - - return trace, err + return parseXRayTrace(traceID, res.Traces[0]) } func parseXRayTrace(traceID string, rawTrace *xray.Trace) (model.Trace, error) { diff --git a/server/tracedb/azureappinsights.go b/server/tracedb/azureappinsights.go new file mode 100644 index 0000000000..4e2f23b8e4 --- /dev/null +++ b/server/tracedb/azureappinsights.go @@ -0,0 +1,315 @@ +package tracedb + +import ( + "context" + "encoding/json" + "fmt" + "strings" + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/monitor/azquery" + "github.com/kubeshop/tracetest/server/model" + "github.com/kubeshop/tracetest/server/tracedb/connection" + "github.com/kubeshop/tracetest/server/tracedb/datastoreresource" + "go.opentelemetry.io/otel/trace" +) + +var ( + azureLogUrl = "https://api.loganalytics.azure.com" +) + +type azureAppInsightsDB struct { + realTraceDB + + resourceArmId string + credentials azcore.TokenCredential + client *azquery.LogsClient +} + +var _ TraceDB = &azureAppInsightsDB{} + +func NewAzureAppInsightsDB(config *datastoreresource.AzureAppInsightsConfig) (TraceDB, error) { + var credentials azcore.TokenCredential + var err error + if config.UseAzureActiveDirectoryAuth { + credentials, err = azidentity.NewDefaultAzureCredential(nil) + if err != nil { + return nil, err + } + } else { + creds := []azcore.TokenCredential{ + &tokenCredentials{accessToken: config.AccessToken}, + } + + credentials, err = azidentity.NewChainedTokenCredential(creds, nil) + if err != nil { + return nil, err + } + } + + return &azureAppInsightsDB{ + resourceArmId: config.ResourceArmId, + credentials: credentials, + }, nil +} + +func (db *azureAppInsightsDB) Connect(ctx context.Context) error { + client, err := azquery.NewLogsClient(db.credentials, nil) + if err != nil { + return err + } + + db.client = client + return nil +} + +func (db *azureAppInsightsDB) Close() error { + return nil +} + +func (db *azureAppInsightsDB) Ready() bool { + return db.credentials != nil && db.client != nil +} + +func (db *azureAppInsightsDB) GetEndpoints() string { + return azureLogUrl +} + +func (db *azureAppInsightsDB) TestConnection(ctx context.Context) model.ConnectionResult { + url := azureLogUrl + tester := connection.NewTester( + connection.WithConnectivityTest(connection.ConnectivityStep(model.ProtocolHTTP, url)), + connection.WithPollingTest(connection.TracePollingTestStep(db)), + connection.WithAuthenticationTest(connection.NewTestStep(func(ctx context.Context) (string, error) { + _, err := db.GetTraceByID(ctx, db.GetTraceID().String()) + if err != nil && strings.Contains(strings.ToLower(err.Error()), "403") { + return `Tracetest tried to execute an Azure API request but it failed due to authentication issues`, err + } + + return "Tracetest managed to authenticate with the Azure Services", nil + })), + ) + + return tester.TestConnection(ctx) +} + +func (db *azureAppInsightsDB) GetTraceByID(ctx context.Context, traceID string) (model.Trace, error) { + query := fmt.Sprintf("union * | where operation_Id == '%s'", traceID) + body := azquery.Body{ + Query: &query, + } + + res, err := db.client.QueryResource(ctx, db.resourceArmId, body, nil) + if err != nil { + return model.Trace{}, err + } + + table := res.Tables[0] + if len(table.Rows) == 0 { + return model.Trace{}, connection.ErrTraceNotFound + } + + return parseAzureAppInsightsTrace(traceID, table) +} + +type columnIndex map[string]int + +func parseAzureAppInsightsTrace(traceID string, table *azquery.Table) (model.Trace, error) { + columnIndex := mapColumnNames(table.Columns) + spans := make([]model.Span, len(table.Rows)) + + for i, row := range table.Rows { + span, err := parseRowToSpan(row, columnIndex) + if err != nil { + return model.Trace{}, err + } + + spans[i] = span + } + + return model.NewTrace(traceID, spans), nil +} + +var columnNamesMap = map[string]string{ + "traceId": "operation_Id", + "spanId": "id", + "parentId": "operation_ParentId", + "name": "name", + "attributes": "customDimensions", + "startTime": "timestamp", + "duration": "duration", +} + +func parseRowToSpan(row azquery.Row, columnIndex columnIndex) (model.Span, error) { + attributes := make(model.Attributes, 0) + span := model.Span{ + Attributes: attributes, + } + var duration time.Duration + + for name, index := range columnIndex { + switch name { + case "spanId": + err := parseSpanId(&span, row, index) + if err != nil { + return span, err + } + case "attributes": + err := parseAttributes(&span, row, index) + if err != nil { + return span, err + } + case "parentId": + err := parseParentId(&span, row, index) + if err != nil { + return span, err + } + case "name": + err := parseName(&span, row, index) + if err != nil { + return span, err + } + case "startTime": + err := parseStartTime(&span, row, index) + if err != nil { + return span, err + } + case "duration": + timeDuration, err := parseDuration(row, index) + if err != nil { + return span, err + } + + duration = timeDuration + } + } + + span.EndTime = span.StartTime.Add(duration) + return span, nil +} + +func parseSpanId(span *model.Span, row azquery.Row, index int) error { + if index == -1 { + return fmt.Errorf("spanId column not found") + } + + rawSpanId := row[index].(string) + spanId, err := trace.SpanIDFromHex(rawSpanId) + if err != nil { + return fmt.Errorf("failed to parse spanId: %w", err) + } + + span.ID = spanId + return nil +} + +func parseAttributes(span *model.Span, row azquery.Row, index int) error { + if index == -1 { + return fmt.Errorf("attributes column not found") + } + + attributes := make(model.Attributes, 0) + rawAttributes := row[index].(string) + err := json.Unmarshal([]byte(rawAttributes), &attributes) + if err != nil { + return fmt.Errorf("failed to parse attributes: %w", err) + } + + for key, value := range attributes { + span.Attributes[key] = value + } + return nil +} + +func parseParentId(span *model.Span, row azquery.Row, index int) error { + if index == -1 { + return fmt.Errorf("parentId column not found") + } + + rawParentId, ok := row[index].(string) + if ok { + span.Attributes["parent_id"] = rawParentId + } else { + span.Attributes["parent_id"] = "" + } + return nil +} + +func parseName(span *model.Span, row azquery.Row, index int) error { + if index == -1 { + return fmt.Errorf("name column not found") + } + + rawName, ok := row[index].(string) + if ok { + span.Name = rawName + } else { + span.Name = "" + } + return nil +} + +func parseStartTime(span *model.Span, row azquery.Row, index int) error { + if index == -1 { + return fmt.Errorf("startTime column not found") + } + + rawStartTime := row[index].(string) + startTime, err := time.Parse(time.RFC3339Nano, rawStartTime) + if err != nil { + return fmt.Errorf("failed to parse startTime: %w", err) + } + + span.StartTime = startTime + return nil +} + +func parseDuration(row azquery.Row, index int) (time.Duration, error) { + if index == -1 { + return time.Duration(0), fmt.Errorf("duration column not found") + } + + rawDuration, ok := row[index].(float64) + if !ok { + return time.Duration(0), fmt.Errorf("failed to parse duration") + } + return time.Duration(rawDuration), nil +} + +func mapColumnNames(columns []*azquery.Column) columnIndex { + columnIndex := columnIndex{ + "traceId": -1, + "parentId": -1, + "name": -1, + "attributes": -1, + "startTime": -1, + "duration": -1, + } + + for name, azureName := range columnNamesMap { + columnIndex[name] = findColumnByName(columns, azureName) + } + + return columnIndex +} + +func findColumnByName(columns []*azquery.Column, name string) int { + for i, column := range columns { + if *column.Name == name { + return i + } + } + + return -1 +} + +type tokenCredentials struct { + accessToken string +} + +func (c *tokenCredentials) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { + return azcore.AccessToken{Token: c.accessToken}, nil +} diff --git a/server/tracedb/datastoreresource/resource_types.go b/server/tracedb/datastoreresource/resource_types.go index c7105237af..a04adc5df0 100644 --- a/server/tracedb/datastoreresource/resource_types.go +++ b/server/tracedb/datastoreresource/resource_types.go @@ -25,12 +25,13 @@ type DataStore struct { } type DataStoreValues struct { - AwsXRay *AWSXRayConfig `json:"awsxray,omitempty"` - ElasticApm *ElasticSearchConfig `json:"elasticapm,omitempty"` - Jaeger *GRPCClientSettings `json:"jaeger,omitempty"` - OpenSearch *ElasticSearchConfig `json:"opensearch,omitempty"` - SignalFx *SignalFXConfig `json:"signalfx,omitempty"` - Tempo *MultiChannelClientConfig `json:"tempo,omitempty"` + AwsXRay *AWSXRayConfig `json:"awsxray,omitempty"` + ElasticApm *ElasticSearchConfig `json:"elasticapm,omitempty"` + Jaeger *GRPCClientSettings `json:"jaeger,omitempty"` + OpenSearch *ElasticSearchConfig `json:"opensearch,omitempty"` + SignalFx *SignalFXConfig `json:"signalfx,omitempty"` + Tempo *MultiChannelClientConfig `json:"tempo,omitempty"` + AzureAppInsights *AzureAppInsightsConfig `json:"azureappinsights,omitempty"` } type AWSXRayConfig struct { @@ -111,18 +112,33 @@ type SignalFXConfig struct { Token string `json:"token"` } +type ConnectionTypes string + +const ( + ConnectionTypesDirect ConnectionTypes = "direct" + ConnectionTypesCollector ConnectionTypes = "collector" +) + +type AzureAppInsightsConfig struct { + UseAzureActiveDirectoryAuth bool `json:"useAzureActiveDirectoryAuth"` + AccessToken string `json:"accessToken"` + ResourceArmId string `json:"resourceArmId"` + ConnectionType ConnectionTypes `json:"connectionType"` +} + const ( - DataStoreTypeJaeger DataStoreType = "jaeger" - DataStoreTypeTempo DataStoreType = "tempo" - DataStoreTypeOpenSearch DataStoreType = "opensearch" - DataStoreTypeSignalFX DataStoreType = "signalfx" - DataStoreTypeOTLP DataStoreType = "otlp" - DataStoreTypeNewRelic DataStoreType = "newrelic" - DataStoreTypeLighStep DataStoreType = "lightstep" - DataStoreTypeElasticAPM DataStoreType = "elasticapm" - DataStoreTypeDataDog DataStoreType = "datadog" - DataStoreTypeAwsXRay DataStoreType = "awsxray" - DataStoreTypeHoneycomb DataStoreType = "honeycomb" + DataStoreTypeJaeger DataStoreType = "jaeger" + DataStoreTypeTempo DataStoreType = "tempo" + DataStoreTypeOpenSearch DataStoreType = "opensearch" + DataStoreTypeSignalFX DataStoreType = "signalfx" + DataStoreTypeOTLP DataStoreType = "otlp" + DataStoreTypeNewRelic DataStoreType = "newrelic" + DataStoreTypeLighStep DataStoreType = "lightstep" + DataStoreTypeElasticAPM DataStoreType = "elasticapm" + DataStoreTypeDataDog DataStoreType = "datadog" + DataStoreTypeAwsXRay DataStoreType = "awsxray" + DataStoreTypeHoneycomb DataStoreType = "honeycomb" + DatastoreTypeAzureAppInsights DataStoreType = "azureappinsights" ) var validTypes = []DataStoreType{ @@ -137,6 +153,7 @@ var validTypes = []DataStoreType{ DataStoreTypeDataDog, DataStoreTypeAwsXRay, DataStoreTypeHoneycomb, + DatastoreTypeAzureAppInsights, } var otlpBasedDataStores = []DataStoreType{ @@ -190,6 +207,10 @@ func (ds DataStore) Validate() error { return fmt.Errorf("data store should have Tempo config values set up") } + if ds.Type == DatastoreTypeAzureAppInsights && ds.Values.AzureAppInsights == nil { + return fmt.Errorf("data store should have Azure Application Insights config values set up") + } + return nil } @@ -202,21 +223,26 @@ func (ds DataStore) GetID() id.ID { } func (ds DataStore) IsOTLPBasedProvider() bool { + if ds.Type == DatastoreTypeAzureAppInsights { + return ds.Values.AzureAppInsights.ConnectionType == ConnectionTypesCollector + } + return slices.Contains(otlpBasedDataStores, ds.Type) } type squashedDataStore struct { - ID id.ID `json:"id"` - Name string `json:"name"` - Type DataStoreType `json:"type"` - Default bool `json:"default"` - CreatedAt string `json:"createdAt"` - AwsXRay *AWSXRayConfig `json:"awsxray,omitempty"` - ElasticApm *ElasticSearchConfig `json:"elasticapm,omitempty"` - Jaeger *GRPCClientSettings `json:"jaeger,omitempty"` - OpenSearch *ElasticSearchConfig `json:"opensearch,omitempty"` - SignalFx *SignalFXConfig `json:"signalfx,omitempty"` - Tempo *MultiChannelClientConfig `json:"tempo,omitempty"` + ID id.ID `json:"id"` + Name string `json:"name"` + Type DataStoreType `json:"type"` + Default bool `json:"default"` + CreatedAt string `json:"createdAt"` + AwsXRay *AWSXRayConfig `json:"awsxray,omitempty"` + ElasticApm *ElasticSearchConfig `json:"elasticapm,omitempty"` + Jaeger *GRPCClientSettings `json:"jaeger,omitempty"` + OpenSearch *ElasticSearchConfig `json:"opensearch,omitempty"` + SignalFx *SignalFXConfig `json:"signalfx,omitempty"` + Tempo *MultiChannelClientConfig `json:"tempo,omitempty"` + AzureAppInsightsConfig *AzureAppInsightsConfig `json:"azureappinsights,omitempty"` } func (d squashedDataStore) populate(dataStore *DataStore) { @@ -230,12 +256,13 @@ func (d squashedDataStore) populate(dataStore *DataStore) { dataStore.Default = d.Default dataStore.CreatedAt = d.CreatedAt dataStore.Values = DataStoreValues{ - AwsXRay: d.AwsXRay, - ElasticApm: d.ElasticApm, - Jaeger: d.Jaeger, - OpenSearch: d.OpenSearch, - SignalFx: d.SignalFx, - Tempo: d.Tempo, + AwsXRay: d.AwsXRay, + ElasticApm: d.ElasticApm, + Jaeger: d.Jaeger, + OpenSearch: d.OpenSearch, + SignalFx: d.SignalFx, + Tempo: d.Tempo, + AzureAppInsights: d.AzureAppInsightsConfig, } } @@ -275,16 +302,17 @@ func (d *DataStore) UnmarshalYAML(input []byte) error { func (d DataStore) squashed() squashedDataStore { return squashedDataStore{ - ID: d.ID, - Name: d.Name, - Type: d.Type, - Default: d.Default, - CreatedAt: d.CreatedAt, - AwsXRay: d.Values.AwsXRay, - ElasticApm: d.Values.ElasticApm, - Jaeger: d.Values.Jaeger, - OpenSearch: d.Values.OpenSearch, - SignalFx: d.Values.SignalFx, - Tempo: d.Values.Tempo, + ID: d.ID, + Name: d.Name, + Type: d.Type, + Default: d.Default, + CreatedAt: d.CreatedAt, + AwsXRay: d.Values.AwsXRay, + ElasticApm: d.Values.ElasticApm, + Jaeger: d.Values.Jaeger, + OpenSearch: d.Values.OpenSearch, + SignalFx: d.Values.SignalFx, + Tempo: d.Values.Tempo, + AzureAppInsightsConfig: d.Values.AzureAppInsights, } } diff --git a/server/tracedb/tracedb.go b/server/tracedb/tracedb.go index b6753528be..dc5044d826 100644 --- a/server/tracedb/tracedb.go +++ b/server/tracedb/tracedb.go @@ -79,6 +79,8 @@ func (f *traceDBFactory) getTraceDBInstance(ds datastoreresource.DataStore) (Tra tdb, err = newSignalFXDB(ds.Values.SignalFx) case datastoreresource.DataStoreTypeAwsXRay: tdb, err = NewAwsXRayDB(ds.Values.AwsXRay) + case datastoreresource.DatastoreTypeAzureAppInsights: + tdb, err = NewAzureAppInsightsDB(ds.Values.AzureAppInsights) default: return &noopTraceDB{}, nil } diff --git a/web/src/components/DataStoreIcon/DataStoreIcon.tsx b/web/src/components/DataStoreIcon/DataStoreIcon.tsx index 19f0d23f04..ad838f4e13 100644 --- a/web/src/components/DataStoreIcon/DataStoreIcon.tsx +++ b/web/src/components/DataStoreIcon/DataStoreIcon.tsx @@ -11,6 +11,7 @@ import SignalFx from './Icons/SignalFx'; import Tempo from './Icons/Tempo'; import AWSXRay from './Icons/AwsXRay'; import Honeycomb from './Icons/Honeycomb'; +import AzureAppInsights from './Icons/AzureAppInsights'; const iconMap = { [SupportedDataStores.JAEGER]: Jaeger, @@ -24,6 +25,7 @@ const iconMap = { [SupportedDataStores.Datadog]: Datadog, [SupportedDataStores.AWSXRay]: AWSXRay, [SupportedDataStores.Honeycomb]: Honeycomb, + [SupportedDataStores.AzureAppInsights]: AzureAppInsights, } as const; interface IProps { diff --git a/web/src/components/DataStoreIcon/Icons/AzureAppInsights.tsx b/web/src/components/DataStoreIcon/Icons/AzureAppInsights.tsx new file mode 100644 index 0000000000..b67d2a1fac --- /dev/null +++ b/web/src/components/DataStoreIcon/Icons/AzureAppInsights.tsx @@ -0,0 +1,36 @@ +import {IIconProps} from '../DataStoreIcon'; + +const AzureAppInsights = ({color, width = '20', height = '20'}: IIconProps) => { + return ( + + + + + + + ); +}; + +export default AzureAppInsights; diff --git a/web/src/components/Settings/DataStorePlugin/DataStorePlugin.tsx b/web/src/components/Settings/DataStorePlugin/DataStorePlugin.tsx index 8f3361ab00..8b135471dd 100644 --- a/web/src/components/Settings/DataStorePlugin/DataStorePlugin.tsx +++ b/web/src/components/Settings/DataStorePlugin/DataStorePlugin.tsx @@ -5,6 +5,7 @@ import OpenTelemetryCollector from './forms/OpenTelemetryCollector'; import SignalFx from './forms/SignalFx/SignalFx'; import BaseClient from './forms/BaseClient'; import AwsXRay from './forms/AwsXRay'; +import AzureAppInsights from './forms/AzureAppInsights/AzureAppInsights'; export const DataStoreComponentMap: IDataStorePluginMap = { [SupportedDataStores.JAEGER]: GrpcClient, @@ -18,6 +19,7 @@ export const DataStoreComponentMap: IDataStorePluginMap = { [SupportedDataStores.NewRelic]: OpenTelemetryCollector, [SupportedDataStores.Honeycomb]: OpenTelemetryCollector, [SupportedDataStores.AWSXRay]: AwsXRay, + [SupportedDataStores.AzureAppInsights]: AzureAppInsights, }; export default DataStoreComponentMap; diff --git a/web/src/components/Settings/DataStorePlugin/forms/AzureAppInsights/AzureAppInsights.tsx b/web/src/components/Settings/DataStorePlugin/forms/AzureAppInsights/AzureAppInsights.tsx new file mode 100644 index 0000000000..a45d9e9b90 --- /dev/null +++ b/web/src/components/Settings/DataStorePlugin/forms/AzureAppInsights/AzureAppInsights.tsx @@ -0,0 +1,77 @@ +import {Checkbox, Col, Form, Input, Radio, Row} from 'antd'; +import {ConnectionTypes, SupportedDataStores, TDraftDataStore} from 'types/DataStore.types'; +import * as S from 'components/Settings/DataStoreForm/DataStoreForm.styled'; +import {collectorExplanation} from 'constants/DataStore.constants'; +import OpenTelemetryCollector from '../OpenTelemetryCollector/OpenTelemetryCollector'; + +const AzureAppInsights = () => { + const baseName = ['dataStore', SupportedDataStores.AzureAppInsights]; + const form = Form.useFormInstance(); + const connectionType = Form.useWatch([...baseName, 'connectionType'], form); + const useAzureActiveDirectoryAuth = Form.useWatch([...baseName, 'useAzureActiveDirectoryAuth'], form); + + return ( + <> + + + Connection type: + + + Direct Connection + Open Telemetry Collector + + + + + {(connectionType === ConnectionTypes.Direct && ( + <> + + + + + + + + + + + Use Azure Active Directory Auth + + + + + + + + + + + + )) || ( + <> + + + {collectorExplanation} + + + + + + + + + + )} + + ); +}; + +export default AzureAppInsights; diff --git a/web/src/components/Settings/DataStorePlugin/forms/AzureAppInsights/index.ts b/web/src/components/Settings/DataStorePlugin/forms/AzureAppInsights/index.ts new file mode 100644 index 0000000000..e6a294107e --- /dev/null +++ b/web/src/components/Settings/DataStorePlugin/forms/AzureAppInsights/index.ts @@ -0,0 +1,2 @@ +// eslint-disable-next-line no-restricted-exports +export {default} from './AzureAppInsights'; diff --git a/web/src/constants/CollectorConfig.constants.ts b/web/src/constants/CollectorConfig.constants.ts index b7c69397bb..0bb1ef9c27 100644 --- a/web/src/constants/CollectorConfig.constants.ts +++ b/web/src/constants/CollectorConfig.constants.ts @@ -171,10 +171,39 @@ service: exporters: [logging, otlp/honeycomb] `; +export const AzureAppInsights = `receivers: +otlp: + protocols: + grpc: + http: + +processors: +batch: + +exporters: +azuremonitor: + instrumentation_key: +otlp/tracetest: + endpoint: tracetest:4317 + tls: + insecure: true + +service: +pipelines: + traces/tracetest: + receivers: [otlp] + processors: [batch] + exporters: [otlp/tracetest] + traces/appinsights: + receivers: [otlp] + exporters: [azuremonitor] +`; + export const CollectorConfigMap = { [SupportedDataStores.Datadog]: Datadog, [SupportedDataStores.Lightstep]: Lightstep, [SupportedDataStores.NewRelic]: NewRelic, [SupportedDataStores.OtelCollector]: OtelCollector, [SupportedDataStores.Honeycomb]: Honeycomb, + [SupportedDataStores.AzureAppInsights]: AzureAppInsights, } as const; diff --git a/web/src/constants/DataStore.constants.tsx b/web/src/constants/DataStore.constants.tsx index 5a176d2942..40d6f3cc88 100644 --- a/web/src/constants/DataStore.constants.tsx +++ b/web/src/constants/DataStore.constants.tsx @@ -12,6 +12,7 @@ export const SupportedDataStoresToName = { [SupportedDataStores.Datadog]: 'Datadog', [SupportedDataStores.AWSXRay]: 'AWS X-Ray', [SupportedDataStores.Honeycomb]: 'Honeycomb', + [SupportedDataStores.AzureAppInsights]: 'Azure App Insights', } as const; export const SupportedDataStoresToDocsLink = { @@ -27,6 +28,7 @@ export const SupportedDataStoresToDocsLink = { [SupportedDataStores.OtelCollector]: 'https://docs.tracetest.io/configuration/connecting-to-data-stores/opentelemetry-collector', [SupportedDataStores.Honeycomb]: 'https://docs.tracetest.io/configuration/connecting-to-data-stores/honeycomb', + [SupportedDataStores.AzureAppInsights]: 'https://docs.tracetest.io/configuration/connecting-to-data-stores/azure-app-insights', } as const; export const SupportedDataStoresToDefaultEndpoint = { @@ -41,9 +43,10 @@ export const SupportedDataStoresToDefaultEndpoint = { [SupportedDataStores.Datadog]: '', [SupportedDataStores.AWSXRay]: '', [SupportedDataStores.Honeycomb]: '', + [SupportedDataStores.AzureAppInsights]: '', } as const; -const collectorExplanation = ( +export const collectorExplanation = ( <> Tracetest can work with any distributed tracing solution that is utilizing the{' '} @@ -60,11 +63,3 @@ export const SupportedDataStoresToExplanation: Record['spec'] & {otlp?: {}; newrelic?: {}; lightstep?: {}; datadog?: {}, honeycomb?: {}}; +type DataStore = Model['spec'] & { + otlp?: {}; + newrelic?: {}; + lightstep?: {}; + datadog?: {}; + honeycomb?: {}; +}; const DataStore = ({ spec: { @@ -17,6 +23,7 @@ const DataStore = ({ jaeger = {}, tempo = {}, awsxray = {}, + azureappinsights = {}, } = {id: '', name: '', type: SupportedDataStores.JAEGER}, }: TRawDataStore): DataStore => ({ id, @@ -30,6 +37,7 @@ const DataStore = ({ jaeger, tempo, awsxray, + azureappinsights, }); export default DataStore; diff --git a/web/src/providers/DataStore/DataStore.provider.tsx b/web/src/providers/DataStore/DataStore.provider.tsx index 2e93d4c7b8..34f9938bee 100644 --- a/web/src/providers/DataStore/DataStore.provider.tsx +++ b/web/src/providers/DataStore/DataStore.provider.tsx @@ -1,7 +1,7 @@ import {noop} from 'lodash'; import {createContext, useCallback, useContext, useMemo, useState} from 'react'; -import {NoTestConnectionDataStoreList, SupportedDataStoresToName} from 'constants/DataStore.constants'; +import {SupportedDataStoresToName} from 'constants/DataStore.constants'; import ConnectionResult from 'models/ConnectionResult.model'; import { useTestConnectionMutation, @@ -98,8 +98,8 @@ const DataStoreProvider = ({children}: IProps) => { async (draft: TDraftDataStore, defaultDataStore: DataStore) => { const dataStore = await DataStoreService.getRequest(draft, defaultDataStore); - if (NoTestConnectionDataStoreList.includes(draft.dataStoreType!)) { - return showTestConnectionNotification(ConnectionResult({}), draft.dataStoreType!); + if (!DataStoreService.shouldTestConnection(draft)) { + return showTestConnectionNotification(ConnectionResult({}), draft.dataStoreType!, false); } try { diff --git a/web/src/providers/DataStore/hooks/useDataStoreNotification.tsx b/web/src/providers/DataStore/hooks/useDataStoreNotification.tsx index 1d0f88752c..2019471d0d 100644 --- a/web/src/providers/DataStore/hooks/useDataStoreNotification.tsx +++ b/web/src/providers/DataStore/hooks/useDataStoreNotification.tsx @@ -2,15 +2,14 @@ import {Typography} from 'antd'; import {useCallback} from 'react'; import {SupportedDataStores, TConnectionResult} from 'types/DataStore.types'; import TestConnectionNotification from 'components/TestConnectionNotification/TestConnectionNotification'; -import {NoTestConnectionDataStoreList} from 'constants/DataStore.constants'; import {useNotification} from 'providers/Notification/Notification.provider'; const useDataStoreNotification = () => { const {showNotification} = useNotification(); const showTestConnectionNotification = useCallback( - (result: TConnectionResult, dataStoreType: SupportedDataStores) => { - if (NoTestConnectionDataStoreList.includes(dataStoreType)) { + (result: TConnectionResult, dataStoreType: SupportedDataStores, hasTestedTheConnection = true) => { + if (!hasTestedTheConnection) { return showNotification({ type: 'info', title: No Automated Test, diff --git a/web/src/services/DataStore.service.ts b/web/src/services/DataStore.service.ts index a3d148bcbf..9fd94dec6c 100644 --- a/web/src/services/DataStore.service.ts +++ b/web/src/services/DataStore.service.ts @@ -1,4 +1,4 @@ -import {SupportedDataStores, TDraftDataStore} from 'types/DataStore.types'; +import {SupportedDataStores, TDataStoreService, TDraftDataStore} from 'types/DataStore.types'; import DataStore, {TRawDataStore} from 'models/DataStore.model'; import DataStoreConfig from 'models/DataStoreConfig.model'; import ElasticSearchService from './DataStores/ElasticSearch.service'; @@ -7,12 +7,7 @@ import SignalFxService from './DataStores/SignalFx.service'; import BaseClientService from './DataStores/BaseClient.service'; import JaegerService from './DataStores/Jaeger.service'; import AwsXRayService from './DataStores/AwsXRay.service'; - -interface IDataStoreService { - getRequest(draft: TDraftDataStore, defaultDataStore: DataStore): Promise; - getInitialValues(config: DataStoreConfig): TDraftDataStore; - validateDraft(config: TDraftDataStore): Promise; -} +import AzureAppInsightsService from './DataStores/AzureAppInsights.service'; const dataStoreServiceMap = { [SupportedDataStores.JAEGER]: JaegerService, @@ -26,12 +21,25 @@ const dataStoreServiceMap = { [SupportedDataStores.Datadog]: OtelCollectorService, [SupportedDataStores.Honeycomb]: OtelCollectorService, [SupportedDataStores.AWSXRay]: AwsXRayService, + [SupportedDataStores.AzureAppInsights]: AzureAppInsightsService, } as const; +interface IDataStoreService { + getRequest(draft: TDraftDataStore, defaultDataStore: DataStore): Promise; + getInitialValues(config: DataStoreConfig): TDraftDataStore; + validateDraft(config: TDraftDataStore): Promise; + shouldTestConnection(draft: TDraftDataStore): boolean; + _getDataStore(type?: SupportedDataStores): TDataStoreService; +} + const DataStoreService = (): IDataStoreService => ({ + _getDataStore(type = SupportedDataStores.JAEGER) { + return dataStoreServiceMap[type]; + }, async getRequest(draft, defaultDataStore) { const dataStoreType = draft.dataStoreType || SupportedDataStores.JAEGER; - const dataStoreValues = await dataStoreServiceMap[dataStoreType].getRequest(draft, dataStoreType); + const dataStoreService = this._getDataStore(dataStoreType); + const dataStoreValues = await dataStoreService.getRequest(draft, dataStoreType); const isUpdate = !!defaultDataStore.id; const dataStore: DataStore = isUpdate @@ -52,16 +60,21 @@ const DataStoreService = (): IDataStoreService => ({ getInitialValues(dataStoreConfig) { const {defaultDataStore} = dataStoreConfig; const type = (defaultDataStore.type || SupportedDataStores.JAEGER) as SupportedDataStores; + const dataStore = this._getDataStore(type); - return {...dataStoreServiceMap[type].getInitialValues(dataStoreConfig, type), dataStoreType: type}; + return {...dataStore.getInitialValues(dataStoreConfig, type), dataStoreType: type}; }, validateDraft(draft) { - const dataStoreType = draft.dataStoreType || SupportedDataStores.JAEGER; - const dataStore = dataStoreServiceMap[dataStoreType]; - + const dataStore = this._getDataStore(draft.dataStoreType); return dataStore.validateDraft(draft); }, + + shouldTestConnection(draft) { + const dataStore = this._getDataStore(draft.dataStoreType); + + return dataStore.shouldTestConnection(draft); + }, }); export default DataStoreService(); diff --git a/web/src/services/DataStores/AwsXRay.service.ts b/web/src/services/DataStores/AwsXRay.service.ts index 002538d667..e6a48a5ed7 100644 --- a/web/src/services/DataStores/AwsXRay.service.ts +++ b/web/src/services/DataStores/AwsXRay.service.ts @@ -37,6 +37,9 @@ const AwsXRayService = (): TDataStoreService => ({ dataStoreType: SupportedDataStores.AWSXRay, }; }, + shouldTestConnection() { + return true; + }, }); export default AwsXRayService(); diff --git a/web/src/services/DataStores/AzureAppInsights.service.ts b/web/src/services/DataStores/AzureAppInsights.service.ts new file mode 100644 index 0000000000..42b5990c98 --- /dev/null +++ b/web/src/services/DataStores/AzureAppInsights.service.ts @@ -0,0 +1,63 @@ +import {ConnectionTypes, SupportedDataStores, TDataStoreService} from 'types/DataStore.types'; + +const AzureAppInsightsService = (): TDataStoreService => ({ + getRequest({ + dataStore: { + azureappinsights: { + resourceArmId = '', + connectionType = ConnectionTypes.Direct, + useAzureActiveDirectoryAuth = true, + accessToken = '', + } = {}, + } = {}, + }) { + return Promise.resolve({ + type: SupportedDataStores.AzureAppInsights, + name: SupportedDataStores.AzureAppInsights, + azureappinsights: { + resourceArmId, + connectionType, + useAzureActiveDirectoryAuth, + accessToken, + }, + }); + }, + validateDraft({ + dataStore: { + azureappinsights: { + resourceArmId = '', + connectionType = ConnectionTypes.Direct, + accessToken = '', + useAzureActiveDirectoryAuth = true, + } = {}, + } = {}, + }) { + if (connectionType === ConnectionTypes.Direct && !resourceArmId) return Promise.resolve(false); + if (connectionType === ConnectionTypes.Direct && !useAzureActiveDirectoryAuth && !accessToken) + return Promise.resolve(false); + + return Promise.resolve(true); + }, + getInitialValues({defaultDataStore: {azureappinsights = {}} = {}}) { + const { + resourceArmId = '', + connectionType = ConnectionTypes.Direct, + accessToken = '', + useAzureActiveDirectoryAuth = true, + } = azureappinsights; + + return { + dataStore: { + name: SupportedDataStores.AzureAppInsights, + type: SupportedDataStores.AzureAppInsights, + azureappinsights: {resourceArmId, connectionType, accessToken, useAzureActiveDirectoryAuth}, + }, + dataStoreType: SupportedDataStores.AzureAppInsights, + }; + }, + shouldTestConnection({dataStore: {azureappinsights: {connectionType = ConnectionTypes.Direct} = {}} = {}}) { + return connectionType === ConnectionTypes.Direct; + }, +}); + +export default AzureAppInsightsService(); diff --git a/web/src/services/DataStores/BaseClient.service.ts b/web/src/services/DataStores/BaseClient.service.ts index 781759d5e1..e14694f5ad 100644 --- a/web/src/services/DataStores/BaseClient.service.ts +++ b/web/src/services/DataStores/BaseClient.service.ts @@ -74,6 +74,9 @@ const BaseClientService = (): TDataStoreService => ({ dataStoreType, }; }, + shouldTestConnection() { + return true; + }, }); export default BaseClientService(); diff --git a/web/src/services/DataStores/ElasticSearch.service.ts b/web/src/services/DataStores/ElasticSearch.service.ts index 8375529892..c91d51532c 100644 --- a/web/src/services/DataStores/ElasticSearch.service.ts +++ b/web/src/services/DataStores/ElasticSearch.service.ts @@ -66,6 +66,9 @@ const ElasticSearchService = (): TDataStoreService => ({ dataStoreType, }; }, + shouldTestConnection() { + return true; + }, }); export default ElasticSearchService(); diff --git a/web/src/services/DataStores/Jaeger.service.ts b/web/src/services/DataStores/Jaeger.service.ts index b648250bfb..f397b4c36c 100644 --- a/web/src/services/DataStores/Jaeger.service.ts +++ b/web/src/services/DataStores/Jaeger.service.ts @@ -39,6 +39,9 @@ const JaegerService = (): TDataStoreService => ({ dataStoreType: SupportedDataStores.JAEGER, }; }, + shouldTestConnection() { + return true; + }, }); export default JaegerService(); diff --git a/web/src/services/DataStores/OtelCollector.service.ts b/web/src/services/DataStores/OtelCollector.service.ts index 5cf0c21f5b..9181a93f57 100644 --- a/web/src/services/DataStores/OtelCollector.service.ts +++ b/web/src/services/DataStores/OtelCollector.service.ts @@ -19,6 +19,9 @@ const OtelCollectorService = (): TDataStoreService => ({ dataStoreType, }; }, + shouldTestConnection() { + return false; + }, }); export default OtelCollectorService(); diff --git a/web/src/services/DataStores/SignalFx.service.ts b/web/src/services/DataStores/SignalFx.service.ts index 7f64a2302f..237654c584 100644 --- a/web/src/services/DataStores/SignalFx.service.ts +++ b/web/src/services/DataStores/SignalFx.service.ts @@ -24,6 +24,9 @@ const SignalFxService = (): TDataStoreService => ({ dataStoreType: SupportedDataStores.SignalFX, }; }, + shouldTestConnection() { + return true; + }, }); export default SignalFxService(); diff --git a/web/src/types/DataStore.types.ts b/web/src/types/DataStore.types.ts index 5e82cf2f04..eab2452650 100644 --- a/web/src/types/DataStore.types.ts +++ b/web/src/types/DataStore.types.ts @@ -10,6 +10,11 @@ export enum ConfigMode { READY = 'READY', } +export enum ConnectionTypes { + Collector = 'collector', + Direct = 'direct', +} + export enum SupportedDataStores { JAEGER = 'jaeger', TEMPO = 'tempo', @@ -22,6 +27,7 @@ export enum SupportedDataStores { Datadog = 'datadog', AWSXRay = 'awsxray', Honeycomb = 'honeycomb', + AzureAppInsights = 'azureappinsights', } export enum SupportedClientTypes { @@ -100,6 +106,7 @@ export type TDataStoreService = { getRequest(values: TDraftDataStore, dataStoreType?: SupportedDataStores): Promise; validateDraft(draft: TDraftDataStore): Promise; getInitialValues(draft: DataStoreConfig, dataStoreType?: SupportedDataStores): TDraftDataStore; + shouldTestConnection(draft: TDraftDataStore): boolean; }; export interface IDataStorePluginProps {} diff --git a/web/src/types/Generated.types.ts b/web/src/types/Generated.types.ts index df9e502531..6ce82351c6 100644 --- a/web/src/types/Generated.types.ts +++ b/web/src/types/Generated.types.ts @@ -1372,6 +1372,7 @@ export interface external { elasticapm?: external["dataStores.yaml"]["components"]["schemas"]["ElasticSearch"]; signalfx?: external["dataStores.yaml"]["components"]["schemas"]["SignalFX"]; awsxray?: external["dataStores.yaml"]["components"]["schemas"]["AwsXRay"]; + azureappinsights?: external["dataStores.yaml"]["components"]["schemas"]["AzureAppInsights"]; /** Format: date-time */ createdAt?: string; }; @@ -1392,6 +1393,12 @@ export interface external { realm?: string; token?: string; }; + AzureAppInsights: { + useAzureActiveDirectoryAuth?: boolean; + accessToken?: string; + connectionType?: external["dataStores.yaml"]["components"]["schemas"]["SupportedConnectionTypes"]; + resourceArmId?: string; + }; AwsXRay: { region?: string; accessKeyId?: string; @@ -1449,9 +1456,12 @@ export interface external { | "lightstep" | "datadog" | "awsxray" - | "honeycomb"; + | "honeycomb" + | "azureappinsights"; /** @enum {string} */ SupportedClients: "http" | "grpc"; + /** @enum {string} */ + SupportedConnectionTypes: "direct" | "collector"; }; }; operations: {};