Skip to content

Commit

Permalink
add fix for metricsProperties when HasPrometheusConfigFile is true. (#…
Browse files Browse the repository at this point in the history
…847)

* add fix for metricsProperties when HasPrometheusConfigFile is true.

* add new config MetricsPropertiesFile.

* add missing auto-generated code from privous PRs.

* fix monitoring_config_test.go test condition, redo the configmap logic in monitoring_config.go.

* redo the configmap & javaOption logic in monitoring_config.go.

* set back the configmap & javaOption logic in monitoring_config.go

* update log.
  • Loading branch information
jinxingwang committed Mar 31, 2020
1 parent 92d2dbb commit 5afcce2
Show file tree
Hide file tree
Showing 9 changed files with 554 additions and 43 deletions.
41 changes: 40 additions & 1 deletion docs/api-docs.md
Expand Up @@ -921,6 +921,20 @@ string
GC settings or other logging.</p>
</td>
</tr>
<tr>
<td>
<code>lifecycle</code></br>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.13/#lifecycle-v1-core">
Kubernetes core/v1.Lifecycle
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Lifecycle for running preStop or postStart commands</p>
</td>
</tr>
</tbody>
</table>
<h3 id="sparkoperator.k8s.io/v1beta2.ExecutorSpec">ExecutorSpec
Expand Down Expand Up @@ -1111,6 +1125,19 @@ If not specified, the content in spark-docker/conf/metrics.properties will be us
</tr>
<tr>
<td>
<code>metricsPropertiesFile</code></br>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>MetricsPropertiesFile is the container local path of file metrics.properties for configuring the Spark metric system.
If not specified, value /etc/metrics/conf/metrics.properties will be used.</p>
</td>
</tr>
<tr>
<td>
<code>prometheus</code></br>
<em>
<a href="#sparkoperator.k8s.io/v1beta2.PrometheusSpec">
Expand Down Expand Up @@ -2477,10 +2504,22 @@ Kubernetes core/v1.PodDNSConfig
<p>DnsConfig dns settings for the pod, following the Kubernetes specifications.</p>
</td>
</tr>
<tr>
<td>
<code>terminationGracePeriodSeconds</code></br>
<em>
int64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Termination grace periond seconds for the pod</p>
</td>
</tr>
</tbody>
</table>
<hr/>
<p><em>
Generated with <code>gen-crd-api-reference-docs</code>
on git commit <code>c8ae9e3</code>.
on git commit <code>8fdcbf2f5</code>.
</em></p>
2 changes: 1 addition & 1 deletion docs/user-guide.md
Expand Up @@ -619,7 +619,7 @@ Note that Python binding for PySpark is available in Apache Spark 2.4.

### Monitoring

