You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Provide Dynatrace Exporter
Adds a DynatraceMetricsExporter to the provided exporters. This exporter will parse CF
bindings for a Dynatrace service binding. If found, it will export metrics to the API endpoint.
For this to work, the API token field in the service credentials needs to be provided with
`otel.javaagent.extension.sap.cf.binding.dynatrace.metrics.token-name`.
Signed-off-by: Karsten Schnitter <[email protected]>
Copy file name to clipboardExpand all lines: cf-java-logging-support-opentelemetry-agent-extension/README.md
+45-14
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,14 @@
1
-
# OpenTelemetry Java Agent Extension for SAP Cloud Logging
1
+
# OpenTelemetry Java Agent Extension for SAP BTP Observability
2
2
3
3
This module provides an extension for the [OpenTelemetry Java Agent](https://opentelemetry.io/docs/instrumentation/java/automatic/).
4
-
The extension scans the service bindings of an application for [SAP Cloud Logging](https://discovery-center.cloud.sap/serviceCatalog/cloud-logging).
5
-
If such a binding is found, the OpenTelemetry Java Agent is configured to ship observability data to that service.
4
+
The extension scans the service bindings of an application for [SAP Cloud Logging](https://discovery-center.cloud.sap/serviceCatalog/cloud-logging) and [Dynatrace](https://docs.dynatrace.com/docs/setup-and-configuration/setup-on-container-platforms/cloud-foundry/deploy-oneagent-on-sap-cloud-platform-for-application-only-monitoring).
5
+
If such a binding is found, the OpenTelemetry Java Agent is configured to ship observability data to those services.
6
6
Thus, this extension provides a convenient auto-instrumentation for Java applications running on SAP BTP.
7
7
8
8
The extension provides the following main features:
9
9
10
10
* additional exporters for logs, metrics and traces for [SAP Cloud Logging](https://discovery-center.cloud.sap/serviceCatalog/cloud-logging)
11
+
* additional exporter for metrics for [Dynatrace](https://docs.dynatrace.com/docs/setup-and-configuration/setup-on-container-platforms/cloud-foundry/deploy-oneagent-on-sap-cloud-platform-for-application-only-monitoring)
11
12
* auto-configuration of the generic OpenTelemetry connection to [SAP Cloud Logging](https://discovery-center.cloud.sap/serviceCatalog/cloud-logging)
12
13
* adding resource attributes describing the CF application
13
14
@@ -40,17 +41,17 @@ See the [example manifest](../sample-spring-boot/manifest-otel-javaagent.yml), h
40
41
41
42
Once the agent is attached to the JVM with the extension in place, there are two ways, which can be used to send data to [SAP Cloud Logging](https://discovery-center.cloud.sap/serviceCatalog/cloud-logging):
42
43
43
-
1. Use the `cloud-logging` exporters explicitly as provided by the extension.
44
+
1. Use the `cloud-logging`and/or `dynatrace`exporters explicitly as provided by the extension.
44
45
This can be achieved via system properties or environment variables:
@@ -75,8 +76,8 @@ That means, without any configuration the agent with the extension will forward
75
76
The difference between `cloud-logging` and `otlp` exporters are explained in an own [section](#implementation-differences-between-cloud-logging-and-otlp-exporter).
76
77
The benefit of the `cloud-logging` exporter is, that it can be combined with a different configuration of the `otlp` exporter.
77
78
78
-
For the instrumentation to send observability data to [SAP Cloud Logging](https://discovery-center.cloud.sap/serviceCatalog/cloud-logging), the application needs to be bound to a corresponding service instance.
79
-
The service instance can be either managed or [user-provided](#using-user-provided-service-instances).
79
+
For the instrumentation to send observability data to [SAP Cloud Logging](https://discovery-center.cloud.sap/serviceCatalog/cloud-logging) or [Dynatrace](https://docs.dynatrace.com/docs/setup-and-configuration/setup-on-container-platforms/cloud-foundry/deploy-oneagent-on-sap-cloud-platform-for-application-only-monitoring), the application needs to be bound to a corresponding service instances.
80
+
The service instances can be either managed or [user-provided](#using-user-provided-service-instances).
80
81
81
82
## Configuration
82
83
@@ -103,16 +104,19 @@ The extension itself can be configured by specifying the following system proper
103
104
|----------|---------------|---------|
104
105
|`otel.javaagent.extension.sap.cf.binding.cloud-logging.label` or `com.sap.otel.extension.cloud-logging.label`|`cloud-logging`| The label of the managed service binding to bind to. |
105
106
|`otel.javaagent.extension.sap.cf.binding.cloud-logging.tag` or `com.sap.otel.extension.cloud-logging.tag`|`Cloud Logging`| The tag of any service binding (managed or user-provided) to bind to. |
107
+
|`otel.javaagent.extension.sap.cf.binding.dynatrace.label`|`dynatrace`| The label of the managed service binding to bind to. |
108
+
|`otel.javaagent.extension.sap.cf.binding.dynatrace.tag`|`dynatrace`| The tag of any service binding (managed or user-provided) to bind to. |
109
+
|`otel.javaagent.extension.sap.cf.binding.dynatrace.metrics.token-name`|| The name of the field containing the Dynatrace API token within the service binding credentials. This is required to send metrics to Dynatrace. |
106
110
|`otel.javaagent.extension.sap.cf.binding.user-provided.label`|`user-provided`| The label of a user-provided service binding to bind to. Note, this label is defined by the Cloud Foundry instance. |
107
111
|`otel.javaagent.extension.sap.cf.resource.enabled`|`true`| Whether to add CF resource attributes to all events. |
108
112
109
113
> The `otel.javaagent.extension.sap.*` properties are preferred over the `com.sap.otel.extension.*` properties, which are kept for compatibility.
110
114
Each `otel.javaagent.extension.sap.*` property can also be provided as environment variable `OTEL_JAVAAGENT_EXTENSION_SAP_*`.
111
115
112
116
The extension will scan the environment variable `VCAP_SERVICES` for CF service bindings.
113
-
User-provided bindings will take precedence over managed bindings of the configured label ("cloud-logging" by default).
114
-
All matching bindings are filtered for the configured tag ("Cloud Logging" by default).
115
-
The first binding will be taken for configuration for the OpenTelemetry exporter.
117
+
User-provided bindings will take precedence over managed bindings of the configured label ("cloud-logging" or "dynatrace" by default).
118
+
All matching bindings are filtered for the configured tag ("Cloud Logging" od "dynatrace" by default).
119
+
The first Cloud Logging binding will be taken for configuration for the standard OpenTelemetry (otlp) exporter.
116
120
Preferring user-provided services over managed service instances allows better control of the binding properties, e.g. syslog drains.
117
121
118
122
### Recommended Agent Configuration
@@ -140,14 +144,16 @@ The [OpenTelemetry Java Instrumentation project](https://github.com/open-telemet
140
144
141
145
## Using User-Provided Service Instances
142
146
147
+
### SAP Cloud Logging
148
+
143
149
The extension provides support not only for managed service instance of [SAP Cloud Logging](https://discovery-center.cloud.sap/serviceCatalog/cloud-logging) but also for user-provided service instances.
144
150
This helps to fine-tune the configuration, e.g. leave out or reconfigure the syslog drain.
145
151
Furthermore, this helps on sharing service instances across CF orgs or landscapes.
146
152
147
-
The extension requires four fields in the user-provided service credentials and needs to be tagged with the `com.sap.otel.extension.cloud-logging.tag` (default: `Cloud Logging`) documented in section [Configuration](#configuration).
153
+
The extension requires four fields in the user-provided service credentials and needs to be tagged with the `otel.javaagent.extension.sap.cf.binding.cloud-logging.tag` (default: `Cloud Logging`) documented in section [Configuration](#configuration).
148
154
149
155
| Field name | Contents |
150
-
|------------|---------|
156
+
|------------|----------|
151
157
|`ingest-otlp-endpoint`| The OTLP endpoint including port. It will be prefixed with `https://`. |
152
158
|`ingest-otlp-key`| The mTLS client key in PCKS#8 format. Line breaks as `\n`. |
153
159
|`ingest-otlp-cert`| The mTLS client certificate in PEM format matching the client key. Line breaks as `\n`. |
@@ -172,6 +178,31 @@ Note, that you can easily feed arbitrary credentials to the extension.
172
178
It does not need to be [SAP Cloud Logging](https://discovery-center.cloud.sap/serviceCatalog/cloud-logging).
173
179
You can even change the tag using the configuration parameters of the extension.
174
180
181
+
### Dynatrace
182
+
183
+
SAP BTP internally offers a managed Dynatrace service, that is recognized by the extension.
184
+
Externally, user-provided service instances need to be created.
185
+
The [Dynatrace documentation](https://docs.dynatrace.com/docs/setup-and-configuration/setup-on-container-platforms/cloud-foundry/deploy-oneagent-on-sap-cloud-platform-for-application-only-monitoring) explains, how to generate the necessary access url and tokens.
186
+
The extension requires two fields in the user-provided service credentials and needs to be tagged with the `otel.javaagent.extension.sap.cf.binding.dynatrace.tag` (default: `dynatrace`) documented in section [Configuration](#configuration).
187
+
188
+
| Field name | Contents |
189
+
|------------|----------|
190
+
|`apiurl`| The Dynatrace API endpoint, e.g. `https://apm.example.com/e/<some-uuid>/api`. This url will be appended with `/v2/otlp/v1/metrics` to create the full endpoint url. |
191
+
|`<your_token_field>`| The API token to be used with the above endpoint. Ensure, that it has the required permissions to ingest data over the endpoint. |
192
+
193
+
Do not forget to configure the name chosen for `<your_token_field>` via the respective configuration property:
## Implementation Differences between Cloud-Logging and OTLP Exporter
176
207
177
208
The `cloud-logging` exporter provided by this extension is a facade for the `OtlpGrpcExporter` provided by the OpenTelemetry Java Agent, just like the `otlp` exporter.
Copy file name to clipboardExpand all lines: cf-java-logging-support-opentelemetry-agent-extension/src/main/java/com/sap/hcf/cf/logging/opentelemetry/agent/ext/CloudLoggingConfigurationCustomizerProvider.java
+1-1
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ public class CloudLoggingConfigurationCustomizerProvider implements AutoConfigur
Copy file name to clipboardExpand all lines: cf-java-logging-support-opentelemetry-agent-extension/src/main/java/com/sap/hcf/cf/logging/opentelemetry/agent/ext/binding/CloudLoggingBindingPropertiesSupplier.java
Copy file name to clipboardExpand all lines: cf-java-logging-support-opentelemetry-agent-extension/src/main/java/com/sap/hcf/cf/logging/opentelemetry/agent/ext/binding/CloudLoggingServicesProvider.java
Copy file name to clipboardExpand all lines: cf-java-logging-support-opentelemetry-agent-extension/src/main/java/com/sap/hcf/cf/logging/opentelemetry/agent/ext/exporter/CloudLoggingLogsExporterProvider.java
Copy file name to clipboardExpand all lines: cf-java-logging-support-opentelemetry-agent-extension/src/main/java/com/sap/hcf/cf/logging/opentelemetry/agent/ext/exporter/CloudLoggingMetricsExporterProvider.java
Copy file name to clipboardExpand all lines: cf-java-logging-support-opentelemetry-agent-extension/src/main/java/com/sap/hcf/cf/logging/opentelemetry/agent/ext/exporter/CloudLoggingSpanExporterProvider.java
0 commit comments