-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc56a0b
commit d4ced2d
Showing
6 changed files
with
103 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package config | ||
|
||
import ( | ||
"errors" | ||
|
||
"github.com/odigos-io/odigos/common" | ||
) | ||
|
||
const ( | ||
l9OtlpEndpointKey = "LAST9_OTLP_ENDPOINT" | ||
l9OtlpAuthHeaderKey = "LAST9_OTLP_BASIC_AUTH_HEADER" | ||
) | ||
|
||
type MyDest struct{} | ||
|
||
func (m *MyDest) DestType() common.DestinationType { | ||
// DestinationType defined in common/dests.go | ||
return common.Last9DestinationType | ||
} | ||
|
||
func (m *MyDest) ModifyConfig(dest ExporterConfigurer, currentConfig *Config) error { | ||
config := dest.GetConfig() | ||
l9OtlpEndpoint, exists := config[l9OtlpEndpointKey] | ||
if !exists { | ||
return errors.New("Last9 OpenTelemetry Endpoint key(\"LAST9_OTLP_ENDPOINT\") not specified, Last9 will not be configured") | ||
} | ||
|
||
l9OtlpAuthHeader, exists := config[l9OtlpAuthHeaderKey] | ||
if !exists { | ||
return errors.New("Last9 OpenTelemetry Basic Auth Header key(\"LAST9_OTLP_BASIC_AUTH_HEADER\") not specified, Last9 will not be configured") | ||
} | ||
|
||
// to make sure that the exporter name is unique, we'll ask a ID from destination | ||
exporterName := "otlp/last9-" + dest.GetID() | ||
currentConfig.Exporters["otlp/last9"] = GenericMap{ | ||
"endpoint": l9OtlpEndpoint, | ||
"headers": GenericMap{ | ||
"Authorization": l9OtlpAuthHeader, | ||
}, | ||
} | ||
|
||
// Modify the config here | ||
if isTracingEnabled(dest) { | ||
tracesPipelineName := "traces/last9-" + dest.GetID() | ||
currentConfig.Service.Pipelines[tracesPipelineName] = Pipeline{ | ||
Exporters: []string{exporterName}, | ||
} | ||
} | ||
|
||
if isMetricsEnabled(dest) { | ||
metricsPipelineName := "metrics/last9-" + dest.GetID() | ||
currentConfig.Service.Pipelines[metricsPipelineName] = Pipeline{ | ||
Exporters: []string{exporterName}, | ||
} | ||
} | ||
|
||
if isLoggingEnabled(dest) { | ||
logsPipelineName := "logs/last9-" + dest.GetID() | ||
currentConfig.Service.Pipelines[logsPipelineName] = Pipeline{ | ||
Exporters: []string{exporterName}, | ||
} | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
apiVersion: internal.odigos.io/v1beta1 | ||
kind: Destination | ||
metadata: | ||
type: last9 | ||
displayName: Last9 | ||
category: managed | ||
spec: | ||
image: last9.svg | ||
signals: | ||
traces: | ||
supported: true | ||
metrics: | ||
supported: true | ||
logs: | ||
supported: true | ||
fields: | ||
- name: LAST9_OTLP_ENDPOINT | ||
displayName: Last9 OpenTelemetry Endpoint | ||
componentType: input | ||
componentProps: | ||
type: text | ||
required: true | ||
tooltip: 'Last9 OpenTelemetry Endpoint. Can be found at https://app.last9.io/integrations?category=all&integration=OpenTelemetry' | ||
- name: LAST9_OTLP_BASIC_AUTH_HEADER | ||
displayName: Basic Auth Header | ||
componentType: input | ||
componentProps: | ||
type: password | ||
required: true | ||
placeholder: "Last9 Basic Auth Header" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.