The operator supports using the Spark metric system to expose metrics to a variety of sinks. Particularly, it is able to automatically configure the metric system to expose metrics to [Prometheus](https://prometheus.io/). Specifically, the field `.spec.monitoring` specifies how application monitoring is handled and particularly how metrics are to be reported. The metric system is configured through the configuration file `metrics.properties`, which gets its content from the field `.spec.monitoring.metricsProperties`. The content of [metrics.properties](../spark-docker/conf/metrics.properties) will be used by default if `.spec.monitoring.metricsProperties` is not specified. You can choose to enable or disable reporting driver and executor metrics using the fields `.spec.monitoring.exposeDriverMetrics` and `.spec.monitoring.exposeExecutorMetrics`, respectively.
The operator supports using the Spark metric system to expose metrics to a variety of sinks. Particularly, it is able to automatically configure the metric system to expose metrics to [Prometheus](https://prometheus.io/). Specifically, the field `.spec.monitoring` specifies how application monitoring is handled and particularly how metrics are to be reported. The metric system is configured through the configuration file `metrics.properties`, which gets its content from the field `.spec.monitoring.metricsProperties`. The content of [metrics.properties](../spark-docker/conf/metrics.properties) will be used by default if `.spec.monitoring.metricsProperties` is not specified. `.spec.monitoring.metricsPropertiesFile` overwrite the value `spark.metrics.conf` in spark.properties, and will not use content from `.spec.monitoring.metricsProperties`. You can choose to enable or disable reporting driver and executor metrics using the fields `.spec.monitoring.exposeDriverMetrics` and `.spec.monitoring.exposeExecutorMetrics`, respectively.

Further, the field `.spec.monitoring.prometheus` specifies how metrics are exposed to Prometheus using the [Prometheus JMX exporter](https://github.com/prometheus/jmx_exporter). When `.spec.monitoring.prometheus` is specified, the operator automatically configures the JMX exporter to run as a Java agent. The only required field of `.spec.monitoring.prometheus` is `jmxExporterJar`, which specified the path to the Prometheus JMX exporter Java agent jar in the container. If you use the image `gcr.io/spark-operator/spark:v2.4.5-gcs-prometheus`, the jar is located at `/prometheus/jmx_prometheus_javaagent-0.11.0.jar`. The field `.spec.monitoring.prometheus.port` specifies the port the JMX exporter Java agent binds to and defaults to `8090` if not specified. The field `.spec.monitoring.prometheus.configuration` specifies the content of the configuration to be used with the JMX exporter. The content of [prometheus.yaml](../spark-docker/conf/prometheus.yaml) will be used by default if `.spec.monitoring.prometheus.configuration` is not specified.

Expand Down
153 changes: 153 additions & 0 deletions manifest/crds/sparkoperator.k8s.io_scheduledsparkapplications.yaml
Expand Up @@ -434,6 +434,27 @@ spec:
- name
type: object
type: array
envFrom:
items:
properties:
configMapRef:
properties:
name:
type: string
optional:
type: boolean
type: object
prefix:
type: string
secretRef:
properties:
name:
type: string
optional:
type: boolean
type: object
type: object
type: array
envSecretKeyRefs:
additionalProperties:
properties:
Expand Down Expand Up @@ -919,6 +940,109 @@ spec:
additionalProperties:
type: string
type: object
lifecycle:
properties:
postStart:
properties:
exec:
properties:
command:
items:
type: string
type: array
type: object
httpGet:
properties:
host:
type: string
httpHeaders:
items:
properties:
name:
type: string
value:
type: string
required:
- name
- value
type: object
type: array
path:
type: string
port:
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
scheme:
type: string
required:
- port
type: object
tcpSocket:
properties:
host:
type: string
port:
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
required:
- port
type: object
type: object
preStop:
properties:
exec:
properties:
command:
items:
type: string
type: array
type: object
httpGet:
properties:
host:
type: string
httpHeaders:
items:
properties:
name:
type: string
value:
type: string
required:
- name
- value
type: object
type: array
path:
type: string
port:
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
scheme:
type: string
required:
- port
type: object
tcpSocket:
properties:
host:
type: string
port:
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
required:
- port
type: object
type: object
type: object
memory:
type: string
memoryOverhead:
Expand Down Expand Up @@ -1439,6 +1563,9 @@ spec:
- name
type: object
type: array
terminationGracePeriodSeconds:
format: int64
type: integer
tolerations:
items:
properties:
Expand Down Expand Up @@ -1840,6 +1967,27 @@ spec:
- name
type: object
type: array
envFrom:
items:
properties:
configMapRef:
properties:
name:
type: string
optional:
type: boolean
type: object
prefix:
type: string
secretRef:
properties:
name:
type: string
optional:
type: boolean
type: object
type: object
type: array
envSecretKeyRefs:
additionalProperties:
properties:
Expand Down Expand Up @@ -2844,6 +2992,9 @@ spec:
- name
type: object
type: array
terminationGracePeriodSeconds:
format: int64
type: integer
tolerations:
items:
properties:
Expand Down Expand Up @@ -2915,6 +3066,8 @@ spec:
type: boolean
metricsProperties:
type: string
metricsPropertiesFile:
type: string
prometheus:
properties:
configFile:
Expand Down

0 comments on commit 5afcce2

Please sign in to comment.